MCPcopy Create free account
hub / github.com/It4innovations/hyperqueue / submit

Function submit

benchmarks/src/submit/submit.py:77–114  ·  view source on GitHub ↗
(
    identifiers: List[BenchmarkIdentifier],
    workdir: Path,
    options: PBSSubmitOptions,
    database_path: Optional[Path] = None,
    resubmit=False,
)

Source from the content-addressed store, hash-verified

75
76
77def submit(
78 identifiers: List[BenchmarkIdentifier],
79 workdir: Path,
80 options: PBSSubmitOptions,
81 database_path: Optional[Path] = None,
82 resubmit=False,
83) -> str:
84 workdir = Path(workdir).absolute()
85 workdir.mkdir(parents=True, exist_ok=True)
86
87 identifiers_path = workdir / "benchmarks.json"
88 serialize_identifiers(identifiers, identifiers_path)
89
90 submit_options_path = workdir / "submit-options.json"
91 serialize_submit_options(options, submit_options_path)
92
93 header = create_submit_script_header(workdir, options)
94 script_body = create_submit_script_body(
95 header,
96 options,
97 identifiers_path,
98 submit_options_path,
99 workdir,
100 database_path=database_path,
101 resubmit=resubmit,
102 )
103
104 script_path = workdir / "submit.sh"
105 with open(script_path, "w") as f:
106 f.write(script_body)
107
108 logging.info(f"Submitting PBS script: {script_path}")
109 logging.debug(f"Script body: {script_body}")
110 result = subprocess.run(["qsub", script_path], stdout=subprocess.PIPE, check=True)
111 job_id = result.stdout.decode().strip()
112 logging.info(f"Job id: {job_id}")
113
114 return job_id
115
116
117def watch_pbs(job_id: str):

Callers 1

executeFunction · 0.90

Calls 6

serialize_identifiersFunction · 0.85
serialize_submit_optionsFunction · 0.85
infoMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected