Skip to content

Commit a2c4202

Browse files
committed
Fixed LSFCluster stdin job setup not being run in a shell
1 parent 795fb66 commit a2c4202

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

dask_jobqueue/core.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,21 +462,25 @@ async def _close_job(cls, job_id, cancel_command):
462462
logger.debug("Closed job %s", job_id)
463463

464464
@staticmethod
465-
async def _call(cmd, **kwargs):
465+
async def _call(cmd, *, shell=False, **kwargs):
466466
"""Call a command using asyncio.create_subprocess_exec.
467467
468468
This centralizes calls out to the command line, providing consistent
469469
outputs, logging, and an opportunity to go asynchronous in the future.
470470
471471
Parameters
472472
----------
473-
cmd: List(str))
473+
cmd: List(str)
474474
A command, each of which is a list of strings to hand to
475475
asyncio.create_subprocess_exec
476+
shell: bool
477+
Use asyncio.create_subprocess_shell instead to run the command
478+
in a shell?
476479
477480
Examples
478481
--------
479482
>>> self._call(['ls', '/foo'])
483+
>>> self._call(['ls /foo'], shell=True)
480484
481485
Returns
482486
-------
@@ -491,7 +495,12 @@ async def _call(cmd, **kwargs):
491495
"Executing the following command to command line\n{}".format(cmd_str)
492496
)
493497

494-
proc = await asyncio.create_subprocess_exec(
498+
if shell:
499+
create_subproc = asyncio.create_subprocess_shell
500+
else:
501+
create_subproc = asyncio.create_subprocess_exec
502+
503+
proc = await create_subproc(
495504
*cmd,
496505
stdout=asyncio.subprocess.PIPE,
497506
stderr=asyncio.subprocess.PIPE,

dask_jobqueue/lsf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def __init__(
108108
async def _submit_job(self, script_filename):
109109
if self.use_stdin:
110110
piped_cmd = [self.submit_command + "< " + script_filename + " 2> /dev/null"]
111-
return await self._call(piped_cmd)
111+
return await self._call(piped_cmd, shell=True)
112112
else:
113113
result = await super()._submit_job(script_filename)
114114
return result

0 commit comments

Comments
 (0)