Skip to content

Commit 053ac62

Browse files
committed
Merge pull request #64 from mgermain/msub_support
Added msub support
2 parents 3167c93 + 9ee1815 commit 053ac62

File tree

4 files changed

+30
-4
lines changed

4 files changed

+30
-4
lines changed

scripts/smart_dispatch.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
LOGS_FOLDERNAME = "SMART_DISPATCH_LOGS"
2121
CLUSTER_NAME = utils.detect_cluster()
2222
AVAILABLE_QUEUES = get_available_queues(CLUSTER_NAME)
23+
LAUNCHER = utils.get_launcher(CLUSTER_NAME)
2324

2425

2526
def main():
@@ -85,14 +86,15 @@ def main():
8586
# Launch the jobs with QSUB
8687
if not args.doNotLaunch:
8788
for pbs_filename in pbs_filenames:
88-
qsub_output = check_output('qsub ' + pbs_filename, shell=True)
89+
qsub_output = check_output('{launcher} {pbs_filename}'.format(launcher=LAUNCHER if args.launcher is None else args.launcher, pbs_filename=pbs_filename), shell=True)
8990
print qsub_output,
9091

9192

9293
def parse_arguments():
9394
parser = argparse.ArgumentParser()
9495
parser.add_argument('-q', '--queueName', required=True, help='Queue used (ex: qwork@mp2, qfat256@mp2, qfat512@mp2)')
9596
parser.add_argument('-t', '--walltime', required=False, help='Set the estimated running time of your jobs using the DD:HH:MM:SS format. Note that they will be killed when this time limit is reached.')
97+
parser.add_argument('-L', '--launcher', choices=['qsub', 'msub'], required=False, help='Which launcher to use. Default: qsub')
9698
parser.add_argument('-C', '--coresPerNode', type=int, required=False, help='How many cores there are per node.')
9799
parser.add_argument('-G', '--gpusPerNode', type=int, required=False, help='How many gpus there are per node.')
98100
#parser.add_argument('-M', '--memPerNode', type=int, required=False, help='How much memory there are per node (in Gb).')
@@ -121,7 +123,7 @@ def parse_arguments():
121123
if args.commandsFile is None and len(args.commandAndOptions) < 1:
122124
parser.error("You need to specify a command to launch.")
123125
if args.queueName not in AVAILABLE_QUEUES and ((args.coresPerNode is None and args.gpusPerNode is None) or args.walltime is None):
124-
parser.error("Unknown queue, --coresPerCommand/--gpusPerCommand and --walltime must be set.")
126+
parser.error("Unknown queue, --coresPerNode/--gpusPerNode and --walltime must be set.")
125127
else:
126128
if args.pool is None:
127129
resume_parser.error("The resume feature only works with the --pool argument.")

smartdispatch/config/helios.json

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
11
{
2-
"maint": {
2+
"gpu_8": {
33
"ram": 128,
44
"modules": ["cuda/6.0.37"],
55
"cores": 20,
66
"max_walltime": "12:00:00",
77
"gpus": 8,
88
"nodes": 15
9+
},
10+
"gpu_4": {
11+
"ram": 64,
12+
"modules": ["cuda/6.0.37"],
13+
"cores": 10,
14+
"max_walltime": "12:00:00",
15+
"gpus": 4,
16+
"nodes": 15
17+
},
18+
"test": {
19+
"ram": 128,
20+
"modules": ["cuda/6.0.37"],
21+
"cores": 20,
22+
"max_walltime": "15:00",
23+
"gpus": 8,
24+
"nodes": 15
925
}
1026
}

smartdispatch/tests/test_job_generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class TestHeliosQueue(unittest.TestCase):
127127

128128
def setUp(self):
129129
self.commands = ["echo 1", "echo 2", "echo 3", "echo 4"]
130-
self.queue = Queue("maint", "helios")
130+
self.queue = Queue("gpu_8", "helios")
131131

132132
self.env_val = 'RAP'
133133

smartdispatch/utils.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def unhexify(match):
5353

5454
return re.sub(r"\\x..", unhexify, text)
5555

56+
5657
@contextmanager
5758
def open_with_lock(*args, **kwargs):
5859
""" Context manager for opening file with an exclusive lock. """
@@ -95,3 +96,10 @@ def detect_cluster():
9596
elif server_name.split('.')[-1] == 'helios':
9697
cluster_name = "helios"
9798
return cluster_name
99+
100+
101+
def get_launcher(cluster_name):
102+
if cluster_name == "helios":
103+
return "msub"
104+
else:
105+
return "qsub"

0 commit comments

Comments
 (0)