Skip to content

Commit

Permalink
docs: example job name config formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
YodaEmbedding committed Mar 8, 2024
1 parent ef2c2f7 commit f31e6d2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
8 changes: 7 additions & 1 deletion examples/simple/submit_job.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import yaml

import easy_slurm

with open("assets/hparams.yaml") as f:
config = yaml.safe_load(f)

easy_slurm.submit_job(
job_dir="$HOME/.local/share/easy_slurm/{date}-{job_name}",
src=["./src", "./assets"],
Expand All @@ -23,12 +28,13 @@
# Do any cleanup tasks here.
""",
sbatch_options={
"job-name": "example-simple",
"job-name": "example-simple-epochs={hp.epochs}",
"account": "def-ibajic",
"time": "0:03:00",
"nodes": "1",
"ntasks-per-node": "1",
"cpus-per-task": "1",
"mem": "4000M",
},
config=config,
)
3 changes: 2 additions & 1 deletion examples/simple_yaml/job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ on_run_resume: "cd src && python main.py --resume"
teardown: |
# Do any cleanup tasks here.
sbatch_options:
job-name: "example-simple"
job-name: "example-simple-epochs={hp.epochs}"
account: "def-ibajic"
time: "0:03:00"
nodes: 1
ntasks-per-node: 1
cpus-per-task: 1
mem: "4000M"
# config: {} # Loaded from assets/hparams.yaml.
6 changes: 5 additions & 1 deletion examples/simple_yaml/submit_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ def main():
with open("job.yaml") as f:
job_config = yaml.safe_load(f)

easy_slurm.submit_job(**job_config)
# Optional: Load config for easy job name formatting.
with open("assets/hparams.yaml") as f:
config = yaml.safe_load(f)

easy_slurm.submit_job(**job_config, config=config)


if __name__ == "__main__":
Expand Down

0 comments on commit f31e6d2

Please sign in to comment.