Make async_wrapper ignore '_' as an argsfile. (#4678)

This provides support for passing additional positional parameters to async_wrapper.
Additional parameters will be used by the upcoming async support for Windows.
This commit is contained in:
Matt Clay 2016-09-02 18:19:29 -07:00 committed by GitHub
parent b0ef99c73b
commit 05c6707a32

View file

@ -120,7 +120,7 @@ def _run_module(wrapped_cmd, jid, job_path):
####################
if __name__ == '__main__':
if len(sys.argv) < 3:
if len(sys.argv) < 5:
print(json.dumps({
"failed" : True,
"msg" : "usage: async_wrapper <jid> <time_limit> <modulescript> <argsfile>. Humans, do not call directly!"
@ -130,8 +130,9 @@ if __name__ == '__main__':
jid = "%s.%d" % (sys.argv[1], os.getpid())
time_limit = sys.argv[2]
wrapped_module = sys.argv[3]
if len(sys.argv) >= 5:
argsfile = sys.argv[4]
argsfile = sys.argv[4]
# consider underscore as no argsfile so we can support passing of additional positional parameters
if argsfile != '_':
cmd = "%s %s" % (wrapped_module, argsfile)
else:
cmd = wrapped_module