resource_tracker.report
#
Helper class to browser and save HTML reports.
Classes:
| Name | Description |
|---|---|
Report |
A string subclass representing an HTML report with methods to view and save it. |
Functions:
| Name | Description |
|---|---|
round_memory |
Round a number to the nearest meaningful memory amount. |
Report
#
Bases: str
A string subclass representing an HTML report with methods to view and save it.
Methods:
| Name | Description |
|---|---|
browse |
Open the report in the default web browser. |
save |
Save the report to a file. |
Source code in resource_tracker/report.py
browse
#
Open the report in the default web browser.
Creates a temporary HTML file and opens it in the default web browser.
Returns:
| Name | Type | Description |
|---|---|---|
self |
Report
|
Returns the Report object for method chaining |
Source code in resource_tracker/report.py
round_memory
#
Round a number to the nearest meaningful memory amount.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mb
|
Union[int, float]
|
The value in MB to round. |
required |
Returns:
| Type | Description |
|---|---|
int
|
The rounded value in MB as an integer. |
Example:
>>> round_memory(68)
128
>>> round_memory(896)
1024
>>> round_memory(3863)
4096