Forum Discussion
Using an asynchronous task | Creating UCS File
- Apr 24, 2020
; to close the loop on this one, it appears that you the part that was missing in your request is the -X PUT request, to set the state to 'VALIDATING'
# curl -k -u admin:admin -H 'Content-Type: application/json' -X PUT -d '{"_taskState":"VALIDATING"}' https://localhost/mgmt/tm/task/sys/ucs/1563478591515657?ver=12.1.3.4 { "code":202, "message":"Task will execute asynchronously.", "errorStack":[] }
That is the request which is necessary to cause any task to begin processing. Until then, the task is waiting for any number of additional tasks to be added together.
; to close the loop on this one, it appears that you the part that was missing in your request is the -X PUT request, to set the state to 'VALIDATING'
# curl -k -u admin:admin -H 'Content-Type: application/json' -X PUT -d '{"_taskState":"VALIDATING"}' https://localhost/mgmt/tm/task/sys/ucs/1563478591515657?ver=12.1.3.4
{
"code":202,
"message":"Task will execute asynchronously.",
"errorStack":[]
}
That is the request which is necessary to cause any task to begin processing. Until then, the task is waiting for any number of additional tasks to be added together.
Hello
It looks like I need somebody's help to determine what could be wrong with my script.
I am re-writing all the logic using PowerShell, but the idea is the same - to create a task, to start the task, to check if the task state is COMPLETED and then to download the result.
Here is what I am facing:
step1, to create a task:
_taskId : 1684506387897122
_taskState : STARTED
_taskTimeInStateMs : 0
_taskResultLink : https://localhost/mgmt/tm/task/sys/ucs/1684506387897122/result?ver=16.1.3.4
selfLink : https://localhost/mgmt/tm/task/sys/ucs/1684506387897122?ver=16.1.3.4
step2, to start the task
code : 202
message : Task will execute asynchronously.
errorStack : {}
step3, getting status (the request hags for ~30 seconds):
Invoke-RestMethod : {"code":400,"message":"remoteSender:10.0.3.138, method:GET ","referer":"10.0.3.138","restOperationId":15296221,"kind":":resterrorresponse"}
If I request status for the 2nd time, I can get (sometimes) task COMPLETED, or I can get a "Task not found" error. My question is why do sometimes tasks disappear?
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com