Skip to content

Commit

Permalink
Merge branch 'pr141_update' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
rkdarst committed Jun 17, 2019
2 parents be31234 + 359d1e8 commit 1affa83
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion batchspawner/batchspawner.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@ def _req_keepvars_default(self):
"Must include {cmd} which will be replaced with the jupyterhub-singleuser command line."
).tag(config=True)

batchspawner_wrapper = Unicode('batchspawner-singleuser',
help="A wrapper which is capable of special batchspawner setup: currently sets the port on "
"the remote host. Not needed to be set under normal circumstances, unless path needs "
"specification."
).tag(config=True)

# Raw output of job submission command unless overridden
job_id = Unicode()

Expand All @@ -184,7 +190,8 @@ def parse_job_id(self, output):
return output

def cmd_formatted_for_batch(self):
return ' '.join(['batchspawner-singleuser'] + self.cmd + self.get_args())
"""The command which is substituted inside of the batch script"""
return ' '.join(self.batchspawner_wrapper + self.cmd + self.get_args())

async def run_command(self, cmd, input=None, env=None):
proc = await asyncio.create_subprocess_shell(cmd, env=env,
Expand Down Expand Up @@ -229,8 +236,11 @@ async def _get_batch_script(self, **subvars):

async def submit_batch_script(self):
subvars = self.get_req_subvars()
# `cmd` is submitted to the batch system
cmd = ' '.join((format_template(self.exec_prefix, **subvars),
format_template(self.batch_submit_cmd, **subvars)))
# `subvars['cmd']` is what is run _inside_ the batch script,
# put into the template.
subvars['cmd'] = self.cmd_formatted_for_batch()
if hasattr(self, 'user_options'):
subvars.update(self.user_options)
Expand Down

0 comments on commit 1affa83

Please sign in to comment.