Skip to content

Support dynamic enable/disable of VENUS image cataloging - #109

Merged
darshdinger merged 1 commit into
mainfrom
venus-image-cataloging-toggle
Jul 23, 2026
Merged

Support dynamic enable/disable of VENUS image cataloging#109
darshdinger merged 1 commit into
mainfrom
venus-image-cataloging-toggle

Conversation

@darshdinger

Copy link
Copy Markdown
Contributor

Short description of the changes:

Make VENUS image cataloging something we can turn on and off per instrument, the same easy way we already toggle autoreduction. Image cataloging now runs only when catalog_<INSTRUMENT>.py is present in the instrument's shared autoreduce directory, so moving that one file disables it with no code change, config edit, or service restart.

Long description of the changes:

Image cataloging is a VENUS-specific substep of ONCat cataloging. It used to run unconditionally, inline in ONCatProcessor.ingest(). When the VENUS team tested a high-frequency detector that produced large images, cataloging times shot up and backed up the shared autoreducers, and we had no quick way to shut that substep off.

This change gates the substep on the presence of /<facility>/<instrument>/shared/autoreduce/catalog_<INSTRUMENT>.py, mirroring the reduce_<INSTRUMENT>.py convention instrument scientists already use to enable/disable autoreduction. The agent only checks that the file exists; it does not execute its contents. Move or rename the file and image cataloging stops for that instrument on the next job. Raw and related-file cataloging are untouched either way, so this only affects the image step.

Kept the actual cataloging logic (and its ONCat credentials) inside the agent rather than shelling out to a standalone script, so there are no credentials to plumb out and the change stays small.

Specifics:

  • Extracted the inline image step into ONCatProcessor.catalog_images(), gated on the script's presence. Honors the existing dev_instrument_shared override so it can be exercised locally and in integration tests.
  • Clear logging on both paths (Image cataloging enabled/disabled for <INSTRUMENT>).
  • Added configuration/catalog_VENUS.py.example, a documented, ready-to-deploy marker.

Check list for the pull request

  • I have read the [CONTRIBUTING]
  • I have read the [CODE_OF_CONDUCT]
  • I have added tests for my changes
  • I have updated the documentation accordingly

Check list for the reviewer

  • I have read the [CONTRIBUTING]
  • I have verified the proposed changes
  • best software practices
    • all internal functions have an underbar, as is python standard
    • clearly named variables (better to be verbose in variable names)
    • code comments explaining the intent of code blocks
  • All the tests are passing
  • The documentation is up to date
  • code comments added when explaining intent

Manual test for the reviewer

Unit tests:

pixi run test-unit

Integration tests (requires Docker):

docker compose -f tests/integration/docker-compose.yml up -d --build
pixi run test-integration
docker compose -f tests/integration/docker-compose.yml down

End-to-end toggle check:

  • Enabled path: test_oncat_catalog_venus_images — VENUS has catalog_VENUS.py provisioned, so image files are batch-ingested and a COMPLETE message is returned.
  • Disabled path: test_oncat_catalog_images_disabled — the IMAGING test instrument has image files and image metadata but no catalog_IMAGING.py, so the main file is still cataloged (COMPLETE) and no image batch request is made.

To try it by hand against a running agent, place/remove /SNS/VENUS/shared/autoreduce/catalog_VENUS.py and send a CATALOG.ONCAT.DATA_READY message for a VENUS run; the agent log will show Image cataloging enabled for VENUS or Image cataloging disabled for VENUS.

References

EWM 17055

@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.04%. Comparing base (1ac2eab) to head (ae5bf9a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #109      +/-   ##
==========================================
+ Coverage   81.90%   82.04%   +0.13%     
==========================================
  Files          16       16              
  Lines        1293     1303      +10     
==========================================
+ Hits         1059     1069      +10     
  Misses        234      234              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This comment was marked as resolved.

@backmari backmari left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! I really like that it's the presence/absence of the file that works as the toggle, but the logic that gets executed is still in the package 👌

@darshdinger
darshdinger merged commit c030ccf into main Jul 23, 2026
8 checks passed
@darshdinger
darshdinger deleted the venus-image-cataloging-toggle branch July 23, 2026 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants