Skip to content

Conversation

@amoghrajesh
Copy link
Contributor

closes: #48590

We have hardcoded certain configs for supervisor and for worker sdk API client. Allowing these options to be configurable will allow for more flexibility.

Introducing these changes under "workers" section in config.yml that was added earlier for #48446.

Testing

  • Dag doesnt really matter here, I am testing two scenarios with celery worker so that its a different host where config is loaded on.

Default options:
Running this:

for param in "workers task_instance_min_heartbeat_interval" \
             "workers task_instance_max_failed_heartbeats" \
             "workers execution_api_retries" \
             "workers execution_api_retry_wait_min" \
             "workers execution_api_retry_wait_max" \
             "scheduler task_instance_heartbeat_timeout"
do
  echo "Config: $param"
  airflow config get-value $param
  echo "===="
done

Config: workers task_instance_min_heartbeat_interval
5
====
Config: workers task_instance_max_failed_heartbeats
3
====
Config: workers execution_api_retries
5
====
Config: workers execution_api_retry_wait_min
1.0
====
Config: workers execution_api_retry_wait_max
90.0
====
Config: scheduler task_instance_heartbeat_timeout
300
====

Overriding with these environment variables.

export AIRFLOW__WORKERS__TASK_INSTANCE_MIN_HEARTBEAT_INTERVAL="10"
export AIRFLOW__WORKERS__TASK_INSTANCE_MAX_FAILED_HEARTBEATS="5"
export AIRFLOW__WORKERS__EXECUTION_API_RETRIES="4"
export AIRFLOW__WORKERS__EXECUTION_API_RETRY_WAIT_MIN="2.0"
export AIRFLOW__WORKERS__EXECUTION_API_RETRY_WAIT_MAX="50.0"
export AIRFLOW__SCHEDULER__TASK_INSTANCE_HEARTBEAT_TIMEOUT="90"

Ran the same script from above. Works as expected.

Config: workers task_instance_min_heartbeat_interval
10
====
Config: workers task_instance_max_failed_heartbeats
5
====
Config: workers execution_api_retries
4
====
Config: workers execution_api_retry_wait_min
2.0
====
Config: workers execution_api_retry_wait_max
50.0
====
Config: scheduler task_instance_heartbeat_timeout
90
====

^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

Copy link
Member

@ashb ashb left a comment

Choose a reason for hiding this comment

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

Should we move where the execution api server URL is pulled form in the config in to this section too?

(If we do, lets make existing beta users' life easy and look at the current config location too)

@amoghrajesh
Copy link
Contributor Author

Should we move where the execution api server URL is pulled form in the config in to this section too?

(If we do, lets make existing beta users' life easy and look at the current config location too)

@ashb ill check this in a follow up.

@amoghrajesh amoghrajesh merged commit e9cc148 into apache:main Apr 1, 2025
62 checks passed
@amoghrajesh amoghrajesh deleted the configure-task-sdk-conf branch April 1, 2025 11:50
nailo2c pushed a commit to nailo2c/airflow that referenced this pull request Apr 4, 2025
diogotrodrigues pushed a commit to diogotrodrigues/airflow that referenced this pull request Apr 6, 2025
simonprydden pushed a commit to simonprydden/airflow that referenced this pull request Apr 8, 2025
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.

Make Task SDK configs configurable via airflow.cfg

3 participants