You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add api call for changing task instance status #23246
In the UI you can change the status of a task instance, but there is no API call available for the same feature.
It would be nice to have an api call for this as well.
Use case/motivation
I found a solution on stack-overflow on [How to add manual tasks in an Apache Airflow Dag]. There is a suggestion to set a task on failed and change it manually to succeed when the task is done.
Our project has many manual tasks. This suggestions seems like a good option, but there is no api call yet to call instead of change all status manually. I would like to use an api call for this instead.
You can change the status of on a dag run so it also seems natural to have something similar for task instances.
@ephraimbuddy@ashb about to write some test cases. Should this be a PATCH request since this updates a task instance state as opposed to POST which is typically used to create the task instance?
I have written the methods needed, but for some reason my tests are failing when I run them locally. Curious if it's something in the v1.yaml file. Can someone possibly help me out with this sometime?
Runing stuff in breeze (after updating the image) is the best way to test stuff in a reproducible environment that is the same on CI as locally and one that you can make sure hsa all the same dependencies - this is an often reason of the "works for me" syndrome when running tests. I recommend running tests for breeze (not sure though if that's exactly the case of yours).
Activity
boring-cyborg commentedon Apr 26, 2022
Thanks for opening your first issue here! Be sure to follow the issue template!
tirkarthi commentedon Apr 26, 2022
There is
/api/v1/dags/{dag_id}/updateTaskInstancesState.Sample payload :
airflow/tests/api_connexion/endpoints/test_task_instance_endpoint.py
Lines 1205 to 1214 in 2bb1cd2
ashb commentedon Apr 26, 2022
There should probably also be a
POSTto update a single TI just for consistency sake too.tirkarthi commentedon Apr 26, 2022
Agreed, there is also #23227 to clear a given task under a DAG run which seems little similar to this request if my understanding is correct.
erdos2n commentedon Apr 26, 2022
@ashb @tirkarthi is it possible to get assigned this issue? I would love to take it if possible.
tirkarthi commentedon Apr 26, 2022
@erdos2n I am not working on it. Feel free to take it up.
ephraimbuddy commentedon Apr 28, 2022
I think updating a single TI is possible in the current endpoint. Setting these:
False in the payload will have it update only the particular task instance
ephraimbuddy commentedon Apr 28, 2022
Problem with this is the date range that it updates. Yeah, will be good to be more specificashb commentedon Apr 28, 2022
From a RESTy point of view I like and end point where the task id is in the URL :)
erdos2n commentedon May 13, 2022
@ephraimbuddy @ashb about to write some test cases. Should this be a
PATCHrequest since this updates a task instance state as opposed toPOSTwhich is typically used to create the task instance?uranusjr commentedon May 14, 2022
PATCH sounds like a reasonable choice to me.
erdos2n commentedon Jun 19, 2022
I have written the methods needed, but for some reason my tests are failing when I run them locally. Curious if it's something in the
v1.yamlfile. Can someone possibly help me out with this sometime?potiuk commentedon Jun 19, 2022
Runing stuff in
breeze(after updating the image) is the best way to test stuff in a reproducible environment that is the same on CI as locally and one that you can make sure hsa all the same dependencies - this is an often reason of the "works for me" syndrome when running tests. I recommend running tests for breeze (not sure though if that's exactly the case of yours).erdos2n commentedon Jul 21, 2022
unnassigning myself, as I am unable to get the tests to pass
cedkoffeto commentedon Aug 18, 2022
Hi everyone, I am new in the airflow community and want to help and learn.
Am interested in this issue so @erdos2n can we assign it to me, please?
cedkoffeto commentedon Aug 18, 2022
Do you think we should add an API call like this? /taskInstances/{task_instance_id}/update just to be focused on the DagRun itself.
potiuk commentedon Aug 26, 2022
I think it's best to add draft PR with proposal and discuss it there.
cedkoffeto commentedon Aug 28, 2022
Sure, Thank you for your feedback