insomnes opened a new issue, #33415:
URL: https://github.com/apache/airflow/issues/33415

   ### Apache Airflow version
   
   2.6.3
   
   ### What happened
   
   Got error while using `set_state()` to set task state to 
`TaskInstanceState.RESTARTING`
   
https://github.com/apache/airflow/blob/main/airflow/api/common/mark_tasks.py#L79
   
   
   ### What you think should happen instead
   
   The error is:
   ```
   ValueError: <TaskInstanceState.RESTARTING: 'restarting'> is not a valid 
DagRunState
   ```
   
   And coming from this 
[part](https://github.com/apache/airflow/blob/main/airflow/api/common/mark_tasks.py#L143):
   ```python
       sub_dag_run_ids = list(
           _iter_subdag_run_ids(dag, session, DagRunState(state), task_ids, 
commit, confirmed_infos),
       )
   ```
   It is checked that state is intact with:
   ```
   class DagRunState(str, Enum):
       """
       Enum that represents all possible states that a DagRun can be in.
   
       These are "shared" with TaskInstanceState in some parts of the code,
       so please ensure that their values always match the ones with the
       same name in TaskInstanceState.
       """
   
       QUEUED = "queued"
       RUNNING = "running"
       SUCCESS = "success"
       FAILED = "failed"
   ```
   
   Either should be this explicitly mentioned in doc string or as explicit 
check in code. 
   
   Or it should be changed so SubDags state is reductioned from task state by 
some rule
   
   ### How to reproduce
   
   Call `set_state` function for specific task with 
`state=TaskInstanceState.RESTARTING`
   
   ### Operating System
   
   EndeavourOS
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Docker-Compose
   
   ### Deployment details
   
   _No response_
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to