Closed ragadegithub closed 1 year ago
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.
Bryan, I think, my observation is that the endTime never was available in the output from the SDK even after the task was completed. Let me re-test that and share with you the results where the loop continues as it never found the endTime attribute.
Regards, Rakesh
On Tue, Jan 10, 2023 at 3:50 PM Bryan Vargas @.***> wrote:
Hi @ragadegithub https://github.com/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.
— Reply to this email directly, view it on GitHub https://github.com/cisco-en-programmability/dnacentersdk/issues/77#issuecomment-1377831085, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFTMLRIBLDP7GRA3KGUT2LLWRXDSRANCNFSM6AAAAAATV2MWZI . You are receiving this because you were mentioned.Message ID: @.***>
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.
Prerequisites
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
} 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):
Additional context Add any other context about the problem here.