From 4a1ef388f4c1e6b31fb47c2a76d4d2de678edbff Mon Sep 17 00:00:00 2001 From: sankalp Date: Wed, 18 Oct 2023 01:44:26 -0400 Subject: [PATCH] fixing tests --- covalent_dispatcher/_core/runner_modules/jobs.py | 4 ++-- .../_core/dispatcher_db_integration_test.py | 16 ++++++++-------- .../_core/runner_modules/jobs_test.py | 2 +- .../_core/tmp_execution_test.py | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/covalent_dispatcher/_core/runner_modules/jobs.py b/covalent_dispatcher/_core/runner_modules/jobs.py index 402561430..55d79eead 100644 --- a/covalent_dispatcher/_core/runner_modules/jobs.py +++ b/covalent_dispatcher/_core/runner_modules/jobs.py @@ -19,7 +19,7 @@ from covalent._shared_files import logger from covalent._shared_files.util_classes import Status -from covalent_dispatcher._core import data_manager as datamgr +from covalent_dispatcher._core.data_modules import lattice as lattice_query_module from .. import data_manager as datasvc from ..data_modules import job_manager @@ -59,7 +59,7 @@ async def get_version_info(dispatch_id: str, task_id: int): {"python": python_version, "covalent": covalent_version} """ - data = await datamgr.lattice.get(dispatch_id, ["python_version", "covalent_version"]) + data = await lattice_query_module.get(dispatch_id, ["python_version", "covalent_version"]) return { "python": data["python_version"], diff --git a/tests/covalent_dispatcher_tests/_core/dispatcher_db_integration_test.py b/tests/covalent_dispatcher_tests/_core/dispatcher_db_integration_test.py index 1800bc4aa..53444a7b6 100644 --- a/tests/covalent_dispatcher_tests/_core/dispatcher_db_integration_test.py +++ b/tests/covalent_dispatcher_tests/_core/dispatcher_db_integration_test.py @@ -145,7 +145,7 @@ async def mock_get_incoming_edges(dispatch_id, node_id): return result_object.lattice.transport_graph.get_incoming_edges(node_id) mocker.patch( - "covalent_dispatcher._core.data_manager.graph.get_incoming_edges", + "covalent_dispatcher._core.dispatcher.tg_utils.get_incoming_edges", mock_get_incoming_edges, ) @@ -168,7 +168,7 @@ async def mock_get_incoming_edges(dispatch_id, node_id): result_object = get_mock_srvresult(sdkres, test_db) mocker.patch( - "covalent_dispatcher._core.data_manager.graph.get_incoming_edges", + "covalent_dispatcher._core.dispatcher.tg_utils.get_incoming_edges", mock_get_incoming_edges, ) @@ -192,7 +192,7 @@ async def mock_get_incoming_edges(dispatch_id, node_id): tg.set_node_value(2, "output", ct.TransportableObject(2)) mocker.patch( - "covalent_dispatcher._core.data_manager.graph.get_incoming_edges", + "covalent_dispatcher._core.dispatcher.tg_utils.get_incoming_edges", mock_get_incoming_edges, ) @@ -202,7 +202,7 @@ async def mock_get_incoming_edges(dispatch_id, node_id): assert task_inputs["args"] == [0, 2] mocker.patch( - "covalent_dispatcher._core.data_manager.graph.get_incoming_edges", + "covalent_dispatcher._core.dispatcher.tg_utils.get_incoming_edges", mock_get_incoming_edges, ) @@ -212,7 +212,7 @@ async def mock_get_incoming_edges(dispatch_id, node_id): assert task_inputs["args"] == [2, 0] mocker.patch( - "covalent_dispatcher._core.data_manager.graph.get_incoming_edges", + "covalent_dispatcher._core.dispatcher.tg_utils.get_incoming_edges", mock_get_incoming_edges, ) @@ -221,7 +221,7 @@ async def mock_get_incoming_edges(dispatch_id, node_id): ) assert task_inputs["args"] == [2, 0] mocker.patch( - "covalent_dispatcher._core.data_manager.graph.get_incoming_edges", + "covalent_dispatcher._core.dispatcher.tg_utils.get_incoming_edges", mock_get_incoming_edges, ) @@ -253,7 +253,7 @@ async def electron_get(dispatch_id, node_id, keys): return {keys[0]: node_id} mocker.patch( - "covalent_dispatcher._core.data_manager.graph.get_node_successors", + "covalent_dispatcher._core.dispatcher.tg_utils.get_node_successors", get_node_successors, ) @@ -307,7 +307,7 @@ async def get_graph_nodes_links(dispatch_id: str) -> dict: return nx.readwrite.node_link_data(g) mocker.patch( - "covalent_dispatcher._core.data_manager.graph.get_nodes_links", + "covalent_dispatcher._core.dispatcher.tg_utils.get_nodes_links", side_effect=get_graph_nodes_links, ) diff --git a/tests/covalent_dispatcher_tests/_core/runner_modules/jobs_test.py b/tests/covalent_dispatcher_tests/_core/runner_modules/jobs_test.py index 7c8e0d233..12d06443d 100644 --- a/tests/covalent_dispatcher_tests/_core/runner_modules/jobs_test.py +++ b/tests/covalent_dispatcher_tests/_core/runner_modules/jobs_test.py @@ -45,7 +45,7 @@ async def test_get_version_info(mocker): mock_ver_info = {"python_version": "3.10", "covalent_version": "0.220"} mocker.patch( - "covalent_dispatcher._core.runner_modules.jobs.datamgr.lattice.get", + "covalent_dispatcher._core.runner_modules.jobs.lattice_query_module.get", return_value=mock_ver_info, ) assert await jobs.get_version_info(dispatch_id, 0) == {"python": "3.10", "covalent": "0.220"} diff --git a/tests/covalent_dispatcher_tests/_core/tmp_execution_test.py b/tests/covalent_dispatcher_tests/_core/tmp_execution_test.py index 245656fe6..a2bdceef8 100644 --- a/tests/covalent_dispatcher_tests/_core/tmp_execution_test.py +++ b/tests/covalent_dispatcher_tests/_core/tmp_execution_test.py @@ -258,7 +258,7 @@ def workflow(x): json_lattice = workflow.serialize_to_json() dispatch_id = "asdf" lattice = Lattice.deserialize_from_json(json_lattice) - result_object = Result(lattice, lattice.metadata["results_dir"]) + result_object = Result(lattice, dispatch_id) result_object._dispatch_id = dispatch_id result_object._initialize_nodes()