Repository navigation
ts-sdk: support for logicalDate and runAfter in triggerDagRun - #74543
Davda-James wants to merge 3 commits into
Conversation
… python and go sdk
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
|
Non-blocking: |
done @shivaam |
| To trigger another Dag with a specific logical date and earliest start time: | ||
|
|
||
| ```ts | ||
| import { triggerDagRun } from "apache-airflow-ts-sdk"; |
There was a problem hiding this comment.
This import should be @apache-airflow/ts-sdk, the package name in package.json
|
|
||
| function checkDate(name: string, value: unknown, allowNull = false): void { | ||
| if (value === undefined || (allowNull && value === null)) return; | ||
| if (!(value instanceof Date) || Number.isNaN(value.getTime())) { |
There was a problem hiding this comment.
Could we also reject years outside 1 to 9999 as Go checkTime does, since pythonIsoformat assumes four digits
| const runAfter = trigger.runAfter?.toISOString(); | ||
| const runId = | ||
| trigger.runId ?? | ||
| `manual__${pythonIsoformat(runAfter ? trigger.runAfter! : (logicalDate ?? new Date()))}` + |
There was a problem hiding this comment.
nit: trigger.runAfter ?? logicalDate ?? new Date() gives the same date without the non-null assertion
|
Is there a real use case for logical date? Python only supports it for compatibility, but Airflow 3 changed a lot that using a logical date value in a non-scheduled run does not generally make sense in the first place. Therefore, passing this value to the triggered run is arguably against best practice. I would argue this should not be supported. Run-after should be fine since it’s reasonable to want to hold off the actual run for a little while in practice. |
ts-sdk now supports both logicalDate and runAfter as like python and go sdk (74417)
relevant doc and existing test for it updated and new tests with variation of possible cases of logicalDate and runAfter is added.
Closes Issue : #74414