[Kimchi-devel] [PATCH] [Wok 2/7] Move add_task to asynctask to avoid cyclic import
Lucio Correia
luciojhc at linux.vnet.ibm.com
Fri Aug 19 19:37:37 UTC 2016
Signed-off-by: Lucio Correia <luciojhc at linux.vnet.ibm.com>
---
src/wok/asynctask.py | 7 +++++++
src/wok/utils.py | 7 -------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/wok/asynctask.py b/src/wok/asynctask.py
index fb614a2..82a91ec 100644
--- a/src/wok/asynctask.py
+++ b/src/wok/asynctask.py
@@ -25,6 +25,13 @@ import traceback
from wok.exception import OperationFailed
+from wok.utils import get_next_task_id
+
+
+def add_task(target_uri, fn, objstore, opaque=None):
+ id = get_next_task_id()
+ AsyncTask(id, target_uri, fn, objstore, opaque)
+ return id
class AsyncTask(object):
diff --git a/src/wok/utils.py b/src/wok/utils.py
index 3d61e66..8caf4ee 100644
--- a/src/wok/utils.py
+++ b/src/wok/utils.py
@@ -39,7 +39,6 @@ from datetime import datetime, timedelta
from multiprocessing import Process, Queue
from threading import Timer
-from wok.asynctask import AsyncTask
from wok.config import paths, PluginPaths
from wok.exception import InvalidParameter, TimeoutExpired
from wok.stringutils import decode_value
@@ -60,12 +59,6 @@ def get_task_id():
return task_id
-def add_task(target_uri, fn, objstore, opaque=None):
- id = get_next_task_id()
- AsyncTask(id, target_uri, fn, objstore, opaque)
- return id
-
-
def is_digit(value):
if isinstance(value, int):
return True
--
1.9.1
More information about the Kimchi-devel
mailing list