Skip to content

Issue in calculation of elapsed_hours in the usage reports #197

@bevalentin

Description

@bevalentin

Hi,

Due to this function, when elapsed_seconds is 0, elapsed_hours is None:

    def elapsed_hours(self):
        elapsed_seconds = self.elapsed_seconds()
        if elapsed_seconds:
            return elapsed_seconds / SECONDS_PER_HOUR
        else:
            return None

And when elapsed_hours is None, ram_megabyte_hours and cpu_hours are None too (due to these functions).

In such a usage report, the null value should be zeros:

      {
        "cpus": 1,
        "name": "ruff_step",
        "cpu_hours": null,
        "exit_code": 0,
        "start_time": "2025-07-04T11:39:28+00:00",
        "finish_time": "2025-07-04T11:39:28+00:00",
        "elapsed_hours": null,
        "ram_megabytes": 268.435456,
        "disk_megabytes": 0.003581,
        "elapsed_seconds": 0,
        "ram_megabyte_hours": null
      },

Kind Regards,

Bernard

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions