From 793016369ac11d4631848997df2e7976f7982d93 Mon Sep 17 00:00:00 2001 From: Casey Jao Date: Fri, 24 May 2024 15:50:19 -0400 Subject: [PATCH] Abstract API entrypoint for sublattice dispatches --- covalent/_dispatcher_plugins/local.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/covalent/_dispatcher_plugins/local.py b/covalent/_dispatcher_plugins/local.py index a53ddb926..a6d7a030b 100644 --- a/covalent/_dispatcher_plugins/local.py +++ b/covalent/_dispatcher_plugins/local.py @@ -50,6 +50,9 @@ dispatch_cache_dir.mkdir(parents=True, exist_ok=True) +API_ENTRYPOINT = os.getenv("COVALENT_DISPATCH_API_ENTRYPOINT", "/api/v2/dispatches") + + def get_redispatch_request_body_v2( dispatch_id: str, staging_dir: str, @@ -577,10 +580,10 @@ def register_manifest( dispatcher_addr = format_server_url() stripped = strip_local_uris(manifest) if push_assets else manifest - endpoint = "/api/v2/dispatches" + endpoint = API_ENTRYPOINT if parent_dispatch_id: - endpoint = f"{endpoint}/{parent_dispatch_id}/subdispatches" + endpoint = f"{API_ENTRYPOINT}/{parent_dispatch_id}/subdispatches" r = APIClient(dispatcher_addr).post(endpoint, data=stripped.model_dump_json()) r.raise_for_status()