OAT 设置禁止跳过的子任务,跳过之后一般都会影响后续任务执行,如果要强制跳过,请先确定跳过之后的影响。
强制跳过 airflow 任务的操作流程
OAT 的异步任务有一些子任务设置了禁止跳过,如果遇到异常情况,确定需要跳过此子任务的情况,可以参考如下操作流程。
白屏页面获取需要的参数。
在 OAT 白屏页面查看需要强制跳过任务的
operation_dagrun_id和task_ID,比如现在要跳过安装 oblb 任务的 install_oblb 任务。
从游览器的URL可以看到 operation_dagrun_id=29, task_ID="install_oblb@0"。
进入 OAT 容器,执行
python3 manage.py shell,然后 替换变量operation_dagrun_id和task_ID之后执行以下命令。from oat import airflow_api from oat.models import OperationDagRun from oat.views import get_task_id_and_map_index operation_dagrun_id = xxx # 把xxx替换为你的operation_dagrun_id task_ID = "xxx" # 把xxx替换为你的 task_ID operation_dagrun = OperationDagRun.objects.get(pk=operation_dagrun_id) task_id, map_index = get_task_id_and_map_index(task_ID) airflow_dagrun = airflow_api.get_dagrun_by_id(operation_dagrun.dagrun_id) airflow_api.skip_task(airflow_dagrun.dag_id, task_id, airflow_dagrun.execution_date, map_index=map_index)刷新 OAT 页面即可。
适用版本
OAT V4.x 版本。