fix(omny): accept p-accounts as valid in TomoIDManager
CI for csaxs_bec / test (push) Successful in 2m12s
CI for csaxs_bec / test (push) Successful in 2m12s
bec.active_account is normally a p##### proposal account in production, but _is_valid_eaccount() only matched e#####, causing every real beamtime session to be silently rejected and fall back to tomo ID 0 (skipping OMNY registration and PDF upload). Widen the regex to accept both e- and p-accounts while still rejecting test/gac-* accounts. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CpPtD7tCRwRZZnREhWcJi8
This commit is contained in:
1 parent
9f922d869f
commit
df433c88c4
1 file changed
+6
-4
@@ -327,6 +327,8 @@ class TomoIDManager:
|
||||
"""Registers a tomography measurement in the OMNY sample database
|
||||
and returns its assigned tomo ID.
|
||||
|
||||
Real e-accounts (personal, e.g. "e12345") and p-accounts (proposal
|
||||
accounts, e.g. "p23092") are both registered against OMNY_URL.
|
||||
Non-production accounts (e.g. test accounts like "gac-x01dc") are not
|
||||
registered against OMNY_URL at all -- there is no longer a separate
|
||||
test server to redirect them to, and registering test runs against
|
||||
@@ -351,8 +353,8 @@ class TomoIDManager:
|
||||
|
||||
@staticmethod
|
||||
def _is_valid_eaccount(eaccount: str) -> bool:
|
||||
"""True for real e-accounts (e.g. "e12345"), False for test accounts."""
|
||||
return bool(re.fullmatch(r"e\d{5}", eaccount.strip()))
|
||||
"""True for real e- or p-accounts (e.g. "e12345", "p23092"), False for test accounts."""
|
||||
return bool(re.fullmatch(r"[ep]\d{5}", eaccount.strip()))
|
||||
|
||||
def register(
|
||||
self,
|
||||
@@ -366,7 +368,7 @@ class TomoIDManager:
|
||||
) -> int:
|
||||
"""Register a new measurement and return the assigned tomo ID.
|
||||
|
||||
Registers against OMNY_URL for a real e-account. For any other
|
||||
Registers against OMNY_URL for a real e- or p-account. For any other
|
||||
account (e.g. a test/"gac-*" account), skips registration entirely
|
||||
and returns FALLBACK_TOMO_ID (0) -- there is no separate test
|
||||
server to register against, and registering test runs against
|
||||
@@ -376,7 +378,7 @@ class TomoIDManager:
|
||||
"""
|
||||
if not self._is_valid_eaccount(eaccount):
|
||||
logger.warning(
|
||||
f"Account '{eaccount}' is not a valid e-account; skipping OMNY "
|
||||
f"Account '{eaccount}' is not a valid e- or p-account; skipping OMNY "
|
||||
f"registration (no separate test server to register against) "
|
||||
f"and falling back to tomo ID {self.FALLBACK_TOMO_ID}."
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user