Skip to content

Commit

Permalink
Bugfix: Must use same treatment of list of command parts in all ex* f…
Browse files Browse the repository at this point in the history
…unctions
  • Loading branch information
samuell committed Sep 10, 2015
1 parent aa8310a commit 1e028c3
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions sciluigi/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import time
import sciluigi.parameter
import sciluigi.task
import subprocess as sub

# ================================================================================

Expand Down Expand Up @@ -101,21 +102,23 @@ def ex(self, command):
'''
Execute either locally or via SLURM, depending on config
'''
command_str = ' '.join(command)
if isinstance(command, list):
command = ' '.join(command)

if self.slurminfo.runmode == RUNMODE_LOCAL:
log.info('Executing command in local mode: %s' % command_str)
log.info('Executing command in local mode: %s' % command)
self.ex_local(command) # Defined in task.py
elif self.slurminfo.runmode == RUNMODE_HPC:
log.info('Executing command in HPC mode: %s' % command_str)
log.info('Executing command in HPC mode: %s' % command)
self.ex_hpc(command)
elif self.slurminfo.runmode == RUNMODE_MPI:
log.info('Executing command in MPI mode: %s' % command_str)
log.info('Executing command in MPI mode: %s' % command)
self.ex_mpi(command)


def ex_hpc(self, command):
if isinstance(command, list):
command = ' '.join(command)
command = sub.list2cmdline(command)

fullcommand = 'salloc %s %s' % (self.slurminfo.get_argstr_hpc(), command)
(retcode, stdout, stderr) = self.ex_local(fullcommand)
Expand All @@ -126,7 +129,7 @@ def ex_hpc(self, command):

def ex_mpi(self, command):
if isinstance(command, list):
command = ' '.join(command)
command = sub.list2cmdline(command)

fullcommand = 'salloc %s %s' % (self.slurminfo.get_argstr_mpi(), command)
(retcode, stdout, stderr) = self.ex_local(fullcommand)
Expand Down

0 comments on commit 1e028c3

Please sign in to comment.