Skip to content

Commit 617b1ab

Browse files
authored
torchx - expose scheduler opts to scheduler validate function interface
Differential Revision: D67032224 Pull Request resolved: #989
1 parent edc0531 commit 617b1ab

14 files changed

+31
-19
lines changed

torchx/runner/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ def dryrun(
433433
" Either a patch was built or no changes to workspace was detected."
434434
)
435435

436-
sched._validate(app, scheduler)
436+
sched._validate(app, scheduler, resolved_cfg)
437437
dryrun_info = sched.submit_dryrun(app, resolved_cfg)
438438
dryrun_info._scheduler = scheduler
439439
return dryrun_info

torchx/schedulers/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ def log_iter(
337337
f"{self.__class__.__qualname__} does not support application log iteration"
338338
)
339339

340-
def _validate(self, app: AppDef, scheduler: str) -> None:
340+
def _validate(self, app: AppDef, scheduler: str, cfg: T) -> None:
341341
"""
342342
Validates whether application is consistent with the scheduler.
343343

torchx/schedulers/docker_scheduler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ def _submit_dryrun(self, app: AppDef, cfg: DockerOpts) -> AppDryRunInfo[DockerJo
327327

328328
return AppDryRunInfo(req, repr)
329329

330-
def _validate(self, app: AppDef, scheduler: str) -> None:
330+
def _validate(self, app: AppDef, scheduler: str, cfg: DockerOpts) -> None:
331331
# Skip validation step
332332
pass
333333

torchx/schedulers/gcp_batch_scheduler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ def list(self) -> List[ListAppResponse]:
464464
for job in all_jobs
465465
]
466466

467-
def _validate(self, app: AppDef, scheduler: str) -> None:
467+
def _validate(self, app: AppDef, scheduler: str, cfg: GCPBatchOpts) -> None:
468468
# Skip validation step
469469
pass
470470

torchx/schedulers/kubernetes_mcad_scheduler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,7 @@ def _submit_dryrun(
10331033
info._cfg = cfg
10341034
return info
10351035

1036-
def _validate(self, app: AppDef, scheduler: str) -> None:
1036+
def _validate(self, app: AppDef, scheduler: str, cfg: KubernetesMCADOpts) -> None:
10371037
# Skip validation step
10381038
pass
10391039

torchx/schedulers/kubernetes_scheduler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ def _submit_dryrun(
661661
)
662662
return AppDryRunInfo(req, repr)
663663

664-
def _validate(self, app: AppDef, scheduler: str) -> None:
664+
def _validate(self, app: AppDef, scheduler: str, cfg: KubernetesOpts) -> None:
665665
# Skip validation step
666666
pass
667667

torchx/schedulers/local_scheduler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ def _run_opts(self) -> runopts:
630630
)
631631
return opts
632632

633-
def _validate(self, app: AppDef, scheduler: str) -> None:
633+
def _validate(self, app: AppDef, scheduler: str, cfg: LocalOpts) -> None:
634634
# Skip validation step for local application
635635
pass
636636

torchx/schedulers/lsf_scheduler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ def schedule(self, dryrun_info: AppDryRunInfo[LsfBsub]) -> str:
488488
subprocess.run(req.cmd, stdout=subprocess.PIPE, check=True)
489489
return req.app_id
490490

491-
def _validate(self, app: AppDef, scheduler: str) -> None:
491+
def _validate(self, app: AppDef, scheduler: str, cfg: LsfOpts) -> None:
492492
# Skip validation step for lsf
493493
pass
494494

torchx/schedulers/ray_scheduler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ def _submit_dryrun(self, app: AppDef, cfg: RayOpts) -> AppDryRunInfo[RayJob]:
318318

319319
return AppDryRunInfo(job, repr)
320320

321-
def _validate(self, app: AppDef, scheduler: str) -> None:
321+
def _validate(self, app: AppDef, scheduler: str, cfg: RayOpts) -> None:
322322
if scheduler != "ray":
323323
raise ValueError(
324324
f"An unknown scheduler backend '{scheduler}' has been passed to the Ray scheduler."

torchx/schedulers/slurm_scheduler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ def _submit_dryrun(
472472

473473
return AppDryRunInfo(req, repr)
474474

475-
def _validate(self, app: AppDef, scheduler: str) -> None:
475+
def _validate(self, app: AppDef, scheduler: str, cfg: SlurmOpts) -> None:
476476
# Skip validation step for slurm
477477
pass
478478

0 commit comments

Comments
 (0)