airflow.providers.celery.executors.celery_executor
¶
CeleryExecutor.
See also
For more information on how the CeleryExecutor works, take a look at the guide: Celery Executor
Module Contents¶
Classes¶
CeleryExecutor is recommended for production use of Airflow. |
Functions¶
|
Attributes¶
- airflow.providers.celery.executors.celery_executor.CELERY_SEND_ERR_MSG_HEADER = 'Error sending Celery task'[source]¶
- class airflow.providers.celery.executors.celery_executor.CeleryExecutor[source]¶
Bases:
airflow.executors.base_executor.BaseExecutor
CeleryExecutor is recommended for production use of Airflow.
It allows distributing the execution of task instances to multiple worker nodes.
Celery is a simple, flexible and reliable distributed system to process vast amounts of messages, while providing operations with the tools required to maintain such a system.
- sync()[source]¶
Sync will get called periodically by the heartbeat method.
Executors should override this to perform gather statuses.
- change_state(key, state, info=None, remove_running=True)[source]¶
Change state of the task.
- Parameters
key (airflow.models.taskinstancekey.TaskInstanceKey) – Unique key for the task instance
state (airflow.utils.state.TaskInstanceState) – State to set for the task.
info – Executor information for the task instance
remove_running – Whether or not to remove the TI key from running set
- try_adopt_task_instances(tis)[source]¶
Try to adopt running task instances that have been abandoned by a SchedulerJob dying.
Anything that is not adopted will be cleared by the scheduler (and then become eligible for re-scheduling)
- Returns
any TaskInstances that were unable to be adopted
- Return type
Sequence[airflow.models.taskinstance.TaskInstance]
- cleanup_stuck_queued_tasks(tis)[source]¶
Handle remnants of tasks that were failed because they were stuck in queued.
Tasks can get stuck in queued. If such a task is detected, it will be marked as UP_FOR_RETRY if the task instance has remaining retries or marked as FAILED if it doesn’t.
- Parameters
tis (list[airflow.models.taskinstance.TaskInstance]) – List of Task Instances to clean up
- Returns
List of readable task instances for a warning message
- Return type
- static get_cli_commands()[source]¶
Vends CLI commands to be included in Airflow CLI.
Override this method to expose commands via Airflow CLI to manage this executor. This can be commands to setup/teardown the executor, inspect state, etc. Make sure to choose unique names for those commands, to avoid collisions.