|
16 | 16 | from typing import cast, Dict, List, Literal, NamedTuple, Optional, Sequence
|
17 | 17 |
|
18 | 18 | from monarch._rust_bindings.monarch_hyperactor.channel import ChannelTransport
|
19 |
| -from monarch._rust_bindings.monarch_hyperactor.config import configure |
20 | 19 |
|
21 | 20 | from monarch._src.actor.bootstrap import attach_to_workers
|
22 | 21 |
|
23 | 22 | # note: the jobs api is intended as a library so it should
|
24 | 23 | # only be importing _public_ monarch API functions.
|
25 |
| -from monarch._src.actor.host_mesh import HostMesh, this_host |
26 |
| - |
27 |
| -from typing_extensions import Self |
| 24 | +from monarch.actor import enable_transport, HostMesh, this_host |
28 | 25 |
|
29 | 26 |
|
30 | 27 | class JobState:
|
@@ -441,47 +438,14 @@ def _kill(self):
|
441 | 438 | pass
|
442 | 439 |
|
443 | 440 |
|
444 |
| -class FakeLocalLoginJob(LoginJob): |
445 |
| - """ |
446 |
| -
|
447 |
| - Fake it that we are logging in by just making a local process that runs the bootstrap. |
448 |
| - """ |
449 |
| - |
450 |
| - def __init__(self): |
451 |
| - super().__init__() |
452 |
| - configure(default_transport=ChannelTransport.Tcp) |
453 |
| - |
454 |
| - self._next_port = 12345 |
455 |
| - |
456 |
| - def _start_host(self, host: str) -> ProcessState: |
457 |
| - port = self._next_port |
458 |
| - self._next_port += 1 |
459 |
| - |
460 |
| - env = {**os.environ} |
461 |
| - if "FB_XAR_INVOKED_NAME" in os.environ: |
462 |
| - env["PYTHONPATH"] = ":".join(sys.path) |
463 |
| - addr = f"tcp://[::1]:{port}" |
464 |
| - bind_addr = f"tcp://[::1]:{port}" |
465 |
| - proc = subprocess.Popen( |
466 |
| - [ |
467 |
| - sys.executable, |
468 |
| - "-c", |
469 |
| - f'from monarch.actor import run_worker_loop_forever; run_worker_loop_forever(address={repr(bind_addr)}, ca="trust_all_connections")', |
470 |
| - ], |
471 |
| - env=env, |
472 |
| - start_new_session=True, |
473 |
| - ) |
474 |
| - return ProcessState(proc.pid, addr) |
475 |
| - |
476 |
| - |
477 | 441 | class SSHJob(LoginJob):
|
478 | 442 | def __init__(
|
479 | 443 | self,
|
480 | 444 | python_exe: str = "python",
|
481 | 445 | ssh_args: Sequence[str] = (),
|
482 | 446 | monarch_port: int = 22222,
|
483 | 447 | ):
|
484 |
| - configure(default_transport=ChannelTransport.Tcp) |
| 448 | + enable_transport("tcp") |
485 | 449 | self._python_exe = python_exe
|
486 | 450 | self._ssh_args = ssh_args
|
487 | 451 | self._port = monarch_port
|
|
0 commit comments