Skip to content

feat: subdirectory for numtracker - #1748

Open
ZohebShaikh wants to merge 7 commits into
mainfrom
make-numtracker-more-configurable
Open

ZohebShaikh wants to merge 7 commits into
mainfrom
make-numtracker-more-configurable

Conversation

@ZohebShaikh

@ZohebShaikh ZohebShaikh commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

closes #1607, #1199

@ZohebShaikh
ZohebShaikh requested a review from a team as a code owner November 9, 2026 23:41
@codecov

codecov Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.34%. Comparing base (7cf9bd8) to head (e5db6bf).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1748      +/-   ##
==========================================
- Coverage   96.37%   96.34%   -0.04%     
==========================================
  Files          50       50              
  Lines        3831     3853      +22     
==========================================
+ Hits         3692     3712      +20     
- Misses        139      141       +2     

☔ 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.

@Alexj9837 Alexj9837 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@tpoliaw tpoliaw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is the change to make this usable from the CLI/client going to be its own PR or should that be included here as well?

Comment thread src/blueapi/service/model.py Resolved
Comment thread src/blueapi/service/numtracker.py Resolved
Comment thread tests/conftest.py Outdated
return {
"query": dedent("""
mutation{
mutation(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The constant would also help this stay in sync

ZohebShaikh and others added 4 commits November 10, 2026 20:05
…configurable

# Conflicts:
#	src/blueapi/core/context.py
#	tests/unit_tests/service/test_interface.py
Co-authored-by: Peter Holloway <peter.holloway@diamond.ac.uk>

@tpoliaw tpoliaw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

At the moment does anything actually use the subdirectory - can the nexus writer handle it?

Another issue, possibly for another PR, is how to handle invalid subdirectories. numtracker blocks anything that isn't a 'normal' relative path. eg ../foo and /foo will be blocked to prevent users writing outside their visit directories but this will only be checked at the start of a run, potentially a long time into a plan running. Is this an issue?

This also gives us a new error case from numtracker which could potentially be handled better although, again, it shouldn't block this PR.

$ blueapi controller run -i cm12345-1 count -a '[["det"]]' --subdirectory '../foo'
Plan failed: RuntimeError: Numtracker error: [{'message': 'Failed to parse "Subdirectory": Segment 0 of path is not valid for a subdirectory', 'locations': [{'line': 10, 'column': 14}], 'path': ['scan']}]

The information is there so it's ok for now but a custom error message probably wouldn't hurt.

Comment thread src/blueapi/cli/cli.py Outdated
required=True,
)
@click.option(
"-sub",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Single - should only be used for single letter flags. Either -s or --sub

Comment thread src/blueapi/service/numtracker.py Outdated
}}
}}
""")
"query": dedent(CREATE_SCAN_MUTATION),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: dedent isn't needed, graphql ignores whitespace

This branch has not been deployed

No deployments
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.

Make numtracker configurable per plan Numtracker client passes user supplied visit directly

3 participants