Skip to content

Fix task config defaults for language SDKs - #75267

Open
methatp0 wants to merge 2 commits into
apache:mainfrom
methatp0:fix/lang-sdk-task-config-defaults
Open

methatp0 wants to merge 2 commits into
apache:mainfrom
methatp0:fix/lang-sdk-task-config-defaults

Conversation

@methatp0

@methatp0 methatp0 commented Oct 21, 2026 •

Copy link
Copy Markdown

Preserve explicitly configured task fields that match schema defaults in the language SDK serializers.

Populate missing task defaults from Airflow configuration without overriding values already supplied by the SDK. Add regression tests and update serialization conformance checks and the SDK parsing ADR.

Closes: #74094


Was generative AI tooling used to co-author this PR?

  • Yes, AI tools were used to help write this PR, following the guidelines.

@boring-cyborg

boring-cyborg Bot commented Oct 21, 2026

Copy link
Copy Markdown

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
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example Dag that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@jason810496 jason810496 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, the overall direction is correct but there're some places to refine.

Comment thread go-sdk/airflow/serialize.go Resolved
Comment thread go-sdk/airflow/serialize.go Resolved
Comment thread go-sdk/airflow/serialize.go Resolved
Comment thread go-sdk/airflow/serialize.go Resolved
Comment thread ts-sdk/src/coordinator/serde.ts Resolved
@methatp0
methatp0 force-pushed the fix/lang-sdk-task-config-defaults branch from c2440f9 to 3d858bf Compare October 23, 2026 10:06
@methatp0

Copy link
Copy Markdown
Author

Thanks for the detailed review and helpful suggestions! I've refined the defaults handling and added regression coverage for configured and explicitly set values. Could a maintainer approve the pending CI runs so I can verify the changes?

Comment thread go-sdk/airflow/serialize.go Resolved
Comment thread go-sdk/airflow/serialize.go Resolved
@github-actions

Copy link
Copy Markdown
Contributor

This pull request changes CI files. It changes files that CI uses:

  • scripts/ci/lang_sdk_serialization/compare.py

They do not decide which CI jobs run or on which runners, so its workflow runs are not held for this. A maintainer reviewing the pull request will check the CI change together with the rest of it.


This comment was posted automatically by the fork CI monitor from templates drafted with an AI-assisted tool, so it may contain mistakes. An Apache Airflow maintainer, a real person, will review the pull request once its fork CI is green. Why the first pass is automated.

@jason810496 jason810496 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for picking this up! I checked each point below on this PR rebased onto main, which includes #76359.

A rule that may help: fill a default where it is first read. The scheduler and API server read most fields before any worker runs, so the Dag processor fills them. Only the worker reads execution_timeout, so it stays unset and the worker fills it.

Field Config Read by Filled by
retries [core] default_task_retries Scheduler, sets ti.max_tries Dag processor
retry_delay [core] default_task_retry_delay Scheduler, next_retry_datetime() Dag processor
queue [operators] default_queue Scheduler sets ti.queue, executor routes on it Dag processor
weight_rule [core] default_task_weight_rule Scheduler, sets ti.priority_weight Dag processor
owner [operators] default_owner Dag processor (DagModel.owners), UI Dag processor
email_on_failure, email_on_retry [email] default_email_on_* Scheduler and Dag processor callbacks, only when email is set Dag processor (no effect for SDK tasks yet)
max_active_tasks, max_active_runs, max_consecutive_failed_dag_runs, catchup, disable_bundle_versioning See fill_config_defaults Scheduler, API server Dag processor (already on main)
execution_timeout [core] default_task_execution_timeout Supervisor on the worker (#76359) Worker
deferrable default [operators] default_deferrable SDK runtime Worker (coordinator env, already on main)

Python Dags split the same way. The processor's config fixes the scheduler fields, and the worker's re-parse sets the timeout.

- Do not fill execution_timeout from the Dag processor's config; the worker
  applies [core] default_task_execution_timeout since apache#76359.
- Skip writing an empty client_defaults table, and leave a malformed one to
  validate_serialized_dag.
- Make Go TaskSpec Retries and ExecutionTimeout pointers so an explicit 0 is
  written.
- Parametrize the task default tests over every config-backed field.
- Stop generating Field.defaultJson in the Java SDK; nothing reads it.
@methatp0
methatp0 force-pushed the fix/lang-sdk-task-config-defaults branch from 8793b56 to eb1320f Compare December 1, 2026 10:13
@methatp0

methatp0 commented Dec 1, 2026

Copy link
Copy Markdown
Author

Rebased onto main (with #76359) and addressed all six points in eb1320f:

  • execution_timeout is no longer filled by the Dag processor, so the worker's [core] default_task_execution_timeout applies. Test replaced with your version.
  • No empty client_defaults table is written, and a malformed one is left to validate_serialized_dag (new test for null and {"tasks": null}).
  • The task default test is parametrized over every config-backed field.
  • ADR updated.
  • Go Retries and ExecutionTimeout are pointers now; TestSerializePreservesExplicitTaskFieldsAtTheirSchemaDefaults covers an explicit 0 for both.
  • Field.defaultJson is gone from Field and the generated SchemaFields.

The Go, TS and Java suites and TestFillConfigDefaults pass on my side (linux-arm64). The workflow runs still need approval.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Native Lang-SDK tasks ignore Airflow's task-level config defaults

3 participants