airflow.providers.celery.executors.celery_executor
¶
CeleryExecutor。
另請參閱
如需 CeleryExecutor 運作方式的詳細資訊,請參閱指南: Celery Executor
模組內容¶
類別¶
建議在 Airflow 的生產環境中使用 CeleryExecutor。 |
函數¶
|
屬性¶
- 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
建議在 Airflow 的生產環境中使用 CeleryExecutor。
它允許將任務實例的執行分散到多個 worker 節點。
Celery 是一個簡單、彈性且可靠的分散式系統,用於處理大量的訊息,同時為運營提供維護此類系統所需的工具。
- change_state(key, state, info=None, remove_running=True)[source]¶
變更任務的狀態。
- 參數
key (airflow.models.taskinstancekey.TaskInstanceKey) – 任務實例的唯一鍵
state (airflow.utils.state.TaskInstanceState) – 要為任務設定的狀態。
info – 任務實例的執行器資訊
remove_running – 是否從執行中集合移除 TI 鍵
- try_adopt_task_instances(tis)[source]¶
嘗試採用因 SchedulerJob 終止而遭遺棄的執行中任務實例。
任何未被採用的項目都將由排程器清除(然後變得符合重新排程的條件)
- 回傳
任何無法採用的 TaskInstance
- 回傳類型
collections.abc.Sequence[airflow.models.taskinstance.TaskInstance]
- cleanup_stuck_queued_tasks(tis)[source]¶
從執行器移除卡在佇列中的任務並使其失敗。
此方法已過時。請改用 cleanup_tasks_stuck_in_queued。
- revoke_task(*, ti)[source]¶
嘗試從執行器移除任務。
它應嘗試確保任務不再於 worker 上執行,並確保從內部資料結構中清除。
它*不應*變更 airflow 中任務的狀態,或將任何事件新增至事件緩衝區。
它不應引發任何錯誤。
- 參數
ti (airflow.models.taskinstance.TaskInstance) – 要移除的任務實例