Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion trapdata/antenna/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

import requests

from trapdata.antenna.schemas import AntennaJobsListResponse, AntennaTaskResult
from trapdata.antenna.schemas import (
AntennaJobsListResponse,
AntennaTaskResult,
JobDispatchMode,
)
from trapdata.api.utils import get_http_session
from trapdata.common.logs import logger

Expand Down Expand Up @@ -31,6 +35,7 @@ def get_jobs(
"pipeline__slug": pipeline_slug,
"ids_only": 1,
"incomplete_only": 1,
"dispatch_mode": JobDispatchMode.ASYNC_API, # Only fetch async_api jobs
}

resp = session.get(url, params=params, timeout=30)
Expand Down
18 changes: 18 additions & 0 deletions trapdata/antenna/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,21 @@ class AsyncPipelineRegistrationResponse(pydantic.BaseModel):
default=None,
description="ID of the processing service that was created or updated",
)


class JobDispatchMode(str):
"""
How a job dispatches its tasks.

External processing services should only be concerned with
jobs with dispatch_mode=async_api

Other job types will not have any tasks to fetch from the tasks endpoint and will
fail if you try to post results for them.

This mirrors the JobDispatchMode enum in the Antenna server.
"""

INTERNAL = "internal"
SYNC_API = "sync_api"
ASYNC_API = "async_api"