Skip to content

Commit

Permalink
Abstract API entrypoint for sublattice dispatches
Browse files Browse the repository at this point in the history
  • Loading branch information
cjao committed May 24, 2024
1 parent 7b9eff4 commit 7930163
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions covalent/_dispatcher_plugins/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 7930163

Please sign in to comment.