Skip to content

Commit 987ee72

Browse files
jasonsewalltazend
authored andcommitted
Fix syntax error in f-string in submission.pyx (#390)
Causes build errors starting with Cython 3.2.0
1 parent 8b195d9 commit 987ee72

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

pyslurm/core/job/submission.pyx

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ from pyslurm.utils.ctime import (
4343
)
4444
from pyslurm.utils.helpers import (
4545
humanize,
46-
dehumanize,
46+
dehumanize,
4747
signal_to_num,
4848
user_to_uid,
4949
group_to_gid,
@@ -92,7 +92,7 @@ cdef class JobSubmitDescription:
9292
... cpus_per_task=1,
9393
... time_limit="10-00:00:00",
9494
... script="/path/to/your/submit_script.sh")
95-
>>>
95+
>>>
9696
>>> job_id = desc.submit()
9797
>>> print(job_id)
9898
99
@@ -117,7 +117,7 @@ cdef class JobSubmitDescription:
117117
attributes.
118118
119119
Args:
120-
overwrite (bool):
120+
overwrite (bool):
121121
If set to `True`, the value from an option found in the
122122
environment will override the current value of the attribute
123123
in this instance. Default is `False`
@@ -166,9 +166,9 @@ cdef class JobSubmitDescription:
166166
# Arguments directly specified upon object creation will
167167
# always have precedence.
168168
continue
169-
170-
spec = attr.upper()
171-
val = pyenviron.get(f"PYSLURM_JOBDESC_{spec)}")
169+
170+
spec = attr.upper()
171+
val = pyenviron.get(f"PYSLURM_JOBDESC_{spec}")
172172
if (val is not None
173173
and (getattr(self, attr) is None or overwrite)):
174174

@@ -225,7 +225,7 @@ cdef class JobSubmitDescription:
225225
cstr.from_gres_dict(self.gpus_per_task, "gpu"))
226226
cstr.fmalloc(&ptr.tres_per_node,
227227
cstr.from_gres_dict(self.gres_per_node))
228-
cstr.fmalloc(&ptr.cpus_per_tres,
228+
cstr.fmalloc(&ptr.cpus_per_tres,
229229
cstr.from_gres_dict(self.cpus_per_gpu, "gpu"))
230230
cstr.fmalloc(&ptr.admin_comment, self.admin_comment)
231231
cstr.fmalloc(&self.ptr.dependency,
@@ -256,7 +256,7 @@ cdef class JobSubmitDescription:
256256
u64_set_bool_flag(&ptr.bitflags, self.spreads_over_nodes,
257257
slurm.SPREAD_JOB)
258258
u64_set_bool_flag(&ptr.bitflags, self.kill_on_invalid_dependency,
259-
slurm.KILL_INV_DEP)
259+
slurm.KILL_INV_DEP)
260260
u64_set_bool_flag(&ptr.bitflags, self.use_min_nodes,
261261
slurm.USE_MIN_NODES)
262262
ptr.contiguous = u16_bool(self.requires_contiguous_nodes)
@@ -333,7 +333,7 @@ cdef class JobSubmitDescription:
333333
and self.threads_reserved_for_system):
334334
raise ValueError("cores_reserved_for_system is mutually "
335335
" exclusive with threads_reserved_for_system.")
336-
336+
337337
def _set_core_spec(self):
338338
if self.cores_reserved_for_system:
339339
self.ptr.core_spec = u16(self.cores_reserved_for_system)
@@ -354,13 +354,13 @@ cdef class JobSubmitDescription:
354354
self.ptr.cpu_freq_min = freq_min
355355
self.ptr.cpu_freq_max = freq_max
356356
self.ptr.cpu_freq_gov = freq_gov
357-
357+
358358
def _set_memory(self):
359359
if self.memory_per_cpu:
360-
self.ptr.pn_min_memory = u64(dehumanize(self.memory_per_cpu))
360+
self.ptr.pn_min_memory = u64(dehumanize(self.memory_per_cpu))
361361
self.ptr.pn_min_memory |= slurm.MEM_PER_CPU
362362
elif self.memory_per_node:
363-
self.ptr.pn_min_memory = u64(dehumanize(self.memory_per_node))
363+
self.ptr.pn_min_memory = u64(dehumanize(self.memory_per_node))
364364
elif self.memory_per_gpu:
365365
mem_gpu = u64(dehumanize(val))
366366
cstr.fmalloc(&self.ptr.mem_per_tres, f"gres:gpu:{mem_gpu}")
@@ -436,7 +436,7 @@ cdef class JobSubmitDescription:
436436
if not "=" in item:
437437
continue
438438

439-
var, val = item.split("=", 1)
439+
var, val = item.split("=", 1)
440440
slurm_env_array_overwrite(&self.ptr.environment,
441441
var, str(val))
442442
get_user_env = True
@@ -449,7 +449,7 @@ cdef class JobSubmitDescription:
449449
var, str(val))
450450

451451
# Setup all User selected env vars.
452-
for var, val in vals.items():
452+
for var, val in vals.items():
453453
slurm_env_array_overwrite(&self.ptr.environment,
454454
var, str(val))
455455

@@ -470,7 +470,7 @@ cdef class JobSubmitDescription:
470470

471471
if isinstance(self.distribution, int):
472472
# Assume the user meant to specify the plane size only.
473-
plane = u16(self.distribution)
473+
plane = u16(self.distribution)
474474
elif isinstance(self.distribution, str):
475475
# Support sbatch style string input
476476
dist = TaskDistribution.from_str(self.distribution)
@@ -495,7 +495,7 @@ cdef class JobSubmitDescription:
495495
if "verbose" in self.gpu_binding:
496496
binding = f"verbose,gpu:{binding}"
497497

498-
cstr.fmalloc(&self.ptr.tres_bind, binding)
498+
cstr.fmalloc(&self.ptr.tres_bind, binding)
499499

500500
def _set_min_cpus(self):
501501
if self.min_cpus_per_node:
@@ -568,7 +568,7 @@ def _parse_dependencies(val):
568568
if not isinstance(vals, list):
569569
vals = str(vals).split(",")
570570

571-
vals = [str(s) for s in vals]
571+
vals = [str(s) for s in vals]
572572
final.append(f"{condition}:{':'.join(vals)}")
573573

574574
final = delim.join(final)
@@ -630,7 +630,7 @@ def _parse_switches_str_to_dict(switches_str):
630630
vals = str(switches_str.split("@"))
631631
if len(vals) > 1:
632632
out["max_wait_time"] = timestr_to_secs(vals[1])
633-
633+
634634
out["count"] = u32(vals[0])
635635

636636
return out
@@ -694,7 +694,7 @@ def _validate_cpu_freq(freq):
694694
def _validate_batch_script(script, args=None):
695695
if Path(script).is_file():
696696
# First assume the caller is passing a path to a script and we try
697-
# to load it.
697+
# to load it.
698698
script = Path(script).read_text()
699699
else:
700700
if args:

0 commit comments

Comments
 (0)