Skip to content

Commit

Permalink
job-submit: now actually call some previously unused functions... (#343)
Browse files Browse the repository at this point in the history
  • Loading branch information
tazend committed Jul 6, 2024
1 parent b20ff49 commit fdd2fac
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
7 changes: 5 additions & 2 deletions pyslurm/core/job/submission.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,9 @@ cdef class JobSubmitDescription:
self._set_gpu_binding()
self._set_gres_binding()
self._set_min_cpus()
self._set_core_spec()
self._set_signal()
self._set_switches()

# TODO
# burst_buffer
Expand Down Expand Up @@ -522,7 +525,7 @@ cdef class JobSubmitDescription:
if not isinstance(vals, dict):
vals = _parse_signal_str_to_dict(vals)

self.ptr.warn_signal = u16(signal_to_num(vals.get("signal")))
self.ptr.warn_signal = u16(vals.get("signal"))
self.ptr.warn_time = u16(vals.get("time"), on_noval=60)
u16_set_bool_flag(&self.ptr.warn_flags,
bool(vals.get("batch_only")), slurm.KILL_JOB_BATCH)
Expand Down Expand Up @@ -617,7 +620,7 @@ def _parse_signal_str_to_dict(vals):
if "@" in str(vals):
info["time"] = val_list[1]

info["signal"] = val_list[0]
info["signal"] = signal_to_num(val_list[0])

return info

Expand Down
13 changes: 10 additions & 3 deletions tests/unit/test_job_submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,18 +238,25 @@ def test_validate_cpus():
def test_parse_signal():
signal = 7
signal_dict = _parse_signal_str_to_dict(signal)
assert signal_dict["signal"] == "7"
assert signal_dict["signal"] == 7
assert len(signal_dict) == 1

signal = "7@120"
signal_dict = _parse_signal_str_to_dict(signal)
assert signal_dict["signal"] == "7"
assert signal_dict["signal"] == 7
assert signal_dict["time"] == "120"
assert len(signal_dict) == 2

signal = "B:SIGUSR2@60"
signal_dict = _parse_signal_str_to_dict(signal)
assert signal_dict["signal"] == 12
assert signal_dict["time"] == "60"
assert signal_dict["batch_only"]
assert len(signal_dict) == 3

signal = "RB:8@180"
signal_dict = _parse_signal_str_to_dict(signal)
assert signal_dict["signal"] == "8"
assert signal_dict["signal"] == 8
assert signal_dict["time"] == "180"
assert signal_dict["batch_only"]
assert signal_dict["allow_reservation_overlap"]
Expand Down

0 comments on commit fdd2fac

Please sign in to comment.