openstacksdk/releasenotes/notes/fix-task-timing-048afea680adc62e.yaml
Ian Wienand dd5f0f6827
Call pre/post run task calls from TaskManager.submit_task()
Since I33325fb5be21264df0a68ceef2202ab7875f63ec, the task.run() call
in TaskManager.run_task() is now an asynchronous submission to the
threadpool, rather than a synchronous call to the task's actual
function.  This means taking the elapsed_time around this call is no
longer an indication of the task's runtime, but always comes out as
just a few μs for the insertion.

Move the pre and post calls into TaskManager.submit_task() where the
elapsed_time will reflect the time between insertion into the queue
and the wait() return of its result.

Update documentation for pre/post tasks, and add test-cases.

Depends-On: https://review.openstack.org/613438
Change-Id: I8617ab2895d1544a6902ae5a3d6a97b87bfd2ec9
2018-10-26 08:40:05 -05:00

6 lines
162 B
YAML

---
fixes:
- |
Fix a regression where the ``TaskManager.post_run_task`` ``elapsed_time``
argument was not reflecting the time taken by the actual task.