Skip to content

Commit

Permalink
Minor refactor: Update to version 0.9.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
maharshi95 committed Dec 4, 2023
1 parent e14ef84 commit 9245b6d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
11 changes: 6 additions & 5 deletions bin/slaunch
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
#!/usr/bin/env python

import os, sys, argparse, importlib, itertools
from typing import Any, Mapping, Iterable, Sequence, Set
import os
import sys
import argparse
import importlib
import itertools
from typing import Any, Mapping, Iterable, Sequence

from submititnow import options
from submititnow import experiment_lib
from submititnow.umiacs import handlers


sys.path.insert(0, os.getcwd())


Expand Down Expand Up @@ -139,8 +142,6 @@ if __name__ == "__main__":
)
for name, handler in handlers.profile_handlers.items():
experiment.register_profile_handler(name, handler)



slurm_params = options.get_slurm_params(args)

Expand Down
4 changes: 3 additions & 1 deletion examples/configs/gpu.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"profile": "scavenger",
"account": "scavenger",
"partition": "scavenger",
"qos": "scavenger",
"gres": "gpu:rtxa4000:1",
"mem": "16G"
}
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setuptools.setup(
name="submititnow",
version="0.9.4",
version="0.9.4.1",
author="Maharshi Gor",
author_email="[email protected]",
description="A package to make submitit easier to use",
Expand Down
9 changes: 5 additions & 4 deletions submititnow/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@

class SlurmAdditionalArgAction(argparse.Action):
"""This class is used to parse additional arguments for SLURM.
Example:
The CLI SLURM argument `--nodelist` is part of the `slurm_additional_parameters`
dict for submitit. This ArgAction class is used to parse the `--nodelist`
dict for submitit. This ArgAction class is used to parse the `--nodelist`
argument and add it to the `slurm_additional_parameters` dict, which is the
destination variable name.
"""

def __init__(self, check_func, *args, **kwargs):
"""
argparse custom action.
Expand Down Expand Up @@ -130,8 +131,8 @@ def load_slurm_config(config_filename: str) -> Dict[str, Any]:
config = json.load(f)
return {f"slurm_{k.replace('-', '_')}": v for k, v in config.items()}


def get_slurm_params(args: argparse.Namespace) -> Dict[str, Any]:

# Grabs all SLURM arguments from the parser that are explicitly set to a value
slurm_args = {
k: v for k, v in vars(args).items() if k.startswith("slurm_") and v is not None
Expand Down

0 comments on commit 9245b6d

Please sign in to comment.