Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Fix elapsed runtime format #1366

Merged
merged 2 commits into from
Jan 13, 2025

Conversation

jhlegarreta
Copy link
Contributor

Fix elapsed runtime format: the strftime function %H format specifier only supports 0–23 hours (for a single day), thus, when the time exceeds 24 hours, the hours component resets to 0.

This patch set computes the elapsed time (per participant and for the entire run), builds a datetime.timedelta instance and formats the elapsed time following the %Hh %Mmin %Ss formatting using a function created for that purpose.

Do not call time.gmtime as when reporting the elapsed time we are not interested in the UTC time format.

@jhlegarreta jhlegarreta force-pushed the FixElapsedRuntimeFormat branch from 1cc485e to 1fedf9f Compare January 4, 2025 00:24
@jhlegarreta
Copy link
Contributor Author

As an example, for a dataset that took slightly over 24 hours to run, the current implementation showed:

----------------------------------------------------------------
  MRIQC completed (elapsed time 00h 06min 11s).
----------------------------------------------------------------

instead of

----------------------------------------------------------------
  MRIQC completed (elapsed time 24h 06min 11s).
----------------------------------------------------------------

Fix elapsed runtime format: the `strftime` function `%H` format
specifier only supports 0–23 hours (for a single day), thus, when the
time exceeds 24 hours, the hours component resets to 0.

This patch set computes the elapsed time (per participant and for the
entire run), builds a `datetime.timedelta` instance and formats the
elapsed time following the `%Hh %Mmin %Ss` formatting using a function
created for that purpose.

Do not call `time.gmtime` as when reporting the elapsed time we are not
interested in the UTC time format.
@jhlegarreta jhlegarreta force-pushed the FixElapsedRuntimeFormat branch from 1fedf9f to 804b055 Compare January 12, 2025 21:26
@jhlegarreta
Copy link
Contributor Author

Sorry to tag you once again @effigies @mgxd @oesteban. This is ready for review/merging: the ruff failures are addressed in 81db00c PR#1369.

@oesteban oesteban merged commit 653ec69 into nipreps:master Jan 13, 2025
11 of 14 checks passed
@jhlegarreta jhlegarreta deleted the FixElapsedRuntimeFormat branch January 13, 2025 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants