Skip to content

Commit

Permalink
Cosmetic changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardomurri committed Oct 3, 2017
1 parent a9137d4 commit bf3d454
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 38 deletions.
9 changes: 4 additions & 5 deletions gc3libs/__init__.py
Expand Up @@ -1461,16 +1461,15 @@ def sbatch(self, resource, **extra_args):
if self.requested_walltime:
# SLURM uses `--time` for wall-clock time limit, expressed in
# minutes
sbatch += ['--time', '%d' %
self.requested_walltime.amount(minutes)]
sbatch += ['--time', ('%d' % self.requested_walltime.amount(minutes))]
if self.stdout:
sbatch += ['--output', '%s' % self.stdout]
sbatch += ['--output', ('%s' % self.stdout)]
if self.stdin:
# `self.stdin` is the full pathname on the GC3Pie client host;
# it is copied to its basename on the execution host
sbatch += ['--input', '%s' % os.path.basename(self.stdin)]
sbatch += ['--input', ('%s' % os.path.basename(self.stdin))]
if self.stderr:
sbatch += ['-e', '%s' % self.stderr]
sbatch += ['-e', ('%s' % self.stderr)]
if self.requested_cores != 1:
sbatch += ['--ntasks', '1',
# require that all cores are on the same node
Expand Down
37 changes: 4 additions & 33 deletions gc3libs/backends/slurm.py
Expand Up @@ -36,29 +36,7 @@
sh_quote_unsafe_cmdline)


# environmental variables:
# SLURM_TIME_FORMAT Specify the format used to report time
# stamps. A value of standard, the default value, generates
# output in the form "year-month-dateThour:minute:second".

# stat cmd: squeue --noheader --format='%i^%T^%r^%R' -j jobid1,jobid2,...
# %i: job id
#
# %T: Job state, extended form: PENDING, RUNNING, SUSPENDED,
# CANCELLED, COMPLETING, COMPLETED, CONFIGURING, FAILED, TIMEOUT,
# PREEMPTED, and NODE_FAIL.
#
# %R: For pending jobs: the reason a job is waiting for execution is
# printed within parenthesis. For terminated jobs with failure: an
# explanation as to why the job failed is printed within
# parenthesis. For all other job states: the list of allocate
# nodes.
# %r: reason a job is in its current state


# data for parsing SLURM commands output

# regexps for extracting relevant strings
## data for parsing SLURM commands output

# `sbatch` examples:
#
Expand All @@ -75,15 +53,8 @@
r'(sbatch:\s*)?(Granted job allocation|Submitted batch job)'
' (?P<jobid>\d+)')

# `squeue` examples:
#
# $ squeue --noheader --format='%i|%T|%r|%R' -j 2,3
# 2|PENDING|Resources|(Resources)
# 3|PENDING|Resources|(Resources)
#


# code
## code

def count_jobs(squeue_output, whoami):
"""
Expand Down Expand Up @@ -316,8 +287,8 @@ def _parse_acct_output(self, stdout, stderr):
acct = {
'cores': 0,
'duration': Duration(0, unit=seconds),
'used_cpu_time': Duration(0, unit=seconds),
'max_used_memory': Memory(0, unit=bytes)
'used_cpu_time': Duration(0, unit=seconds),
'max_used_memory': Memory(0, unit=bytes)
}
exitcode = None
signal = None
Expand Down

0 comments on commit bf3d454

Please sign in to comment.