Skip to content

Commit

Permalink
add error when submitting job from srun/slurm (#1038)
Browse files Browse the repository at this point in the history
* add error when submitting from srun

* assert instead of exit
  • Loading branch information
misko authored Feb 28, 2025
1 parent f57ec7e commit ab9f004
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/fairchem/core/_cli_hydra.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class JobConfig:
runner_state_path: Optional[str] = None # noqa: UP007
# read-only metadata about the job, not user inputs
metadata: Optional[Metadata] = None # noqa: UP007
graph_parallel_group_size: Optional[int] = None # noqa: UP007 python 3.9 requires Optional still
graph_parallel_group_size: Optional[int] = None # noqa: UP007

def __post_init__(self) -> None:
self.metadata = Metadata(
Expand Down Expand Up @@ -304,6 +304,9 @@ def main(
scheduler_cfg = cfg.job.scheduler
logging.info(f"Running fairchemv2 cli with {cfg}")
if scheduler_cfg.mode == SchedulerType.SLURM: # Run on cluster
assert (
os.getenv("SLURM_SUBMIT_HOST") is None
), "SLURM DID NOT SUBMIT JOB!! Please do not submit jobs from an active slurm job (srun or otherwise)"
executor = AutoExecutor(folder=log_dir, slurm_max_num_timeout=3)
executor.update_parameters(
name=cfg.job.run_name,
Expand Down

0 comments on commit ab9f004

Please sign in to comment.