Skip to content

Commit e20c963

Browse files
committed
name job per first command in list
1 parent f0163f2 commit e20c963

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

bin/submit_to_cluster

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ if args.project is None:
2929
try:
3030
proj_name = environ['MINDLABPROJ']
3131
if proj_name == 'NA':
32-
raise KeyError('Force an error')
32+
raise KeyError('MINDLABPROJ not defined')
3333
except KeyError:
3434
msg = ('You must specify a project name either by means of the '
3535
'--project flag or by setting the MINDLABPROJ environment '
@@ -40,8 +40,8 @@ else:
4040
# basic check of the memory-argument
4141
if args.total_memory is not None:
4242
if (not args.total_memory.startswith(
43-
tuple('%d' % ii for ii in range(1, 10))) or
44-
not args.total_memory.upper().endswith(('M', 'G', 'T'))):
43+
tuple('%d' % ii for ii in range(1, 10))) or not
44+
args.total_memory.upper().endswith(('M', 'G', 'T'))):
4545
raise ValueError('Bad memory format: {:s}'.format(args.total_memory))
4646

4747
job = ClusterJob(args.exec_cmd, proj_name=proj_name, n_threads=args.n_threads,

stormdb/cluster.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import re
1515
import math
1616
from six import string_types
17-
from os.path import expanduser
17+
from os.path import expanduser, basename
1818
from .access import Query
1919
from .base import enforce_path_exists
2020

@@ -260,7 +260,9 @@ def __init__(self,
260260
opt_threaded_flag = "#$ -pe threaded {:d}".format(self.n_threads)
261261

262262
if job_name is None:
263-
job_name = 'py-wrapper'
263+
# self._cmd may have multiple \n-separated commands: take 1st
264+
# basename followed by 0 or more spaces with arguments (ditch)
265+
job_name = basename(self._cmd.split('\n')[0]).split(' ')[0]
264266
log_name_prefix = job_name
265267

266268
if working_dir is not None and isinstance(working_dir, string_types):

0 commit comments

Comments
 (0)