Skip to content
Snippets Groups Projects

Add caldb_root as parameter for CalibrationData

Merged Thomas Kluyver requested to merge feat/calcatapi-root-dir into master
2 unresolved threads

Description

At present, the CalibrationData API can't be used with test CalCat - you can point it to the right server, but the root directory it uses for constants is hardcoded. This MR allows passing in the root directory, e.g. /gpfs/exfel/d/cal_tst/caldb_store .

If no path is given, it uses the existing logic to find the default directory for the production calcat.

How Has This Been Tested?

TBD - it's a simple change, so I wanted to check if this is the design we want before getting into testing.

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • My code follows the code style of this project.

Reviewers

@schmidtp

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Thomas Kluyver added 1 commit

    added 1 commit

    • 4a913984 - No need for a sentinel for 'not available' here

    Compare with previous version

  • Karim Ahmed resolved all threads

    resolved all threads

  • LGTM. Thank you, @kluyvert

    Edited by Karim Ahmed
  • I'm sorry to be late, but wouldn't this MR cause the auto-detection to re-run for every CalibrationData object that is created without an explicit caldb_root?

    • It would, yes. Would you like me to make it so that logic runs only once?

    • I think yes, I don't know if the call to socket.getfqdn() may potentially be expensive. It makes total sense to be apply to supply it, but maybe we can just put the auto detection in a classmethod that will only ever run once and deposit its result in some class-level variable.

    • Please register or sign in to reply
    • Also, while I'm looking at it, I might make it see if /gpfs/exfel/d/cal/caldb_store exists, rather than checking the hostname. That should do the right thing if e.g. you're in a container with a different hostname but /gpfs is mounted.

    • Yes, checking for the existence of either location may be more reliable. Unlikely someone creates an identical path just for fun on a different system. Not finding either may also point to a missing GPFS mount though, so any exception message should include that possibility.

      Edited by Philipp Schmidt
    • Please register or sign in to reply
  • Thomas Kluyver added 1 commit

    added 1 commit

    • e78f6e1d - Find default caldb_root once, based on whether directories exist

    Compare with previous version

  • OK, now it's based on whether the directories exist, and only checked once (I moved this to when you first create a CalibrationData object, simplifying the code a bit).

    The error we raise is currently RuntimeError("calibration database store unavailable").

  • I see you became a fan of Ellipsis in this context now :grin:

    Thanks, LGTM.

  • merged

  • Thomas Kluyver mentioned in commit fbf2ca49

    mentioned in commit fbf2ca49

  • Please register or sign in to reply
    Loading