Show More
@@ -83,24 +83,6 b' ipengine_cmd_argv = [sys.executable, "-c", cmd % "ipengineapp"]' | |||||
83 |
|
83 | |||
84 | ipcontroller_cmd_argv = [sys.executable, "-c", cmd % "ipcontrollerapp"] |
|
84 | ipcontroller_cmd_argv = [sys.executable, "-c", cmd % "ipcontrollerapp"] | |
85 |
|
85 | |||
86 | # HTCondor frustratingly destroys sys.executable when launching remote processes |
|
|||
87 | # thus Python will default back to the system module search paths which is |
|
|||
88 | # ridiculously fragile (not to mention destructive for virutalenvs). |
|
|||
89 | # however, if we use the ip{cluster, engine, controller} scripts as our |
|
|||
90 | # executable we circumvent this - the mechanism of shebanged scripts means that |
|
|||
91 | # the python binary will be launched with argv[0] set correctly. |
|
|||
92 | # This does mean that for HTCondor we require that: |
|
|||
93 | # a. The python interpreter you are using is in a folder next to the ipengine, |
|
|||
94 | # ipcluster and ipcontroller scripts |
|
|||
95 | # b. I have no idea what the consequences are for Windows. |
|
|||
96 | bin_dir = os.path.dirname(sys.executable) |
|
|||
97 |
|
||||
98 | condor_ipcluster_cmd_argv = os.path.join(bin_dir, 'ipcluster') |
|
|||
99 |
|
||||
100 | condor_ipengine_cmd_argv = os.path.join(bin_dir, 'ipengine') |
|
|||
101 |
|
||||
102 | condor_ipcontroller_cmd_argv = os.path.join(bin_dir, 'ipcontroller') |
|
|||
103 |
|
||||
104 | #----------------------------------------------------------------------------- |
|
86 | #----------------------------------------------------------------------------- | |
105 | # Base launchers and errors |
|
87 | # Base launchers and errors | |
106 | #----------------------------------------------------------------------------- |
|
88 | #----------------------------------------------------------------------------- | |
@@ -1302,11 +1284,27 b' class LSFEngineSetLauncher(LSFLauncher, BatchClusterAppMixin):' | |||||
1302 | """%(' '.join(map(pipes.quote, ipengine_cmd_argv)))) |
|
1284 | """%(' '.join(map(pipes.quote, ipengine_cmd_argv)))) | |
1303 |
|
1285 | |||
1304 |
|
1286 | |||
1305 | # Condor Requires that we launch the ipengine/ipcontroller scripts rather |
|
|||
1306 | # that the python instance but otherwise is very similar to PBS |
|
|||
1307 |
|
1287 | |||
1308 | class CondorLauncher(BatchSystemLauncher): |
|
1288 | class CondorLauncher(BatchSystemLauncher): | |
1309 |
"""A BatchSystemLauncher subclass for Condor. |
|
1289 | """A BatchSystemLauncher subclass for Condor. | |
|
1290 | ||||
|
1291 | Condor requires that we launch the ipengine/ipcontroller scripts rather | |||
|
1292 | that the python instance but otherwise is very similar to PBS. This is because | |||
|
1293 | HTCondor destroys sys.executable when launching remote processes - a launched | |||
|
1294 | python process depends on sys.executable to effectively evaluate its | |||
|
1295 | module search paths. Without it, regardless of which python interpreter you launch | |||
|
1296 | you will get the to built in module search paths. | |||
|
1297 | ||||
|
1298 | We use the ip{cluster, engine, controller} scripts as our executable to circumvent | |||
|
1299 | this - the mechanism of shebanged scripts means that the python binary will be | |||
|
1300 | launched with argv[0] set to the *location of the ip{cluster, engine, controller} | |||
|
1301 | scripts on the remote node*. This means that: | |||
|
1302 | a. The default path to ipengine etc scripts on your remote node needs to be | |||
|
1303 | in the same directory as the python executable you wish to run | |||
|
1304 | b. This functionality is untested on Windows. | |||
|
1305 | ||||
|
1306 | If you need different behavior, consider making you own template. | |||
|
1307 | """ | |||
1310 |
|
1308 | |||
1311 | submit_command = List(['condor_submit'], config=True, |
|
1309 | submit_command = List(['condor_submit'], config=True, | |
1312 | help="The Condor submit command ['condor_submit']") |
|
1310 | help="The Condor submit command ['condor_submit']") | |
@@ -1344,11 +1342,11 b' class CondorControllerLauncher(CondorLauncher, BatchClusterAppMixin):' | |||||
1344 | help="batch file name for the controller job.") |
|
1342 | help="batch file name for the controller job.") | |
1345 | default_template = Unicode(r""" |
|
1343 | default_template = Unicode(r""" | |
1346 | universe = vanilla |
|
1344 | universe = vanilla | |
1347 |
executable = |
|
1345 | executable = ipcontroller | |
1348 | # by default we expect a shared file system |
|
1346 | # by default we expect a shared file system | |
1349 | transfer_executable = False |
|
1347 | transfer_executable = False | |
1350 | arguments = --log-to-file '--profile-dir={profile_dir}' --cluster-id='{cluster_id}' |
|
1348 | arguments = --log-to-file '--profile-dir={profile_dir}' --cluster-id='{cluster_id}' | |
1351 | """ % condor_ipcontroller_cmd_argv) |
|
1349 | """) | |
1352 |
|
1350 | |||
1353 | def start(self): |
|
1351 | def start(self): | |
1354 | """Start the controller by profile or profile_dir.""" |
|
1352 | """Start the controller by profile or profile_dir.""" | |
@@ -1361,11 +1359,11 b' class CondorEngineSetLauncher(CondorLauncher, BatchClusterAppMixin):' | |||||
1361 | help="batch file name for the engine(s) job.") |
|
1359 | help="batch file name for the engine(s) job.") | |
1362 | default_template = Unicode(""" |
|
1360 | default_template = Unicode(""" | |
1363 | universe = vanilla |
|
1361 | universe = vanilla | |
1364 |
executable = |
|
1362 | executable = ipengine | |
1365 | # by default we expect a shared file system |
|
1363 | # by default we expect a shared file system | |
1366 | transfer_executable = False |
|
1364 | transfer_executable = False | |
1367 | arguments = "--log-to-file '--profile-dir={profile_dir}' '--cluster-id={cluster_id}'" |
|
1365 | arguments = "--log-to-file '--profile-dir={profile_dir}' '--cluster-id={cluster_id}'" | |
1368 | """ % condor_ipengine_cmd_argv) |
|
1366 | """) | |
1369 |
|
1367 | |||
1370 |
|
1368 | |||
1371 | #----------------------------------------------------------------------------- |
|
1369 | #----------------------------------------------------------------------------- |
General Comments 0
You need to be logged in to leave comments.
Login now