Skip to content

Commit

Permalink
implement option to use subprocess
Browse files Browse the repository at this point in the history
  • Loading branch information
mk270 committed Jun 13, 2014
1 parent 58e45db commit fb6286b
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions iatidq/test_queue.py
Expand Up @@ -310,14 +310,28 @@ def check_file(test_functions, codelists, file_name,

return rv

def dequeue_download(body, test_functions, codelists, subprocess):
def check_file_in_subprocess(filename, runtime_id, package_id):
import subprocess

this_dir = os.path.dirname(__file__)
path = os.path.join(this_dir, '..', 'bin', 'dqtool')

rv = subprocess.call([path, "--mode", "test-package",
"--package-id", str(package_id),
"--runtime-id", str(runtime_id),
"--filename", filename])

def dequeue_download(body, test_functions, codelists, use_subprocess):
try:
args = json.loads(body)
check_file(test_functions,
codelists,
args['filename'],
args['runtime_id'],
args['package_id'])
if not use_subprocess:
check_file(test_functions,
codelists,
args['filename'],
args['runtime_id'],
args['package_id'])
else:
check_file_in_subprocess(filename, runtime_id, package_id)
except Exception, e:
print "Exception in dequeue_download", e

Expand Down

0 comments on commit fb6286b

Please sign in to comment.