[Kimchi-devel] [PATCH] [Wok 0/2] Issue #122 - Make AsyncTask stoppable.

Lucio Correia luciojhc at linux.vnet.ibm.com
Tue Aug 30 14:26:52 UTC 2016


Reviewed-By: Lucio Correia <luciojhc at linux.vnet.ibm.com>

On 30-08-2016 10:57, pvital at linux.vnet.ibm.com wrote:
> From: Paulo Vital <pvital at linux.vnet.ibm.com>
>
> This patch-set gives to user a way to 'stop' a Task that is still running by
> setting the Task status to "killed".
>
> Since an AsyncTask is basic a thread running in the system and this thread can
> execute a pure Python method or a background command (by using run_command()
> from wok.utils), the developer must pass to AsyncTask constructor a method to be
> executed by the DELETE operation, called here as 'kill_cb'.
>
> If none kill_cb is passed, the task will not be able to stopped and an error
> message will be raised to user if DELETE operation is executed. Otherwise, the
> kill_cb method will be executed by kill() method (responsible to execute the
> DELETE operation) of AsyncTask class and its status set to 'killed'.
>
> The unit tests present how you can use it.
>
> Paulo Vital (2):
>   Issue #122 - Make AsyncTask stoppable.
>   Issue #122 - Add unit test to stop AsyncTask.
>
>  docs/API/tasks.md      |  2 ++
>  src/wok/asynctask.py   | 18 +++++++++++++++++-
>  src/wok/i18n.py        |  1 +
>  src/wok/model/tasks.py | 13 +++++++++++++
>  tests/test_api.py      | 26 ++++++++++++++++++++++++--
>  tests/test_tasks.py    | 19 ++++++++++++++++++-
>  6 files changed, 75 insertions(+), 4 deletions(-)
>


-- 
Lucio Correia
Software Engineer
IBM LTC Brazil




More information about the Kimchi-devel mailing list