Skip to content

Commit

Permalink
Merge pull request #5 from Ciela-Institute/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
AlexandreAdam authored Jul 11, 2024
2 parents 2cbeed5 + 0a46f6e commit 0e61add
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ lint = [
milex-configuration = "milex_scheduler.apps.milex_configuration:main"
milex-submit = "milex_scheduler.apps.milex_submit:main"
milex-schedule = "milex_scheduler.apps.milex_schedule:main"
milex-initialize = "milex_scheduler.apps.milex_initialize:main"
27 changes: 27 additions & 0 deletions src/milex_scheduler/apps/milex_initialize.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import argparse
from ..save_load_jobs import save_bundle


def parse_args():
# fmt: off
parser = argparse.ArgumentParser(description='Initialize a bundle of jobs to run with SLURM')
parser.add_argument('bundle', help='Name of the job bundle (JSON file containing multiple jobs/scripts to be scheduled).')
# fmt: on
args = parser.parse_known_args()
return args


def cli():
import sys
import json

args, script_args = parse_args()
if script_args is None:
sys.exit(1)
print(json.dumps(vars(args), indent=4))
sys.exit(0)


def main():
args = parse_args()
save_bundle({}, args.bundle)
5 changes: 5 additions & 0 deletions tests/unit/test_save_load_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,11 @@ def test_save_bundle_no_script_error(mock_load_config):
save_bundle(bundle, bundle_name)


def test_save_bundle_initialize(mock_load_config):
bundle_name = "mock"
save_bundle({}, bundle_name)


def test_save_job_with_same_name_in_append_mode(mock_load_config):
# Check that new bundle is created with an index appended
mock_jobA = {"name": "JobA", "script": "run-joba"}
Expand Down

0 comments on commit 0e61add

Please sign in to comment.