Skip to content

Commit 78ad46a

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 b97900e commit 78ad46a

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
@@ -999,6 +999,7 @@ class CondorSpawner(UserEnvMixin, BatchSpawnerRegexStates):
999999
'condor_q {job_id} -format "%s, " JobStatus -format "%s" RemoteHost -format "\n" True'
10001000
).tag(config=True)
10011001
batch_cancel_cmd = Unicode("condor_rm {job_id}").tag(config=True)
1002+
connect_to_job_cmd = Unicode("condor_ssh_to_job -ssh \"ssh -L {port}:localhost:{port} -oExitOnForwardFailure=yes\" {job_id}").tag(config=True)
10021003
# job status: 1 = pending, 2 = running
10031004
state_pending_re = Unicode(r"^1,").tag(config=True)
10041005
state_running_re = Unicode(r"^2,").tag(config=True)
@@ -1021,6 +1022,9 @@ def cmd_formatted_for_batch(self):
10211022
.replace("'", "''")
10221023
)
10231024

1025+
def state_gethost(self):
1026+
"""This always returns localhost since connect_to_job forwards the singleuser server port from the spawned job"""
1027+
return "localhost"
10241028

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

0 commit comments

Comments
 (0)