Show More
@@ -1001,6 +1001,78 b' class SGEEngineSetLauncher(SGELauncher):' | |||||
1001 | return super(SGEEngineSetLauncher, self).start(n, profile_dir) |
|
1001 | return super(SGEEngineSetLauncher, self).start(n, profile_dir) | |
1002 |
|
1002 | |||
1003 |
|
1003 | |||
|
1004 | # LSF launchers | |||
|
1005 | ||||
|
1006 | class LSFLauncher(BatchSystemLauncher): | |||
|
1007 | """A BatchSystemLauncher subclass for LSF.""" | |||
|
1008 | ||||
|
1009 | submit_command = List(['bsub'], config=True, | |||
|
1010 | help="The PBS submit command ['bsub']") | |||
|
1011 | delete_command = List(['bkill'], config=True, | |||
|
1012 | help="The PBS delete command ['bkill']") | |||
|
1013 | job_id_regexp = Unicode(r'\d+', config=True, | |||
|
1014 | help="Regular expresion for identifying the job ID [r'\d+']") | |||
|
1015 | ||||
|
1016 | batch_file = Unicode(u'') | |||
|
1017 | job_array_regexp = Unicode('#BSUB[ \t]-J+\w+\[\d+-\d+\]') | |||
|
1018 | job_array_template = Unicode('#BSUB -J ipengine[1-{n}]') | |||
|
1019 | queue_regexp = Unicode('#BSUB[ \t]+-q[ \t]+\w+') | |||
|
1020 | queue_template = Unicode('#BSUB -q {queue}') | |||
|
1021 | ||||
|
1022 | def start(self, n, profile_dir): | |||
|
1023 | """Start n copies of the process using LSF batch system. | |||
|
1024 | This cant inherit from the base class because bsub expects | |||
|
1025 | to be piped a shell script in order to honor the #BSUB directives : | |||
|
1026 | bsub < script | |||
|
1027 | """ | |||
|
1028 | # Here we save profile_dir in the context so they | |||
|
1029 | # can be used in the batch script template as {profile_dir} | |||
|
1030 | self.context['profile_dir'] = profile_dir | |||
|
1031 | self.profile_dir = unicode(profile_dir) | |||
|
1032 | self.write_batch_script(n) | |||
|
1033 | #output = check_output(self.args, env=os.environ) | |||
|
1034 | piped_cmd = self.args[0]+'<\"'+self.args[1]+'\"' | |||
|
1035 | p = Popen(piped_cmd, shell=True,env=os.environ,stdout=PIPE) | |||
|
1036 | output,err = p.communicate() | |||
|
1037 | job_id = self.parse_job_id(output) | |||
|
1038 | self.notify_start(job_id) | |||
|
1039 | return job_id | |||
|
1040 | ||||
|
1041 | ||||
|
1042 | class LSFControllerLauncher(LSFLauncher): | |||
|
1043 | """Launch a controller using LSF.""" | |||
|
1044 | ||||
|
1045 | batch_file_name = Unicode(u'lsf_controller', config=True, | |||
|
1046 | help="batch file name for the controller job.") | |||
|
1047 | default_template= Unicode("""#!/bin/sh | |||
|
1048 | #BSUB -J ipcontroller | |||
|
1049 | #BSUB -oo ipcontroller.o.%%J | |||
|
1050 | #BSUB -eo ipcontroller.e.%%J | |||
|
1051 | %s --log-to-file --profile-dir={profile_dir} | |||
|
1052 | """%(' '.join(ipcontroller_cmd_argv))) | |||
|
1053 | ||||
|
1054 | def start(self, profile_dir): | |||
|
1055 | """Start the controller by profile or profile_dir.""" | |||
|
1056 | self.log.info("Starting LSFControllerLauncher: %r" % self.args) | |||
|
1057 | return super(LSFControllerLauncher, self).start(1, profile_dir) | |||
|
1058 | ||||
|
1059 | ||||
|
1060 | class LSFEngineSetLauncher(LSFLauncher): | |||
|
1061 | """Launch Engines using LSF""" | |||
|
1062 | batch_file_name = Unicode(u'lsf_engines', config=True, | |||
|
1063 | help="batch file name for the engine(s) job.") | |||
|
1064 | default_template= Unicode(u"""#!/bin/sh | |||
|
1065 | #BSUB -oo ipengine.o.%%J | |||
|
1066 | #BSUB -eo ipengine.e.%%J | |||
|
1067 | %s --profile-dir={profile_dir} | |||
|
1068 | """%(' '.join(ipengine_cmd_argv))) | |||
|
1069 | ||||
|
1070 | def start(self, n, profile_dir): | |||
|
1071 | """Start n engines by profile or profile_dir.""" | |||
|
1072 | self.log.info('Starting %i engines with LSFEngineSetLauncher: %r' % (n, self.args)) | |||
|
1073 | return super(LSFEngineSetLauncher, self).start(n, profile_dir) | |||
|
1074 | ||||
|
1075 | ||||
1004 | #----------------------------------------------------------------------------- |
|
1076 | #----------------------------------------------------------------------------- | |
1005 | # A launcher for ipcluster itself! |
|
1077 | # A launcher for ipcluster itself! | |
1006 | #----------------------------------------------------------------------------- |
|
1078 | #----------------------------------------------------------------------------- | |
@@ -1060,6 +1132,11 b' sge_launchers = [' | |||||
1060 | SGEControllerLauncher, |
|
1132 | SGEControllerLauncher, | |
1061 | SGEEngineSetLauncher, |
|
1133 | SGEEngineSetLauncher, | |
1062 | ] |
|
1134 | ] | |
|
1135 | lsf_launchers = [ | |||
|
1136 | LSFLauncher, | |||
|
1137 | LSFControllerLauncher, | |||
|
1138 | LSFEngineSetLauncher, | |||
|
1139 | ] | |||
1063 | all_launchers = local_launchers + mpi_launchers + ssh_launchers + winhpc_launchers\ |
|
1140 | all_launchers = local_launchers + mpi_launchers + ssh_launchers + winhpc_launchers\ | |
1064 | + pbs_launchers + sge_launchers |
|
1141 | + pbs_launchers + sge_launchers + lsf_launchers | |
1065 |
|
1142 |
General Comments 0
You need to be logged in to leave comments.
Login now