Show More
@@ -22,7 +22,6 b' Authors:' | |||
|
22 | 22 | import copy |
|
23 | 23 | import logging |
|
24 | 24 | import os |
|
25 | import re | |
|
26 | 25 | import stat |
|
27 | 26 | import time |
|
28 | 27 | |
@@ -58,7 +57,7 b' from IPython.config.application import Application' | |||
|
58 | 57 | from IPython.config.configurable import LoggingConfigurable |
|
59 | 58 | from IPython.utils.text import EvalFormatter |
|
60 | 59 | from IPython.utils.traitlets import ( |
|
61 | Any, Integer, CFloat, List, Unicode, Dict, Instance, HasTraits, | |
|
60 | Any, Integer, CFloat, List, Unicode, Dict, Instance, HasTraits, CRegExp | |
|
62 | 61 | ) |
|
63 | 62 | from IPython.utils.path import get_ipython_module_path, get_home_dir |
|
64 | 63 | from IPython.utils.process import find_cmd, pycmd2argv, FindCmdError |
@@ -826,7 +825,7 b' def find_job_cmd():' | |||
|
826 | 825 | |
|
827 | 826 | class WindowsHPCLauncher(BaseLauncher): |
|
828 | 827 | |
|
829 |
job_id_regexp = |
|
|
828 | job_id_regexp = CRegExp(r'\d+', config=True, | |
|
830 | 829 | help="""A regular expression used to get the job id from the output of the |
|
831 | 830 | submit_command. """ |
|
832 | 831 | ) |
@@ -857,7 +856,7 b' class WindowsHPCLauncher(BaseLauncher):' | |||
|
857 | 856 | |
|
858 | 857 | def parse_job_id(self, output): |
|
859 | 858 | """Take the output of the submit command and return the job id.""" |
|
860 |
m = re.search( |
|
|
859 | m = self.job_id_regexp.search(output) | |
|
861 | 860 | if m is not None: |
|
862 | 861 | job_id = m.group() |
|
863 | 862 | else: |
@@ -1006,7 +1005,7 b' class BatchSystemLauncher(BaseLauncher):' | |||
|
1006 | 1005 | help="The name of the command line program used to submit jobs.") |
|
1007 | 1006 | delete_command = List([''], config=True, |
|
1008 | 1007 | help="The name of the command line program used to delete jobs.") |
|
1009 |
job_id_regexp = |
|
|
1008 | job_id_regexp = CRegExp('', config=True, | |
|
1010 | 1009 | help="""A regular expression used to get the job id from the output of the |
|
1011 | 1010 | submit_command.""") |
|
1012 | 1011 | batch_template = Unicode('', config=True, |
@@ -1026,10 +1025,10 b' class BatchSystemLauncher(BaseLauncher):' | |||
|
1026 | 1025 | |
|
1027 | 1026 | # not configurable, override in subclasses |
|
1028 | 1027 | # PBS Job Array regex |
|
1029 |
job_array_regexp = |
|
|
1028 | job_array_regexp = CRegExp('') | |
|
1030 | 1029 | job_array_template = Unicode('') |
|
1031 | 1030 | # PBS Queue regex |
|
1032 |
queue_regexp = |
|
|
1031 | queue_regexp = CRegExp('') | |
|
1033 | 1032 | queue_template = Unicode('') |
|
1034 | 1033 | # The default batch template, override in subclasses |
|
1035 | 1034 | default_template = Unicode('') |
@@ -1060,7 +1059,7 b' class BatchSystemLauncher(BaseLauncher):' | |||
|
1060 | 1059 | |
|
1061 | 1060 | def parse_job_id(self, output): |
|
1062 | 1061 | """Take the output of the submit command and return the job id.""" |
|
1063 |
m = re.search( |
|
|
1062 | m = self.job_id_regexp.search(output) | |
|
1064 | 1063 | if m is not None: |
|
1065 | 1064 | job_id = m.group() |
|
1066 | 1065 | else: |
@@ -1083,16 +1082,14 b' class BatchSystemLauncher(BaseLauncher):' | |||
|
1083 | 1082 | |
|
1084 | 1083 | # add jobarray or queue lines to user-specified template |
|
1085 | 1084 | # note that this is *only* when user did not specify a template. |
|
1086 | regex = re.compile(self.job_array_regexp) | |
|
1087 |
|
|
|
1088 | if not regex.search(self.batch_template): | |
|
1085 | # print self.job_array_regexp.search(self.batch_template) | |
|
1086 | if not self.job_array_regexp.search(self.batch_template): | |
|
1089 | 1087 | self.log.debug("adding job array settings to batch script") |
|
1090 | 1088 | firstline, rest = self.batch_template.split('\n',1) |
|
1091 | 1089 | self.batch_template = u'\n'.join([firstline, self.job_array_template, rest]) |
|
1092 | 1090 | |
|
1093 | regex = re.compile(self.queue_regexp) | |
|
1094 |
|
|
|
1095 | if self.queue and not regex.search(self.batch_template): | |
|
1091 | # print self.queue_regexp.search(self.batch_template) | |
|
1092 | if self.queue and not self.queue_regexp.search(self.batch_template): | |
|
1096 | 1093 | self.log.debug("adding PBS queue settings to batch script") |
|
1097 | 1094 | firstline, rest = self.batch_template.split('\n',1) |
|
1098 | 1095 | self.batch_template = u'\n'.join([firstline, self.queue_template, rest]) |
@@ -1129,13 +1126,13 b' class PBSLauncher(BatchSystemLauncher):' | |||
|
1129 | 1126 | help="The PBS submit command ['qsub']") |
|
1130 | 1127 | delete_command = List(['qdel'], config=True, |
|
1131 | 1128 | help="The PBS delete command ['qsub']") |
|
1132 |
job_id_regexp = |
|
|
1129 | job_id_regexp = CRegExp(r'\d+', config=True, | |
|
1133 | 1130 | help="Regular expresion for identifying the job ID [r'\d+']") |
|
1134 | 1131 | |
|
1135 | 1132 | batch_file = Unicode(u'') |
|
1136 |
job_array_regexp = |
|
|
1133 | job_array_regexp = CRegExp('#PBS\W+-t\W+[\w\d\-\$]+') | |
|
1137 | 1134 | job_array_template = Unicode('#PBS -t 1-{n}') |
|
1138 |
queue_regexp = |
|
|
1135 | queue_regexp = CRegExp('#PBS\W+-q\W+\$?\w+') | |
|
1139 | 1136 | queue_template = Unicode('#PBS -q {queue}') |
|
1140 | 1137 | |
|
1141 | 1138 | |
@@ -1174,9 +1171,9 b' class PBSEngineSetLauncher(PBSLauncher, BatchClusterAppMixin):' | |||
|
1174 | 1171 | |
|
1175 | 1172 | class SGELauncher(PBSLauncher): |
|
1176 | 1173 | """Sun GridEngine is a PBS clone with slightly different syntax""" |
|
1177 |
job_array_regexp = |
|
|
1174 | job_array_regexp = CRegExp('#\$\W+\-t') | |
|
1178 | 1175 | job_array_template = Unicode('#$ -t 1-{n}') |
|
1179 |
queue_regexp = |
|
|
1176 | queue_regexp = CRegExp('#\$\W+-q\W+\$?\w+') | |
|
1180 | 1177 | queue_template = Unicode('#$ -q {queue}') |
|
1181 | 1178 | |
|
1182 | 1179 | class SGEControllerLauncher(SGELauncher, BatchClusterAppMixin): |
@@ -1218,13 +1215,13 b' class LSFLauncher(BatchSystemLauncher):' | |||
|
1218 | 1215 | help="The PBS submit command ['bsub']") |
|
1219 | 1216 | delete_command = List(['bkill'], config=True, |
|
1220 | 1217 | help="The PBS delete command ['bkill']") |
|
1221 |
job_id_regexp = |
|
|
1218 | job_id_regexp = CRegExp(r'\d+', config=True, | |
|
1222 | 1219 | help="Regular expresion for identifying the job ID [r'\d+']") |
|
1223 | 1220 | |
|
1224 | 1221 | batch_file = Unicode(u'') |
|
1225 |
job_array_regexp = |
|
|
1222 | job_array_regexp = CRegExp('#BSUB[ \t]-J+\w+\[\d+-\d+\]') | |
|
1226 | 1223 | job_array_template = Unicode('#BSUB -J ipengine[1-{n}]') |
|
1227 |
queue_regexp = |
|
|
1224 | queue_regexp = CRegExp('#BSUB[ \t]+-q[ \t]+\w+') | |
|
1228 | 1225 | queue_template = Unicode('#BSUB -q {queue}') |
|
1229 | 1226 | |
|
1230 | 1227 | def start(self, n): |
General Comments 0
You need to be logged in to leave comments.
Login now