Skip to content

Commit 8f46940

Browse files
committed
batchspawner/CondorSpawner: Make use of connect_to_job feature.
This leverages condor_ssh_to_job to forward the port of the single user server to the hub, removing the need for direct connectivity from the hub to the execute nodes.
1 parent acd5ef9 commit 8f46940

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

batchspawner/batchspawner.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,7 @@ class CondorSpawner(UserEnvMixin,BatchSpawnerRegexStates):
886886
# outputs job data XML string
887887
batch_query_cmd = Unicode('condor_q {job_id} -format "%s, " JobStatus -format "%s" RemoteHost -format "\n" True').tag(config=True)
888888
batch_cancel_cmd = Unicode('condor_rm {job_id}').tag(config=True)
889+
connect_to_job_cmd = Unicode("condor_ssh_to_job -ssh \"ssh -L {port}:localhost:{port} -oExitOnForwardFailure=yes\" {job_id}").tag(config=True)
889890
# job status: 1 = pending, 2 = running
890891
state_pending_re = Unicode(r'^1,').tag(config=True)
891892
state_running_re = Unicode(r'^2,').tag(config=True)
@@ -903,6 +904,9 @@ def parse_job_id(self, output):
903904
def cmd_formatted_for_batch(self):
904905
return super(CondorSpawner,self).cmd_formatted_for_batch().replace('"','""').replace("'","''")
905906

907+
def state_gethost(self):
908+
"""This always returns localhost since connect_to_job forwards the singleuser server port from the spawned job"""
909+
return "localhost"
906910

907911
class LsfSpawner(BatchSpawnerBase):
908912
'''A Spawner that uses IBM's Platform Load Sharing Facility (LSF) to launch notebooks.'''

0 commit comments

Comments
 (0)