diff --git a/csaxs_bec/bec_ipython_client/plugins/OMNY_shared/omny_general_tools.py b/csaxs_bec/bec_ipython_client/plugins/OMNY_shared/omny_general_tools.py index 218105fa..3959efb5 100644 --- a/csaxs_bec/bec_ipython_client/plugins/OMNY_shared/omny_general_tools.py +++ b/csaxs_bec/bec_ipython_client/plugins/OMNY_shared/omny_general_tools.py @@ -327,12 +327,11 @@ class TomoIDManager: """Registers a tomography measurement in the OMNY sample database and returns its assigned tomo ID. - Non-production accounts (e.g. test accounts like "gac-x01dc") register - against the test server (TEST_OMNY_URL) instead of production, so - testing still gets a real, incrementing tomo ID -- matching the - counter the samples-folder PDF upload reads from on that same test - host -- accepting that the eaccount recorded in that test database - won't be a real e-account. + 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 + the production sample database would pollute it. They get + FALLBACK_TOMO_ID instead. Usage: id_manager = TomoIDManager() @@ -348,7 +347,6 @@ class TomoIDManager: """ OMNY_URL = "https://omny.psi.ch/samples/newmeasurement.php" - TEST_OMNY_URL = "https://omny.psi.ch/samples/newmeasurement.php" FALLBACK_TOMO_ID = 0 @staticmethod @@ -368,20 +366,21 @@ class TomoIDManager: ) -> int: """Register a new measurement and return the assigned tomo ID. - Registers against OMNY_URL (production) for a real e-account, or - TEST_OMNY_URL (test server) otherwise. Returns FALLBACK_TOMO_ID (0) - only if the server actually can't be reached / returns an unusable - response. + Registers against OMNY_URL for a real e-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 + production would pollute the real sample database. FALLBACK_TOMO_ID + is also returned if the server actually can't be reached / returns + an unusable response. """ - if self._is_valid_eaccount(eaccount): - omny_url = self.OMNY_URL - else: - omny_url = self.TEST_OMNY_URL + if not self._is_valid_eaccount(eaccount): logger.warning( - f"Account '{eaccount}' is not a valid e-account; registering " - f"against the test server ({self.TEST_OMNY_URL}) instead of " - "production -- the eaccount recorded there won't be real." + f"Account '{eaccount}' is not a valid e-account; skipping OMNY " + f"registration (no separate test server to register against) " + f"and falling back to tomo ID {self.FALLBACK_TOMO_ID}." ) + return self.FALLBACK_TOMO_ID params = { "sample": sample_name, @@ -407,7 +406,7 @@ class TomoIDManager: try: response = requests.get( - omny_url, + self.OMNY_URL, params=params, timeout=30, verify=False, # accept self-signed certs diff --git a/csaxs_bec/bec_ipython_client/plugins/OMNY_shared/tomo_queue_mixin.py b/csaxs_bec/bec_ipython_client/plugins/OMNY_shared/tomo_queue_mixin.py index 927c546a..03c1c6f1 100644 --- a/csaxs_bec/bec_ipython_client/plugins/OMNY_shared/tomo_queue_mixin.py +++ b/csaxs_bec/bec_ipython_client/plugins/OMNY_shared/tomo_queue_mixin.py @@ -392,9 +392,8 @@ class TomoQueueMixin: user=user, ) - # Must match whatever host TomoIDManager.OMNY_URL/TEST_OMNY_URL - # registered against, since that host's sample counter is what - # self.tomo_id came from. + # Must match whatever host TomoIDManager.OMNY_URL registered against, + # since that host's sample counter is what self.tomo_id came from. _SAMPLES_UPLOAD_HOSTS = ("https://omny.psi.ch",) def _upload_pdf_report_to_samples(self, pdf_path: str) -> None: