Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api.task.get_task_by_id(taskid) return object does not include "endTime" #77

Closed
2 tasks done
ragadegithub opened this issue Jan 9, 2023 · 3 comments
Closed
2 tasks done

Comments

@ragadegithub
Copy link

ragadegithub commented Jan 9, 2023

Prerequisites

  • Have you tested the operation in the API directly?
  • Do you have the latest SDK version?

Describe the bug
api.task.get_task_by_id(taskid) return object must include "endTime" when the task has completed.
presence of the "endTime" key in the response data signifies the completion of the task and hence is very useful for executing conditional loops to check task status.
Below is the response for obtained for a completed task using the SDK (api.task.get_task_by_id(taskid))
{
'version': 1667597378807,
'startTime': 1667597377102,
'progress': '{"fileId":"f4b356e7-d132-4eab-811a-bbad2001d08f"}',
'username': 'admin',
'serviceType': 'Command Runner Service',
'lastUpdate': 1667597378807,
'isError': False,
'instanceTenantId': '6334ab5f519bd86f3b93a4ee',
'id': '2eee4e7c-93b7-41c0-9c8f-de71e171d546'
}

Output from POSTMAN for the same task

"response": {
    "endTime": 1667597382798,       <---- Important endTime key/value pair 
    "version": 1667597382798,
    "startTime": 1667597377102,
    "progress": "{\"fileId\":\"f4b356e7-d132-4eab-811a-bbad2001d08f\"}",
    "username": "admin",
    "serviceType": "Command Runner Service",
    "lastUpdate": 1667597378807,
    "isError": false,
    "instanceTenantId": "6334ab5f519bd86f3b93a4ee",
    "id": "2eee4e7c-93b7-41c0-9c8f-de71e171d546"
},
"version": "1.0"

}
Expected behavior
Expected return object:
{
'version': 1667597378807,
'startTime': 1667597377102,
"endTime": 1667597382798,
'progress': '{"fileId":"f4b356e7-d132-4eab-811a-bbad2001d08f"}',
'username': 'admin',
'serviceType': 'Command Runner Service',
'lastUpdate': 1667597378807,
'isError': False,
'instanceTenantId': '6334ab5f519bd86f3b93a4ee',
'id': '2eee4e7c-93b7-41c0-9c8f-de71e171d546'
}

Screenshots
Please provide an screenshot of the successful API call with cuRL, Postman, etc.

Environment (please complete the following information):

  • Cisco DNA Center Version and patch: 2.2.2.5
  • Python version: 3.9.13
  • SDK version: 2.5.4
  • OS Version: Windows10 / ubuntu 20.4

Additional context
Add any other context about the problem here.

@bvargasre
Copy link
Collaborator

Hi @ragadegithub
dnacentersdk already supports it, what I think happened is that when you performed get_task_by_id it was not finished yet, that's why it didn't come endTime.

That's API performance, since endTime only comes when it is really done

That's why later when you checked in postman it was already there because it had time to finish.

@ragadegithub
Copy link
Author

ragadegithub commented Jan 23, 2023 via email

@ragadegithub
Copy link
Author

This issue can be closed.
endTime key is available in the response.
{'version': 1674498909320, 'endTime': 1674498909320, 'startTime': 1674498905844, 'progress': '{"fileId":"60dc7a4c-6ed2-4d63-a01b-f9dc5a319026"}', 'serviceType': 'Command Runner Service', 'username': 'admin', 'lastUpdate': 1674498909320, 'isError': False, 'instanceTenantId': '6334ab5f519bd86f3b93a4ee', 'id': '9deb655d-2a81-4beb-bf9e-14282ed68a94'}

endTime is On a scale setup the reponse.progress will have the 'fileId' field well before the endTime is published. Increase the "Wait time to fix the issue in script than sdk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants