aboutsummaryrefslogtreecommitdiffstats
path: root/tests/wqueue.py
diff options
context:
space:
mode:
authorVG <vg@devys.org>2016-04-11 13:21:10 +0200
committerVG <vg@devys.org>2016-04-11 13:21:10 +0200
commit4b59cc343e88cff459bc663bbc85e3c701fdd415 (patch)
treed10be0cd65a3b234b03ad8d54382041db659116c /tests/wqueue.py
parent1c8b8d2a5faefdf73ec9fccaf24ebbe826f21b97 (diff)
downloadwqueue-4b59cc343e88cff459bc663bbc85e3c701fdd415.tar.gz
wqueue-4b59cc343e88cff459bc663bbc85e3c701fdd415.tar.bz2
wqueue-4b59cc343e88cff459bc663bbc85e3c701fdd415.zip
Auto-commit on 6d1dbe8495b5fafbc5f50d80268d0ca5b7b097be
Diffstat (limited to 'tests/wqueue.py')
-rwxr-xr-xtests/wqueue.py66
1 files changed, 0 insertions, 66 deletions
diff --git a/tests/wqueue.py b/tests/wqueue.py
deleted file mode 100755
index 7120bf4..0000000
--- a/tests/wqueue.py
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/usr/bin/python3
-
-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])
- loop.suprocess_exec([command, arg],
- stdin=subprocess.DEVNULL,
- stdout=sys.stdout,
- stderr=sys.stderr)
- print('ret:', ret)
- return ret == 0
-
-def read_next_job_arg():
- with open(QUEUE_FILE, 'r') as f:
- line = f.readline()
- return line.strip()
-
-def pop_job_arg():
- queue = QUEUE_FILE
- queue_tmp = queue + '.tmp'
- linecount = 0
- with open(queue, 'r') as fi, open(queue_tmp, 'w') as fo:
- for line in fi:
- linecount += 1
- if linecount == 1:
- continue
- 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()
-
-#loop = asyncio.get_event_loop()
-loop.run_forever()