Skip to content

Commit 5398cc2

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 80f1569 commit 5398cc2

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
@@ -893,6 +893,7 @@ class CondorSpawner(UserEnvMixin,BatchSpawnerRegexStates):
893893
# outputs job data XML string
894894
batch_query_cmd = Unicode('condor_q {job_id} -format "%s, " JobStatus -format "%s" RemoteHost -format "\n" True').tag(config=True)
895895
batch_cancel_cmd = Unicode('condor_rm {job_id}').tag(config=True)
896+
connect_to_job_cmd = Unicode("condor_ssh_to_job -ssh \"ssh -L {port}:localhost:{port} -oExitOnForwardFailure=yes\" {job_id}").tag(config=True)
896897
# job status: 1 = pending, 2 = running
897898
state_pending_re = Unicode(r'^1,').tag(config=True)
898899
state_running_re = Unicode(r'^2,').tag(config=True)
@@ -910,6 +911,9 @@ def parse_job_id(self, output):
910911
def cmd_formatted_for_batch(self):
911912
return super(CondorSpawner,self).cmd_formatted_for_batch().replace('"','""').replace("'","''")
912913

914+
def state_gethost(self):
915+
"""This always returns localhost since connect_to_job forwards the singleuser server port from the spawned job"""
916+
return "localhost"
913917

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

0 commit comments

Comments
 (0)