diff --git a/doc/changes/DM-54613.other.rst b/doc/changes/DM-54613.other.rst new file mode 100644 index 00000000..9e45c6ac --- /dev/null +++ b/doc/changes/DM-54613.other.rst @@ -0,0 +1,2 @@ +Changed BPS behavior so it doesn't throw when there are job labels in job ordering groups that were not included in the final version of the workflow. +From now on BPS will only warn the user when it occures. diff --git a/python/lsst/ctrl/bps/generic_workflow.py b/python/lsst/ctrl/bps/generic_workflow.py index 65889d95..c3c583bc 100644 --- a/python/lsst/ctrl/bps/generic_workflow.py +++ b/python/lsst/ctrl/bps/generic_workflow.py @@ -990,9 +990,10 @@ def _check_job_ordering_config(self, ordering_config: dict[str, Any]) -> dict[st if unused_labels: _LOG.info("Workflow job labels = %s", ",".join(self._job_labels.labels)) - raise RuntimeError( - f"Job label(s) ({','.join(unused_labels)}) from job ordering group " - f"{group} does not exist in workflow. Aborting." + _LOG.warning( + "Job label(s) (%s) from job ordering group %s does not exist in workflow.", + ",".join(unused_labels), + group, ) label_subgraph = self._job_labels.subgraph(job_labels) diff --git a/tests/test_generic_workflow.py b/tests/test_generic_workflow.py index 13cb37e2..a48f951e 100644 --- a/tests/test_generic_workflow.py +++ b/tests/test_generic_workflow.py @@ -451,11 +451,7 @@ def testCheckJobOrderingConfigBadLabel(self): def testCheckJobOrderingConfigUnusedLabel(self): gwf = gtu.make_3_label_workflow("test_unused_label", final=True) - with self.assertRaisesRegex( - RuntimeError, - r"Job label\(s\) \(unused1,unused2\) from job ordering group " - "order1 does not exist in workflow. Aborting.", - ): + with self.assertLogs("lsst.ctrl.bps.generic_workflow", level=logging.WARNING) as cm: gwf._check_job_ordering_config( { "order1": { @@ -465,6 +461,14 @@ def testCheckJobOrderingConfigUnusedLabel(self): }, } ) + self.assertTrue( + any( + "Job label(s) (unused1,unused2) from job ordering group order1 does not exist in workflow." + in record.getMessage() + for record in cm.records + ), + "Expected warning about unused labels", + ) def testCheckJobOrderingConfigMissingDim(self): gwf = gtu.make_3_label_workflow("test_missing_dim", final=True)