aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVG <vg@devys.org>2016-02-26 16:54:38 +0100
committerVG <vg@devys.org>2016-02-26 16:54:38 +0100
commitc4d61b7bfa3e3723ff87df8c163c9d77feeff4f8 (patch)
tree6299a702ef273a75e11d4ee6c85d46a05c40196c /tests
parentd92048da7ec2d84a7b1cc8ad9f0dc62ee79e1426 (diff)
downloadwqueue-c4d61b7bfa3e3723ff87df8c163c9d77feeff4f8.tar.gz
wqueue-c4d61b7bfa3e3723ff87df8c163c9d77feeff4f8.tar.bz2
wqueue-c4d61b7bfa3e3723ff87df8c163c9d77feeff4f8.zip
wip
Diffstat (limited to 'tests')
-rwxr-xr-xtests/wqueue.py29
1 files changed, 24 insertions, 5 deletions
diff --git a/tests/wqueue.py b/tests/wqueue.py
index 837fb26..528a10c 100755
--- a/tests/wqueue.py
+++ b/tests/wqueue.py
@@ -4,16 +4,27 @@ import fcntl
import time
import subprocess
import os
+import asyncio
QUEUE_FILE = 'queue.txt'
COMMAND = './command.sh'
+loop = asyncio.get_event_loop()
+
+class JobHandler(asyncio.SubprocessProtocol):
+ def process_exited(self):
+ print()
+
def do_job(command=None, arg=None):
assert(command)
assert(arg)
print('arg:', arg)
print('doing operation with arg')
- ret = subprocess.check_call([command, arg])
+ #ret = subprocess.check_call([command, arg])
+ loop.suprocess_exec([command, arg],
+ stdin=subprocess.DEVNULL,
+ stdout=sys.stdout,
+ stderr=sys.stderr)
print('ret:', ret)
return ret == 0
@@ -34,11 +45,19 @@ def pop_job_arg():
fo.write(line)
os.rename(queue_tmp, queue)
+def check_queue():
+ #loop = asyncio.get_event_loop()
+ #loop.run_forever()
+
+
#with open('queue.txt', 'w') as f:
# fcntl.lockf(f, fcntl.LOCK_EX)
# time.sleep(9999)
-while True:
- job_arg = read_next_job_arg()
- if do_job(command=COMMAND, arg=job_arg):
- pop_job_arg()
+#while True:
+# job_arg = read_next_job_arg()
+# if do_job(command=COMMAND, arg=job_arg):
+# pop_job_arg()
+
+#loop = asyncio.get_event_loop()
+loop.run_forever()