Skip to content

Commit b31fb8d

Browse files
committed
timedelta.total_seconds() returns a float and float // int -> float.
So fix instances where an int is expected in walltimes but `total_seconds()` is used.
1 parent 4e86a17 commit b31fb8d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/psij/executors/batch/batch_scheduler_executor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ def _create_script_context(self, job: Job) -> Dict[str, object]:
497497
def _format_duration(self, d: timedelta) -> str:
498498
# the default is hh:mm:ss, with hh not limited to 24; this is the least ambiguous
499499
# choice
500-
return '%s:%s:%s' % (d.total_seconds() // 3600, (d.seconds // 60) % 60, d.seconds % 60)
500+
return '%s:%s:%s' % (int(d.total_seconds()) // 3600, (d.seconds // 60) % 60, d.seconds % 60)
501501

502502
def _run_command(self, cmd: List[str]) -> str:
503503
res = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)

src/psij/executors/batch/lsf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,4 @@ def get_list_command(self) -> List[str]:
141141
def _format_duration(self, d: timedelta) -> str:
142142
# https://www.ibm.com/docs/en/spectrum-lsf/10.1.0?topic=o-w-1:
143143
# bsub -W [hour:]minute[/host_name | /host_model]
144-
return "%s:%s" % (d.total_seconds() // 3600, (d.seconds // 60) % 60)
144+
return "%s:%s" % (int(d.total_seconds()) // 3600, (d.seconds // 60) % 60)

0 commit comments

Comments
 (0)