1# generated by datamodel-codegen:
2# filename: http://0.0.0.0:8080/execution/openapi.json
3# version: 0.89.0
4
5# Licensed to the Apache Software Foundation (ASF) under one
6# or more contributor license agreements. See the NOTICE file
7# distributed with this work for additional information
8# regarding copyright ownership. The ASF licenses this file
9# to you under the Apache License, Version 2.0 (the
10# "License"); you may not use this file except in compliance
11# with the License. You may obtain a copy of the License at
12#
13# http://www.apache.org/licenses/LICENSE-2.0
14#
15# Unless required by applicable law or agreed to in writing,
16# software distributed under the License is distributed on an
17# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18# KIND, either express or implied. See the License for the
19# specific language governing permissions and limitations
20# under the License.
21from __future__ import annotations
22
23from datetime import timedelta
24from enum import Enum
25from typing import Annotated, Any, Final, Literal
26from uuid import UUID
27
28from pydantic import AwareDatetime, BaseModel, ConfigDict, Field, JsonValue, RootModel
29from typing_extensions import TypeAliasType
30
31API_VERSION: Final[str] = "2027-02-28"
32
33
34class AssetAliasReferenceAssetEventDagRun(BaseModel):
35 """
36 Schema for AssetAliasModel used in AssetEventDagRunReference.
37 """
38
39 model_config = ConfigDict(
40 extra="forbid",
41 )
42 name: Annotated[str, Field(title="Name")]
43
44
45class AssetProfile(BaseModel):
46 """
47 Profile of an asset-like object.
48
49 Asset will have name, uri defined, with type set to 'Asset'.
50 AssetNameRef will have name defined, type set to 'AssetNameRef'.
51 AssetUriRef will have uri defined, type set to 'AssetUriRef'.
52 AssetAlias will have name defined, type set to 'AssetAlias'.
53
54 Note that 'type' here is distinct from 'asset_type' the user declares on an
55 Asset (or subclass). This field is for distinguishing between different
56 asset-related types (Asset, AssetRef, or AssetAlias).
57 """
58
59 model_config = ConfigDict(
60 extra="forbid",
61 )
62 name: Annotated[str | None, Field(title="Name")] = None
63 uri: Annotated[str | None, Field(title="Uri")] = None
64 type: Annotated[str, Field(title="Type")]
65
66
67class CallbackTerminalState(str, Enum):
68 """
69 Terminal states a callback can transition to from RUNNING.
70 """
71
72 SUCCESS = "success"
73 FAILED = "failed"
74
75
76class CallbackTerminalStatePayload(BaseModel):
77 """
78 Payload for transitioning a callback from RUNNING to a terminal state.
79 """
80
81 model_config = ConfigDict(
82 extra="forbid",
83 )
84 state: CallbackTerminalState
85 output: Annotated[str | None, Field(title="Output")] = None
86
87
88class ConnectionResponse(BaseModel):
89 """
90 Connection schema for responses with fields that are needed for Runtime.
91 """
92
93 conn_id: Annotated[str, Field(title="Conn Id")]
94 conn_type: Annotated[str, Field(title="Conn Type")]
95 host: Annotated[str | None, Field(title="Host")]
96 schema_: Annotated[str | None, Field(alias="schema", title="Schema")]
97 login: Annotated[str | None, Field(title="Login")]
98 password: Annotated[str | None, Field(title="Password")]
99 port: Annotated[int | None, Field(title="Port")]
100 extra: Annotated[str | None, Field(title="Extra")]
101
102
103class ConnectionTestConnectionResponse(BaseModel):
104 """
105 Connection data returned to workers from a test request.
106 """
107
108 conn_id: Annotated[str, Field(title="Conn Id")]
109 conn_type: Annotated[str, Field(title="Conn Type")]
110 host: Annotated[str | None, Field(title="Host")] = None
111 login: Annotated[str | None, Field(title="Login")] = None
112 password: Annotated[str | None, Field(title="Password")] = None
113 schema_: Annotated[str | None, Field(alias="schema", title="Schema")] = None
114 port: Annotated[int | None, Field(title="Port")] = None
115 extra: Annotated[str | None, Field(title="Extra")] = None
116
117
118class ResultMessage(RootModel[str]):
119 root: Annotated[str, Field(max_length=2000, title="Result Message")]
120
121
122class ConnectionTestState(str, Enum):
123 """
124 All possible states of a connection test.
125 """
126
127 PENDING = "pending"
128 QUEUED = "queued"
129 RUNNING = "running"
130 SUCCESS = "success"
131 FAILED = "failed"
132
133
134class Version(RootModel[str]):
135 root: Annotated[str, Field(max_length=200, title="Version")]
136
137
138class DagBundleInventoryBody(BaseModel):
139 """
140 A discovery snapshot with explicit failures, conditional on the previously observed revision.
141 """
142
143 model_config = ConfigDict(
144 extra="forbid",
145 )
146 attempt_id: Annotated[UUID, Field(title="Attempt Id")]
147 dispatch_sequence: Annotated[int, Field(ge=1, le=9007199254740991, title="Dispatch Sequence")]
148 expected_revision: Annotated[UUID | None, Field(title="Expected Revision")]
149 version: Annotated[Version | None, Field(title="Version")] = None
150 files: Annotated[list[str], Field(max_length=100000, title="Files")]
151 failed_sources: Annotated[list[str] | None, Field(max_length=100000, title="Failed Sources")] = None
152
153
154class DagBundleInventoryResponse(BaseModel):
155 """
156 The source revision to attach to imports dispatched from this inventory.
157 """
158
159 model_config = ConfigDict(
160 extra="forbid",
161 )
162 attempt_id: Annotated[UUID, Field(title="Attempt Id")]
163 accepted_at: Annotated[AwareDatetime, Field(title="Accepted At")]
164 revision: Annotated[UUID, Field(title="Revision")]
165
166
167class DagBundleStateResponse(BaseModel):
168 """
169 Server-owned metadata for an authorized bundle.
170 """
171
172 model_config = ConfigDict(
173 extra="forbid",
174 )
175 name: Annotated[str, Field(title="Name")]
176 version: Annotated[str | None, Field(title="Version")]
177 last_refreshed: Annotated[AwareDatetime | None, Field(title="Last Refreshed")]
178 revision: Annotated[UUID | None, Field(title="Revision")]
179 team_name: Annotated[str | None, Field(title="Team Name")]
180
181
182class BundleVersion(RootModel[str]):
183 root: Annotated[str, Field(max_length=200, title="Bundle Version")]
184
185
186DagSourceIndexesAdditionalProperty = TypeAliasType(
187 "DagSourceIndexesAdditionalProperty", Annotated[int, Field(ge=0)]
188)
189
190
191class DagParseResultResponse(BaseModel):
192 """
193 Receipt returned unchanged when the latest accepted publication is replayed.
194 """
195
196 model_config = ConfigDict(
197 extra="forbid",
198 )
199 attempt_id: Annotated[UUID, Field(title="Attempt Id")]
200 accepted_at: Annotated[AwareDatetime, Field(title="Accepted At")]
201
202
203class DagParseTokenBody(BaseModel):
204 """
205 Exchange a Job credential for access on behalf of one file-parsing attempt.
206 """
207
208 model_config = ConfigDict(
209 extra="forbid",
210 )
211 attempt_id: Annotated[UUID, Field(title="Attempt Id")]
212 bundle_name: Annotated[str, Field(max_length=250, min_length=1, title="Bundle Name")]
213 relative_fileloc: Annotated[str, Field(max_length=2000, min_length=1, title="Relative Fileloc")]
214
215
216class DagParseTokenResponse(BaseModel):
217 """
218 Short-lived parsing credential; cannot register, heartbeat, or complete Jobs.
219 """
220
221 model_config = ConfigDict(
222 extra="forbid",
223 )
224 token: Annotated[str, Field(title="Token")]
225 expires_in: Annotated[
226 int, Field(description="Seconds until the token expires.", gt=0, title="Expires In")
227 ]
228
229
230class DagResponse(BaseModel):
231 """
232 Schema for DAG response.
233 """
234
235 dag_id: Annotated[str, Field(title="Dag Id")]
236 is_paused: Annotated[bool, Field(title="Is Paused")]
237 bundle_name: Annotated[str | None, Field(title="Bundle Name")]
238 bundle_version: Annotated[str | None, Field(title="Bundle Version")]
239 relative_fileloc: Annotated[str | None, Field(title="Relative Fileloc")]
240 owners: Annotated[str | None, Field(title="Owners")]
241 tags: Annotated[list[str], Field(title="Tags")]
242 next_dagrun: Annotated[AwareDatetime | None, Field(title="Next Dagrun")]
243
244
245class DagRunAssetReference(BaseModel):
246 """
247 DagRun serializer for asset responses.
248 """
249
250 model_config = ConfigDict(
251 extra="forbid",
252 )
253 run_id: Annotated[str, Field(title="Run Id")]
254 dag_id: Annotated[str, Field(title="Dag Id")]
255 logical_date: Annotated[AwareDatetime | None, Field(title="Logical Date")]
256 start_date: Annotated[AwareDatetime | None, Field(title="Start Date")]
257 end_date: Annotated[AwareDatetime | None, Field(title="End Date")]
258 state: Annotated[str, Field(title="State")]
259 data_interval_start: Annotated[AwareDatetime | None, Field(title="Data Interval Start")]
260 data_interval_end: Annotated[AwareDatetime | None, Field(title="Data Interval End")]
261 partition_key: Annotated[str | None, Field(title="Partition Key")]
262
263
264class Note(RootModel[str]):
265 root: Annotated[str, Field(max_length=1000, title="Note")]
266
267
268class DagRunNoteUpdatePayload(BaseModel):
269 """
270 Schema for updating the DagRun note associated with a task instance.
271 """
272
273 model_config = ConfigDict(
274 extra="forbid",
275 )
276 note: Annotated[Note | None, Field(title="Note")] = None
277
278
279class DagRunState(str, Enum):
280 """
281 All possible states that a DagRun can be in.
282
283 These are "shared" with TaskInstanceState in some parts of the code,
284 so please ensure that their values always match the ones with the
285 same name in TaskInstanceState.
286 """
287
288 QUEUED = "queued"
289 RUNNING = "running"
290 SUCCESS = "success"
291 FAILED = "failed"
292
293
294class DagRunStateResponse(BaseModel):
295 """
296 Schema for DAG Run State response.
297 """
298
299 state: DagRunState
300
301
302class DagRunType(str, Enum):
303 """
304 Class with DagRun types.
305 """
306
307 BACKFILL = "backfill"
308 SCHEDULED = "scheduled"
309 MANUAL = "manual"
310 OPERATOR_TRIGGERED = "operator_triggered"
311 ASSET_TRIGGERED = "asset_triggered"
312 ASSET_MATERIALIZATION = "asset_materialization"
313
314
315class DagWarningType(str, Enum):
316 """
317 Enum for DAG warning types.
318
319 This is the set of allowable values for the ``warning_type`` field
320 in the DagWarning model.
321 """
322
323 ASSET_CONFLICT = "asset conflict"
324 DUPLICATE_DAG_ID = "duplicate dag id"
325 NON_EXISTENT_POOL = "non-existent pool"
326 RUNTIME_VARYING_VALUE = "runtime varying value"
327 TASK_GROUP_CYCLE = "task group cycle"
328
329
330class EmailType(str, Enum):
331 FAILURE = "failure"
332 RETRY = "retry"
333
334
335class HITLUser(BaseModel):
336 """
337 Schema for a Human-in-the-loop users.
338 """
339
340 id: Annotated[str, Field(title="Id")]
341 name: Annotated[str, Field(title="Name")]
342
343
344class HTTPExceptionResponse(BaseModel):
345 """
346 HTTPException Model used for error response.
347 """
348
349 detail: Annotated[str | dict[str, Any], Field(title="Detail")]
350
351
352class InactiveAssetsResponse(BaseModel):
353 """
354 Response for inactive assets.
355 """
356
357 inactive_assets: Annotated[list[AssetProfile] | None, Field(title="Inactive Assets")] = None
358
359
360class IntermediateTIState(str, Enum):
361 """
362 States that a Task Instance can be in that indicate it is not yet in a terminal or running state.
363 """
364
365 SCHEDULED = "scheduled"
366 QUEUED = "queued"
367 RESTARTING = "restarting"
368 UP_FOR_RETRY = "up_for_retry"
369 UP_FOR_RESCHEDULE = "up_for_reschedule"
370 DEFERRED = "deferred"
371 AWAITING_INPUT = "awaiting_input"
372
373
374class Unixname(RootModel[str]):
375 root: Annotated[str, Field(max_length=1000, title="Unixname")]
376
377
378class BundleNames(RootModel[list[str]]):
379 root: Annotated[
380 list[str],
381 Field(
382 description="Bundles the processor parses; defaults to every bundle its token grants.",
383 min_length=1,
384 title="Bundle Names",
385 ),
386 ]
387
388
389class JobRegisterBody(BaseModel):
390 """
391 Request body a Dag processor sends to register the Job of its session.
392 """
393
394 model_config = ConfigDict(
395 extra="forbid",
396 )
397 registration_id: Annotated[
398 UUID,
399 Field(
400 description="Chosen by the processor once per process start. Registering again with the same id while its Job is open returns that Job with a fresh token, which recovers a lost response and renews the token. Once the Job completes or is replaced the id is refused, so a restart chooses a new one.",
401 title="Registration Id",
402 ),
403 ]
404 hostname: Annotated[str, Field(max_length=500, min_length=1, title="Hostname")]
405 unixname: Annotated[Unixname | None, Field(title="Unixname")] = None
406 bundle_names: Annotated[
407 BundleNames | None,
408 Field(
409 description="Bundles the processor parses; defaults to every bundle its token grants.",
410 title="Bundle Names",
411 ),
412 ] = None
413
414
415class JobRegisterResponse(BaseModel):
416 """
417 The registered Job and its management credential.
418 """
419
420 model_config = ConfigDict(
421 extra="forbid",
422 )
423 job_id: Annotated[int, Field(title="Job Id")]
424 token: Annotated[
425 str,
426 Field(
427 description="A ``dag_processor`` token, valid until it expires or the Job ends.", title="Token"
428 ),
429 ]
430 expires_in: Annotated[
431 int, Field(description="Seconds until the token expires.", gt=0, title="Expires In")
432 ]
433
434
435class JobState(str, Enum):
436 """
437 All possible states that a Job can be in.
438 """
439
440 RUNNING = "running"
441 SUCCESS = "success"
442 RESTARTING = "restarting"
443 FAILED = "failed"
444
445
446class LoopContext(BaseModel):
447 """
448 Pinned loop definition and enclosing iteration for a task execution.
449 """
450
451 node_id: Annotated[str, Field(title="Node Id")]
452 index: Annotated[int, Field(ge=1, title="Index")]
453 max_iterations: Annotated[int, Field(gt=0, title="Max Iterations")]
454 terminal_task_id: Annotated[str, Field(title="Terminal Task Id")]
455 terminal_is_mapped: Annotated[bool, Field(title="Terminal Is Mapped")]
456 region_id: Annotated[UUID, Field(title="Region Id")]
457 trajectory: Annotated[int, Field(ge=1, title="Trajectory")]
458 forked_from_region_id: Annotated[UUID | None, Field(title="Forked From Region Id")] = None
459 resumes_from_index: Annotated[int | None, Field(title="Resumes From Index")] = None
460
461
462class LoopDecisionPayload(BaseModel):
463 """
464 A loop gate's evaluation of its ``until`` callable.
465 """
466
467 model_config = ConfigDict(
468 extra="forbid",
469 )
470 stop: Annotated[bool, Field(title="Stop")]
471 reason: Annotated[str | None, Field(title="Reason")] = None
472
473
474class ParseSourceCode(BaseModel):
475 """
476 Source captured by the importer; null explicitly means unavailable.
477 """
478
479 model_config = ConfigDict(
480 extra="forbid",
481 )
482 source_code: Annotated[str | None, Field(title="Source Code")]
483 language: Annotated[str, Field(max_length=64, min_length=1, title="Language")]
484
485
486class WarningType(RootModel[str]):
487 root: Annotated[
488 str, Field(max_length=50, pattern="^[a-z][a-z0-9_]*:[a-z0-9_.\\-]+$", title="Warning Type")
489 ]
490
491
492class ParseWarning(BaseModel):
493 """
494 A warning attached to a Dag returned by this import.
495 """
496
497 model_config = ConfigDict(
498 extra="forbid",
499 )
500 dag_id: Annotated[str, Field(max_length=250, min_length=1, title="Dag Id")]
501 warning_type: Annotated[DagWarningType | WarningType, Field(title="Warning Type")]
502 message: Annotated[str, Field(title="Message")]
503
504
505class PrevSuccessfulDagRunResponse(BaseModel):
506 """
507 Schema for response with previous successful DagRun information for Task Template Context.
508 """
509
510 data_interval_start: Annotated[AwareDatetime | None, Field(title="Data Interval Start")] = None
511 data_interval_end: Annotated[AwareDatetime | None, Field(title="Data Interval End")] = None
512 start_date: Annotated[AwareDatetime | None, Field(title="Start Date")] = None
513 end_date: Annotated[AwareDatetime | None, Field(title="End Date")] = None
514
515
516class PreviousTIResponse(BaseModel):
517 """
518 Schema for response with previous TaskInstance information.
519 """
520
521 task_id: Annotated[str, Field(title="Task Id")]
522 dag_id: Annotated[str, Field(title="Dag Id")]
523 run_id: Annotated[str, Field(title="Run Id")]
524 logical_date: Annotated[AwareDatetime | None, Field(title="Logical Date")] = None
525 start_date: Annotated[AwareDatetime | None, Field(title="Start Date")] = None
526 end_date: Annotated[AwareDatetime | None, Field(title="End Date")] = None
527 state: Annotated[str | None, Field(title="State")] = None
528 try_number: Annotated[int, Field(title="Try Number")]
529 map_index: Annotated[int | None, Field(title="Map Index")] = -1
530 region_id: Annotated[UUID | None, Field(title="Region Id")] = None
531 region_index: Annotated[int | None, Field(title="Region Index")] = None
532 duration: Annotated[float | None, Field(title="Duration")] = None
533
534
535class ProcessorWorkAckBody(BaseModel):
536 """
537 Acknowledge delivery, retaining the claim identity across retries.
538 """
539
540 model_config = ConfigDict(
541 extra="forbid",
542 )
543 claim_id: Annotated[UUID, Field(title="Claim Id")]
544
545
546class ProcessorWorkClaimBody(BaseModel):
547 """
548 A bounded claim whose sequence increases per Job and work kind.
549
550 Retry the same payload until its response arrives before sending a newer sequence for that kind.
551 """
552
553 model_config = ConfigDict(
554 extra="forbid",
555 )
556 claim_id: Annotated[UUID, Field(title="Claim Id")]
557 claim_sequence: Annotated[int, Field(ge=1, le=9007199254740991, title="Claim Sequence")]
558 bundle_names: Annotated[list[str], Field(max_length=1000, min_length=1, title="Bundle Names")]
559 limit: Annotated[int | None, Field(ge=1, le=100, title="Limit")] = 20
560
561
562class TIAwaitingInputStatePayload(BaseModel):
563 """
564 Schema for parking a TaskInstance in an awaiting_input state (Human-in-the-loop, no trigger).
565 """
566
567 model_config = ConfigDict(
568 extra="forbid",
569 )
570 state: Annotated[Literal["awaiting_input"], Field(title="State")] = "awaiting_input"
571 timeout: Annotated[timedelta | None, Field(title="Timeout")] = None
572 next_method: Annotated[str, Field(title="Next Method")]
573 next_kwargs: Annotated[dict[str, JsonValue | None] | None, Field(title="Next Kwargs")] = None
574 rendered_map_index: Annotated[str | None, Field(title="Rendered Map Index")] = None
575
576
577class TIDeferredStatePayload(BaseModel):
578 """
579 Schema for updating TaskInstance to a deferred state.
580 """
581
582 model_config = ConfigDict(
583 extra="forbid",
584 )
585 state: Annotated[Literal["deferred"], Field(title="State")] = "deferred"
586 classpath: Annotated[str, Field(title="Classpath")]
587 trigger_kwargs: Annotated[dict[str, JsonValue | None] | str | None, Field(title="Trigger Kwargs")] = None
588 trigger_timeout: Annotated[timedelta | None, Field(title="Trigger Timeout")] = None
589 queue: Annotated[str | None, Field(title="Queue")] = None
590 next_method: Annotated[str, Field(title="Next Method")]
591 next_kwargs: Annotated[dict[str, JsonValue | None] | None, Field(title="Next Kwargs")] = None
592 rendered_map_index: Annotated[str | None, Field(title="Rendered Map Index")] = None
593
594
595class TIEnterRunningPayload(BaseModel):
596 """
597 Schema for updating TaskInstance to 'RUNNING' state with minimal required fields.
598 """
599
600 model_config = ConfigDict(
601 extra="forbid",
602 )
603 state: Annotated[Literal["running"], Field(title="State")] = "running"
604 hostname: Annotated[str, Field(title="Hostname")]
605 unixname: Annotated[str, Field(title="Unixname")]
606 pid: Annotated[int, Field(title="Pid")]
607 start_date: Annotated[AwareDatetime, Field(title="Start Date")]
608
609
610class TIHeartbeatInfo(BaseModel):
611 """
612 Schema for TaskInstance heartbeat endpoint.
613 """
614
615 model_config = ConfigDict(
616 extra="forbid",
617 )
618 hostname: Annotated[str, Field(title="Hostname")]
619 pid: Annotated[int, Field(title="Pid")]
620
621
622class TIRescheduleStatePayload(BaseModel):
623 """
624 Schema for updating TaskInstance to a up_for_reschedule state.
625 """
626
627 model_config = ConfigDict(
628 extra="forbid",
629 )
630 state: Annotated[Literal["up_for_reschedule"], Field(title="State")] = "up_for_reschedule"
631 reschedule_date: Annotated[AwareDatetime, Field(title="Reschedule Date")]
632 end_date: Annotated[AwareDatetime, Field(title="End Date")]
633
634
635class TIRetryStatePayload(BaseModel):
636 """
637 Schema for updating TaskInstance to up_for_retry.
638 """
639
640 model_config = ConfigDict(
641 extra="forbid",
642 )
643 state: Annotated[Literal["up_for_retry"], Field(title="State")] = "up_for_retry"
644 end_date: Annotated[AwareDatetime, Field(title="End Date")]
645 rendered_map_index: Annotated[str | None, Field(title="Rendered Map Index")] = None
646 retry_delay_seconds: Annotated[float | None, Field(title="Retry Delay Seconds")] = None
647 retry_reason: Annotated[str | None, Field(title="Retry Reason")] = None
648
649
650class TISkippedDownstreamTasksStatePayload(BaseModel):
651 """
652 Schema for updating downstream tasks to a skipped state.
653 """
654
655 model_config = ConfigDict(
656 extra="forbid",
657 )
658 tasks: Annotated[list[str | tuple[str, int]], Field(title="Tasks")]
659
660
661class TISuccessStatePayload(BaseModel):
662 """
663 Schema for updating TaskInstance to success state.
664 """
665
666 model_config = ConfigDict(
667 extra="forbid",
668 )
669 state: Annotated[Literal["success"], Field(title="State")] = "success"
670 end_date: Annotated[AwareDatetime, Field(title="End Date")]
671 task_outlets: Annotated[list[AssetProfile] | None, Field(title="Task Outlets")] = None
672 outlet_events: Annotated[list[dict[str, Any]] | None, Field(title="Outlet Events")] = None
673 rendered_map_index: Annotated[str | None, Field(title="Rendered Map Index")] = None
674 loop_decision: LoopDecisionPayload | None = None
675
676
677class TITargetStatePayload(BaseModel):
678 """
679 Schema for updating TaskInstance to a target state, excluding terminal and running states.
680 """
681
682 model_config = ConfigDict(
683 extra="forbid",
684 )
685 state: IntermediateTIState
686
687
688class TaskBreadcrumbsResponse(BaseModel):
689 """
690 Response for task breadcrumbs.
691 """
692
693 breadcrumbs: Annotated[list[dict[str, Any]], Field(title="Breadcrumbs")]
694
695
696class TaskInstance(BaseModel):
697 """
698 Schema for TaskInstance model with minimal required fields needed for Runtime.
699 """
700
701 id: Annotated[UUID, Field(title="Id")]
702 task_id: Annotated[str, Field(title="Task Id")]
703 dag_id: Annotated[str, Field(title="Dag Id")]
704 run_id: Annotated[str, Field(title="Run Id")]
705 try_number: Annotated[int, Field(title="Try Number")]
706 dag_version_id: Annotated[UUID, Field(title="Dag Version Id")]
707 map_index: Annotated[int | None, Field(title="Map Index")] = -1
708 region_id: Annotated[UUID | None, Field(title="Region Id")] = None
709 region_index: Annotated[int | None, Field(title="Region Index")] = None
710 hostname: Annotated[str | None, Field(title="Hostname")] = None
711 context_carrier: Annotated[dict[str, Any] | None, Field(title="Context Carrier")] = None
712 queue: Annotated[str | None, Field(title="Queue")] = "default"
713
714
715class TaskInstanceState(str, Enum):
716 """
717 All possible states that a Task Instance can be in.
718
719 Note that None is also allowed, so always use this in a type hint with Optional.
720 """
721
722 REMOVED = "removed"
723 SCHEDULED = "scheduled"
724 QUEUED = "queued"
725 RUNNING = "running"
726 SUCCESS = "success"
727 RESTARTING = "restarting"
728 FAILED = "failed"
729 UP_FOR_RETRY = "up_for_retry"
730 UP_FOR_RESCHEDULE = "up_for_reschedule"
731 UPSTREAM_FAILED = "upstream_failed"
732 SKIPPED = "skipped"
733 DEFERRED = "deferred"
734 AWAITING_INPUT = "awaiting_input"
735
736
737class TaskStateStorePutBody(BaseModel):
738 """
739 Request body for setting a task state store value.
740 """
741
742 model_config = ConfigDict(
743 extra="forbid",
744 )
745 value: JsonValue | None
746 expires_at: Annotated[AwareDatetime | None, Field(title="Expires At")] = None
747
748
749class TaskStateStoreResponse(BaseModel):
750 """
751 Task state store value returned to a worker.
752 """
753
754 model_config = ConfigDict(
755 extra="forbid",
756 )
757 value: JsonValue | None
758
759
760class TaskStatesResponse(BaseModel):
761 """
762 Response for task states with run_id, task and state.
763 """
764
765 task_states: Annotated[dict[str, Any], Field(title="Task States")]
766
767
768class TerminalJobState(str, Enum):
769 """
770 States a Job can finish in.
771 """
772
773 SUCCESS = "success"
774 FAILED = "failed"
775
776
777class TerminalStateNonSuccess(str, Enum):
778 """
779 TaskInstance states that can be reported without extra information.
780 """
781
782 FAILED = "failed"
783 SKIPPED = "skipped"
784 REMOVED = "removed"
785 UPSTREAM_FAILED = "upstream_failed"
786 SERVER_TERMINATED = "server_terminated"
787
788
789class TriggerDAGRunPayload(BaseModel):
790 """
791 Schema for Trigger DAG Run API request.
792 """
793
794 model_config = ConfigDict(
795 extra="forbid",
796 )
797 logical_date: Annotated[AwareDatetime | None, Field(title="Logical Date")] = None
798 run_after: Annotated[AwareDatetime | None, Field(title="Run After")] = None
799 conf: Annotated[dict[str, Any] | None, Field(title="Conf")] = None
800 reset_dag_run: Annotated[bool | None, Field(title="Reset Dag Run")] = False
801 partition_key: Annotated[str | None, Field(title="Partition Key")] = None
802 note: Annotated[str | None, Field(title="Note")] = None
803
804
805class UpdateHITLDetailPayload(BaseModel):
806 """
807 Schema for writing the response part of a Human-in-the-loop detail for a specific task instance.
808 """
809
810 ti_id: Annotated[UUID, Field(title="Ti Id")]
811 chosen_options: Annotated[list[str], Field(min_length=1, title="Chosen Options")]
812 params_input: Annotated[dict[str, Any] | None, Field(title="Params Input")] = None
813
814
815class ValidationError(BaseModel):
816 loc: Annotated[list[str | int], Field(title="Location")]
817 msg: Annotated[str, Field(title="Message")]
818 type: Annotated[str, Field(title="Error Type")]
819 input: Annotated[Any | None, Field(title="Input")] = None
820 ctx: Annotated[dict[str, Any] | None, Field(title="Context")] = None
821
822
823class VariableKeysResponse(BaseModel):
824 """
825 Variable keys schema for list responses.
826 """
827
828 model_config = ConfigDict(
829 extra="forbid",
830 )
831 keys: Annotated[list[str], Field(title="Keys")]
832 total_entries: Annotated[int, Field(title="Total Entries")]
833
834
835class VariablePostBody(BaseModel):
836 """
837 Request body schema for creating variables.
838 """
839
840 model_config = ConfigDict(
841 extra="forbid",
842 )
843 val: Annotated[str, Field(title="Val")]
844 description: Annotated[str | None, Field(title="Description")] = None
845
846
847class VariableResponse(BaseModel):
848 """
849 Variable schema for responses with fields that are needed for Runtime.
850 """
851
852 model_config = ConfigDict(
853 extra="forbid",
854 )
855 key: Annotated[str, Field(title="Key")]
856 value: Annotated[str, Field(title="Value")]
857
858
859class XComResponse(BaseModel):
860 """
861 XCom schema for responses with fields that are needed for Runtime.
862 """
863
864 key: Annotated[str, Field(title="Key")]
865 value: JsonValue | None
866
867
868class XComSequenceIndexResponse(RootModel[JsonValue | None]):
869 root: Annotated[
870 JsonValue | None,
871 Field(
872 description="XCom schema with minimal structure for index-based access.",
873 title="XComSequenceIndexResponse",
874 ),
875 ]
876
877
878class XComSequenceSliceResponse(RootModel[list[JsonValue | None]]):
879 """
880 XCom schema with minimal structure for slice-based access.
881 """
882
883 root: Annotated[
884 list[JsonValue | None],
885 Field(
886 description="XCom schema with minimal structure for slice-based access.",
887 title="XComSequenceSliceResponse",
888 ),
889 ]
890
891
892class BundleInfo(BaseModel):
893 """
894 Schema for telling task which bundle to run with.
895 """
896
897 name: Annotated[str, Field(title="Name")]
898 version: Annotated[str | None, Field(title="Version")] = None
899 version_data: Annotated[dict[str, Any] | None, Field(title="Version Data")] = None
900
901
902class TerminalTIState(str, Enum):
903 SUCCESS = "success"
904 FAILED = "failed"
905 SKIPPED = "skipped"
906 UPSTREAM_FAILED = "upstream_failed"
907 REMOVED = "removed"
908
909
910class WeightRule(str, Enum):
911 DOWNSTREAM = "downstream"
912 UPSTREAM = "upstream"
913 ABSOLUTE = "absolute"
914
915
916class TriggerRule(str, Enum):
917 ALL_SUCCESS = "all_success"
918 ALL_FAILED = "all_failed"
919 ALL_DONE = "all_done"
920 ALL_DONE_MIN_ONE_SUCCESS = "all_done_min_one_success"
921 ALL_DONE_SETUP_SUCCESS = "all_done_setup_success"
922 ONE_SUCCESS = "one_success"
923 ONE_FAILED = "one_failed"
924 ONE_DONE = "one_done"
925 NONE_FAILED = "none_failed"
926 NONE_SKIPPED = "none_skipped"
927 ALWAYS = "always"
928 NONE_FAILED_MIN_ONE_SUCCESS = "none_failed_min_one_success"
929 ALL_SKIPPED = "all_skipped"
930
931
932class DagAttributeTypes(str, Enum):
933 OP = "operator"
934 TASK_GROUP = "taskgroup"
935
936
937class ArgValueSchema(RootModel[dict[str, JsonValue | None]]):
938 root: dict[str, JsonValue | None]
939
940
941class AssetReferenceAssetEventDagRun(BaseModel):
942 """
943 Schema for AssetModel used in AssetEventDagRunReference.
944 """
945
946 model_config = ConfigDict(
947 extra="forbid",
948 )
949 name: Annotated[str, Field(title="Name")]
950 uri: Annotated[str, Field(title="Uri")]
951 extra: Annotated[dict[str, JsonValue | None], Field(title="Extra")]
952
953
954class AssetResponse(BaseModel):
955 """
956 Asset schema for responses with fields that are needed for Runtime.
957 """
958
959 name: Annotated[str, Field(title="Name")]
960 uri: Annotated[str, Field(title="Uri")]
961 group: Annotated[str, Field(title="Group")]
962 extra: Annotated[dict[str, JsonValue | None] | None, Field(title="Extra")] = None
963
964
965class AssetStateStorePutBody(BaseModel):
966 """
967 Request body for setting an asset state store value.
968 """
969
970 model_config = ConfigDict(
971 extra="forbid",
972 )
973 value: JsonValue | None
974
975
976class AssetStateStoreResponse(BaseModel):
977 """
978 Asset state store value returned to a worker.
979 """
980
981 model_config = ConfigDict(
982 extra="forbid",
983 )
984 value: JsonValue | None
985
986
987class ConnectionTestResultBody(BaseModel):
988 """
989 Result a worker reports back for a connection test.
990 """
991
992 model_config = ConfigDict(
993 extra="forbid",
994 )
995 state: ConnectionTestState
996 result_message: Annotated[ResultMessage | None, Field(title="Result Message")] = None
997
998
999class DagParseResultBody(BaseModel):
1000 """
1001 One completed file or container import, including an empty result.
1002 """
1003
1004 model_config = ConfigDict(
1005 extra="forbid",
1006 )
1007 attempt_id: Annotated[UUID, Field(title="Attempt Id")]
1008 bundle_name: Annotated[str, Field(max_length=250, min_length=1, title="Bundle Name")]
1009 relative_fileloc: Annotated[str, Field(max_length=2000, min_length=1, title="Relative Fileloc")]
1010 dispatch_sequence: Annotated[int, Field(ge=1, le=9007199254740991, title="Dispatch Sequence")]
1011 bundle_revision: Annotated[UUID | None, Field(title="Bundle Revision")] = None
1012 bundle_version: Annotated[BundleVersion | None, Field(title="Bundle Version")] = None
1013 version_data: Annotated[dict[str, Any] | None, Field(title="Version Data")] = None
1014 parse_duration: Annotated[float, Field(ge=0.0, title="Parse Duration")]
1015 serialized_dags: Annotated[list[dict[str, Any]], Field(title="Serialized Dags")]
1016 import_errors: Annotated[dict[str, str] | None, Field(title="Import Errors")] = None
1017 warnings: Annotated[list[ParseWarning] | None, Field(title="Warnings")] = None
1018 parsed_definitions: Annotated[list[str] | None, Field(title="Parsed Definitions")] = None
1019 result_unavailable: Annotated[
1020 bool | None,
1021 Field(
1022 description="The processor has no result for the file: its parse did not finish, or the API server refused the result. The import error says why, and the file's Dags go stale only once they outlast stale_dag_threshold.",
1023 title="Result Unavailable",
1024 ),
1025 ] = False
1026 source_codes: Annotated[
1027 list[ParseSourceCode],
1028 Field(
1029 description="Source text and language pairs, deduplicated by the processor.", title="Source Codes"
1030 ),
1031 ]
1032 dag_source_indexes: Annotated[
1033 dict[str, DagSourceIndexesAdditionalProperty],
1034 Field(
1035 description="Index in source_codes for each serialized Dag, including unavailable source.",
1036 title="Dag Source Indexes",
1037 ),
1038 ]
1039
1040
1041class HITLDetailRequest(BaseModel):
1042 """
1043 Schema for the request part of a Human-in-the-loop detail for a specific task instance.
1044 """
1045
1046 ti_id: Annotated[UUID, Field(title="Ti Id")]
1047 options: Annotated[list[str], Field(min_length=1, title="Options")]
1048 subject: Annotated[str, Field(title="Subject")]
1049 body: Annotated[str | None, Field(title="Body")] = None
1050 defaults: Annotated[list[str] | None, Field(title="Defaults")] = None
1051 multiple: Annotated[bool | None, Field(title="Multiple")] = False
1052 params: Annotated[dict[str, Any] | None, Field(title="Params")] = None
1053 assigned_users: Annotated[list[HITLUser] | None, Field(title="Assigned Users")] = None
1054
1055
1056class HITLDetailResponse(BaseModel):
1057 """
1058 Schema for the response part of a Human-in-the-loop detail for a specific task instance.
1059 """
1060
1061 response_received: Annotated[bool, Field(title="Response Received")]
1062 responded_by_user: HITLUser | None = None
1063 responded_at: Annotated[AwareDatetime | None, Field(title="Responded At")]
1064 chosen_options: Annotated[list[str] | None, Field(title="Chosen Options")]
1065 params_input: Annotated[dict[str, Any] | None, Field(title="Params Input")] = None
1066
1067
1068class HTTPValidationError(BaseModel):
1069 detail: Annotated[list[ValidationError] | None, Field(title="Detail")] = None
1070
1071
1072class JobCompleteBody(BaseModel):
1073 """
1074 Final state of the Job.
1075 """
1076
1077 model_config = ConfigDict(
1078 extra="forbid",
1079 )
1080 state: TerminalJobState
1081
1082
1083class JobHeartbeatResponse(BaseModel):
1084 """
1085 Current state of the Job; ``restarting`` asks the processor to stop.
1086 """
1087
1088 model_config = ConfigDict(
1089 extra="forbid",
1090 )
1091 state: JobState
1092
1093
1094class LiteralArgBinding(BaseModel):
1095 """
1096 One positional stub-task argument carrying an inline literal from the Dag file.
1097 """
1098
1099 name: Annotated[str, Field(title="Name")]
1100 value_schema: ArgValueSchema | None = None
1101 kind: Annotated[Literal["literal"], Field(title="Kind")]
1102 value: JsonValue | None = None
1103 from_default: Annotated[bool | None, Field(title="From Default")] = False
1104
1105
1106class TITerminalStatePayload(BaseModel):
1107 """
1108 Report a terminal outcome other than SUCCESS, or acknowledge server-requested termination.
1109 """
1110
1111 model_config = ConfigDict(
1112 extra="forbid",
1113 )
1114 state: TerminalStateNonSuccess
1115 end_date: Annotated[AwareDatetime, Field(title="End Date")]
1116 rendered_map_index: Annotated[str | None, Field(title="Rendered Map Index")] = None
1117 retry_reason: Annotated[str | None, Field(title="Retry Reason")] = None
1118 hostname: Annotated[str | None, Field(title="Hostname")] = None
1119 pid: Annotated[int | None, Field(title="Pid")] = None
1120 loop_decision: LoopDecisionPayload | None = None
1121
1122
1123class XComArgBinding(BaseModel):
1124 """
1125 One positional stub-task argument pulled from an upstream task's XCom.
1126 """
1127
1128 name: Annotated[str, Field(title="Name")]
1129 value_schema: ArgValueSchema | None = None
1130 kind: Annotated[Literal["xcom"], Field(title="Kind")]
1131 task_id: Annotated[str, Field(title="Task Id")]
1132
1133
1134class AssetEventDagRunReference(BaseModel):
1135 """
1136 Schema for AssetEvent model used in DagRun.
1137 """
1138
1139 model_config = ConfigDict(
1140 extra="forbid",
1141 )
1142 asset: AssetReferenceAssetEventDagRun
1143 extra: Annotated[dict[str, JsonValue | None], Field(title="Extra")]
1144 source_task_id: Annotated[str | None, Field(title="Source Task Id")]
1145 source_dag_id: Annotated[str | None, Field(title="Source Dag Id")]
1146 source_run_id: Annotated[str | None, Field(title="Source Run Id")]
1147 source_map_index: Annotated[int | None, Field(title="Source Map Index")]
1148 source_aliases: Annotated[list[AssetAliasReferenceAssetEventDagRun], Field(title="Source Aliases")]
1149 timestamp: Annotated[AwareDatetime, Field(title="Timestamp")]
1150 partition_key: Annotated[str | None, Field(title="Partition Key")] = None
1151
1152
1153class AssetEventResponse(BaseModel):
1154 """
1155 Asset event schema with fields that are needed for Runtime.
1156 """
1157
1158 id: Annotated[int, Field(title="Id")]
1159 timestamp: Annotated[AwareDatetime, Field(title="Timestamp")]
1160 extra: Annotated[dict[str, JsonValue | None] | None, Field(title="Extra")] = None
1161 asset: AssetResponse
1162 created_dagruns: Annotated[list[DagRunAssetReference], Field(title="Created Dagruns")]
1163 source_task_id: Annotated[str | None, Field(title="Source Task Id")] = None
1164 source_dag_id: Annotated[str | None, Field(title="Source Dag Id")] = None
1165 source_run_id: Annotated[str | None, Field(title="Source Run Id")] = None
1166 source_map_index: Annotated[int | None, Field(title="Source Map Index")] = None
1167 partition_key: Annotated[str | None, Field(title="Partition Key")] = None
1168
1169
1170class AssetEventsResponse(BaseModel):
1171 """
1172 Collection of AssetEventResponse.
1173 """
1174
1175 asset_events: Annotated[list[AssetEventResponse], Field(title="Asset Events")]
1176
1177
1178class DagRun(BaseModel):
1179 """
1180 Schema for DagRun model with minimal required fields needed for Runtime.
1181 """
1182
1183 model_config = ConfigDict(
1184 extra="forbid",
1185 )
1186 dag_id: Annotated[str, Field(title="Dag Id")]
1187 run_id: Annotated[str, Field(title="Run Id")]
1188 logical_date: Annotated[AwareDatetime | None, Field(title="Logical Date")]
1189 data_interval_start: Annotated[AwareDatetime | None, Field(title="Data Interval Start")]
1190 data_interval_end: Annotated[AwareDatetime | None, Field(title="Data Interval End")]
1191 run_after: Annotated[AwareDatetime, Field(title="Run After")]
1192 start_date: Annotated[AwareDatetime | None, Field(title="Start Date")]
1193 end_date: Annotated[AwareDatetime | None, Field(title="End Date")]
1194 clear_number: Annotated[int | None, Field(title="Clear Number")] = 0
1195 run_type: DagRunType
1196 state: DagRunState
1197 conf: Annotated[dict[str, Any] | None, Field(title="Conf")] = None
1198 triggering_user_name: Annotated[str | None, Field(title="Triggering User Name")] = None
1199 consumed_asset_events: Annotated[list[AssetEventDagRunReference], Field(title="Consumed Asset Events")]
1200 partition_key: Annotated[str | None, Field(title="Partition Key")]
1201 partition_date: Annotated[AwareDatetime | None, Field(title="Partition Date")] = None
1202 note: Annotated[str | None, Field(title="Note")] = None
1203 team_name: Annotated[str | None, Field(title="Team Name")] = None
1204
1205
1206class DagRunContext(BaseModel):
1207 """
1208 Class to pass context info from the server to build a Execution context object.
1209 """
1210
1211 dag_run: DagRun | None = None
1212 last_ti: TaskInstance | None = None
1213
1214
1215class TaskArgBinding(RootModel[XComArgBinding | LiteralArgBinding]):
1216 root: Annotated[XComArgBinding | LiteralArgBinding, Field(discriminator="kind", title="TaskArgBinding")]
1217
1218
1219class DagCallbackRequest(BaseModel):
1220 """
1221 A Class with information about the success/failure DAG callback to be executed.
1222 """
1223
1224 filepath: Annotated[str, Field(title="Filepath")]
1225 bundle_name: Annotated[str, Field(title="Bundle Name")]
1226 bundle_version: Annotated[str | None, Field(title="Bundle Version")]
1227 version_data: Annotated[dict[str, Any] | None, Field(title="Version Data")] = None
1228 msg: Annotated[str | None, Field(title="Msg")] = None
1229 dag_id: Annotated[str, Field(title="Dag Id")]
1230 run_id: Annotated[str, Field(title="Run Id")]
1231 context_from_server: DagRunContext | None = None
1232 is_failure_callback: Annotated[bool | None, Field(title="Is Failure Callback")] = True
1233 type: Annotated[Literal["DagCallbackRequest"] | None, Field(title="Type")] = "DagCallbackRequest"
1234
1235
1236class TIRunContext(BaseModel):
1237 """
1238 Response schema for TaskInstance run context.
1239 """
1240
1241 dag_run: DagRun
1242 loop: LoopContext | None = None
1243 expanded_ti_count: Annotated[int | None, Field(title="Expanded Ti Count")] = None
1244 task_reschedule_count: Annotated[int | None, Field(title="Task Reschedule Count")] = 0
1245 first_task_reschedule_start_date: Annotated[
1246 AwareDatetime | None, Field(title="First Task Reschedule Start Date")
1247 ] = None
1248 max_tries: Annotated[int, Field(title="Max Tries")]
1249 variables: Annotated[list[VariableResponse] | None, Field(title="Variables")] = None
1250 connections: Annotated[list[ConnectionResponse] | None, Field(title="Connections")] = None
1251 next_method: Annotated[str | None, Field(title="Next Method")] = None
1252 next_kwargs: Annotated[dict[str, Any] | str | None, Field(title="Next Kwargs")] = None
1253 xcom_keys_to_clear: Annotated[list[str] | None, Field(title="Xcom Keys To Clear")] = None
1254 should_retry: Annotated[bool | None, Field(title="Should Retry")] = False
1255 start_date: Annotated[AwareDatetime | None, Field(title="Start Date")] = None
1256 arg_bindings: Annotated[list[TaskArgBinding] | None, Field(title="Arg Bindings")] = None
1257 execution_timeout: Annotated[
1258 float | None,
1259 Field(
1260 description="The execution_timeout in seconds set on a task a language SDK runs, from its serialized Dag. Unset when the task sets none. Zero means no timeout and a negative value has already elapsed, as for a Python task. A Python task runs its own timer in the task runner instead, and gets no value here.",
1261 title="Execution Timeout",
1262 ),
1263 ] = None
1264 multi_team: Annotated[bool | None, Field(title="Multi Team")] = False
1265
1266
1267class TaskCallbackRequest(BaseModel):
1268 """
1269 Task callback status information.
1270
1271 A Class with information about the success/failure TI callback to be executed. Currently, only failure
1272 callbacks when tasks are externally killed or experience heartbeat timeouts are run via DagFileProcessorProcess.
1273 """
1274
1275 filepath: Annotated[str, Field(title="Filepath")]
1276 bundle_name: Annotated[str, Field(title="Bundle Name")]
1277 bundle_version: Annotated[str | None, Field(title="Bundle Version")]
1278 version_data: Annotated[dict[str, Any] | None, Field(title="Version Data")] = None
1279 msg: Annotated[str | None, Field(title="Msg")] = None
1280 ti: TaskInstance
1281 task_callback_type: TaskInstanceState | None = None
1282 context_from_server: TIRunContext | None = None
1283 type: Annotated[Literal["TaskCallbackRequest"] | None, Field(title="Type")] = "TaskCallbackRequest"
1284
1285
1286class EmailRequest(BaseModel):
1287 """
1288 Email notification request for task failures/retries.
1289 """
1290
1291 filepath: Annotated[str, Field(title="Filepath")]
1292 bundle_name: Annotated[str, Field(title="Bundle Name")]
1293 bundle_version: Annotated[str | None, Field(title="Bundle Version")]
1294 version_data: Annotated[dict[str, Any] | None, Field(title="Version Data")] = None
1295 msg: Annotated[str | None, Field(title="Msg")] = None
1296 ti: TaskInstance
1297 email_type: Annotated[EmailType | None, Field(title="Email Type")] = EmailType.FAILURE
1298 context_from_server: TIRunContext
1299 type: Annotated[Literal["EmailRequest"] | None, Field(title="Type")] = "EmailRequest"
1300
1301
1302class ProcessorWorkItem(BaseModel):
1303 """
1304 A claimed callback or priority parse request.
1305 """
1306
1307 model_config = ConfigDict(
1308 extra="forbid",
1309 )
1310 id: Annotated[str, Field(title="Id")]
1311 claim_id: Annotated[UUID, Field(title="Claim Id")]
1312 bundle_name: Annotated[str, Field(title="Bundle Name")]
1313 relative_fileloc: Annotated[str, Field(title="Relative Fileloc")]
1314 callback: Annotated[
1315 DagCallbackRequest | TaskCallbackRequest | EmailRequest | None, Field(title="Callback")
1316 ] = None