kaxil commented on code in PR #44433:
URL: https://github.com/apache/airflow/pull/44433#discussion_r1862844613
##########
providers/src/airflow/providers/edge/worker_api/datamodels.py:
##########
@@ -53,19 +55,56 @@ class JsonRpcRequest(JsonRpcRequestBase):
)
-class WorkerStateBody(BaseModel):
+class EdgeJobBase(BaseModel):
+ """Basic attributes of a job on the edge worker."""
+
+ dag_id: str = Field(title="Dag ID", description="Identifier of the DAG to
which the task belongs.")
+ task_id: str = Field(title="Task ID", description="Task name in the DAG.")
+ run_id: str = Field(title="Run ID", description="Run ID of the DAG
execution.")
+ map_index: int = Field(
+ title="Map Index",
+ description="For dynamically mapped tasks the mapping number, -1 if
the task is not mapped.",
+ )
+ try_number: int = Field(title="Try Number", description="The number of
attempt to execute this task.")
+
+ @property
+ def key(self) -> TaskInstanceKey:
+ return TaskInstanceKey(self.dag_id, self.task_id, self.run_id,
self.try_number, self.map_index)
+
+
+class EdgeJobFetched(EdgeJobBase):
+ """Job that is to be executed on the edge worker."""
+
+ command: list[str] = Field(title="Command", description="Command line to
use to execute the job.")
+ concurrency_slots: int = Field(description="Number of concurrency slots
the job requires.")
+
+
+class WorkerQueuesBase(BaseModel):
+ """Queues that a worker supports to run jobs on."""
+
+ queues: Optional[List[str]] = Field( # noqa: UP006, UP007 - prevent
pytest failing in back-compat
Review Comment:
Providers are now Py 3.9+ , so we can make this `list[str] | None`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]