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
collections.abc.Sequence[airflow.models.taskinstance.TaskInstance]
- cleanup_stuck_queued_tasks(tis)[source]¶
Remove tasks stuck in queued from executor and fail them.
This method is deprecated. Use cleanup_tasks_stuck_in_queued instead.
- revoke_task(*, ti)[source]¶
Attempt to remove task from executor.
It should attempt to ensure that the task is no longer running on the worker, and ensure that it is cleared out from internal data structures.
It should not change the state of the task in airflow, or add any events to the event buffer.
It should not raise any error.
- Parameters
ti (airflow.models.taskinstance.TaskInstance) – Task instance to remove
- 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.