Skip to content

Numtracker should provide a helpful error message when the instrument session is bad #279

Open

Description

@EmsArnold

Currently, if an instrument session is typed incorrectly, a very unhelpful error message is given. A few scenarios were tried, including:

  • An incorrectly formatted session id (cm1234-1): RuntimeError: Numtracker error: [{'message': 'Authentication failed', 'locations': [{'line': 3, 'column': 5}], 'path': ['scan']}]
  • A correctly formatted but non-existent session id (cm12345-1): RuntimeError: Numtracker error: [{'message': 'Authentication failed', 'locations': [{'line': 3, 'column': 5}], 'path': ['scan']}]
  • An correctly formatted but non-existant session id with the correct proposal number and session number, but incorrect prefix (sm44191-3):
    • With no file-writing detector: A "successful" task run, with failure to write a nexus file - {"timestamp":"2026-06-15T08:14:56.496","level":"ERROR","thread":"pool-1-thread-4","logger":"uk.ac.diamond.daq.services.BlueskyNexusFileWriterService","message":"Unable to find File for ScanID 3b700b88-21dd-420d-89e2-281c2ba28d93","context":"default","beamline":"b01-1","application_name":"Document to Nexus Converter"}
    • With a file writing detector: A "failed" task run, with the file-writing detector throwing an error - <WatchableAsyncStatus, device: spectroscopy_detector, task: <coroutine object AsyncStatusBase.__init__.<locals>.wait_with_error_message at 0x7f8e7808d740>, errored: FileNotFoundError("Path /dls/b01-1/data/2026/sm44191-3/spool/ doesn't exist or not writable!")>

With respect to the first two errors, it would be good if some indication were given as to what was wrong - i.e. something along the lines of "Instrument session / visit was not recognised"

Activity

  1. EmsArnold commented on Jun 16, 2026

    @EmsArnold
    Author

    With respect to the third point above (correctly formatted session ID with an incorrect prefix), as the prefix is relied upon later (for file-writing detectors, NeXus writing, and I'm assuming setting the associated session ID for Tiled) its correctness should be checked, and if it is incorrect a task should fail.

  2. tpoliaw commented on Jun 23, 2026

    @tpoliaw
    Collaborator

    The first two should be improved by recent blueapi and numtracker changes.

    The third point is more difficult because I don't think the session code is in the data we're using for authz. It might be available in the new data bundle OPA. @NeilSmithDLS?

  3. NeilSmithDLS commented on Jul 22, 2026

    @NeilSmithDLS

    As you will know, the session reference is formatted as "-" There is nothing in UAS that enforces the format of the proposal number so it can be any number of digits, therefore cm1234-1 in the first bullet point is a valid format, as will cm123456-1 once/if diamond gets to 100,000 proposals (don't ask me why but there are also some proposals with negative proposal numbers, although these are very old). This means that bullet point 1 and bullet point 2 are actually the same problem, of the proposal/session not existing

  4. NeilSmithDLS commented on Jul 22, 2026

    @NeilSmithDLS

    regarding validation of the proposal category, yes this will be possible via OPA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions