File "/anaconda/anaconda3/lib/python3.7/site-packages/airflow/models/baseoperator.py", line 518, in __init__ validate_key(task_id)
时间: 2023-10-08 16:05:40 浏览: 45
This error occurs when initializing a new operator in Airflow and passing an invalid task ID as a parameter. The task ID is a string that identifies the task and must be unique within the DAG.
To resolve the error, ensure that the task ID passed to the operator is a valid string that follows the naming conventions for task IDs in Airflow. Task IDs should consist of alphanumeric characters and underscores only, and should not start with a number. Additionally, task IDs should be descriptive and reflect the purpose of the task.
Example of valid task IDs:
- my_task
- my_task_1
- my_task_2
Example of invalid task IDs:
- 1_task (starts with a number)
- my_task! (contains non-alphanumeric characters)
- task (not descriptive enough)