From c457d75e75b1eb753cb0bfdd2ae8e5b979b285a6 Mon Sep 17 00:00:00 2001 From: Michael Thornton Date: Sat, 23 Nov 2024 15:40:20 -0800 Subject: [PATCH] update tests and logging --- nmdc_automation/workflow_automation/sched.py | 4 +++- tests/test_workflow_process.py | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/nmdc_automation/workflow_automation/sched.py b/nmdc_automation/workflow_automation/sched.py index 5d4f6ec6..e0a17871 100644 --- a/nmdc_automation/workflow_automation/sched.py +++ b/nmdc_automation/workflow_automation/sched.py @@ -282,7 +282,7 @@ def cycle(self, dryrun: bool = False, skiplist: set = set(), """ This function does a single cycle of looking for new jobs """ - + logger.info("Starting cycle: polling for new jobs") wfp_nodes = load_workflow_process_nodes(self.db, self.workflows, allowlist) self.get_existing_jobs.cache_clear() @@ -295,6 +295,8 @@ def cycle(self, dryrun: bool = False, skiplist: set = set(), logging.debug(f"Skipping: {wfp_node.id}, workflow disabled.") continue jobs = self.find_new_jobs(wfp_node) + if jobs: + logging.info(f"Found {len(jobs)} new jobs for {wfp_node.id}") for job in jobs: if dryrun: msg = f"new job: informed_by: {job.informed_by} trigger: {job.trigger_id} " diff --git a/tests/test_workflow_process.py b/tests/test_workflow_process.py index 364fd37a..197bc84f 100644 --- a/tests/test_workflow_process.py +++ b/tests/test_workflow_process.py @@ -5,7 +5,8 @@ get_current_workflow_process_nodes, load_workflow_process_nodes, _resolve_relationships, - _map_nodes_to_data_objects + _map_nodes_to_data_objects, + _within_range ) from nmdc_automation.workflow_automation.workflows import load_workflow_configs from tests.fixtures.db_utils import load_fixture, reset_db @@ -225,3 +226,7 @@ def test_get_required_data_objects_by_id(test_db, workflows_config_dir, workflow # check that the expected data object types are present for do_type in exp_do_types: assert do_type in do_types + +def test_within_range(): + assert _within_range('v1.0.8', 'v1.0.8') + assert _within_range('v1.0.8', 'v1.0.9') \ No newline at end of file