utils
pyslurm.utils
pyslurm utility functions
pyslurm.utils.timestr_to_secs(timestr)
method descriptor
pyslurm.utils.timestr_to_mins(timestr)
method descriptor
pyslurm.utils.secs_to_timestr(secs, default=None)
method descriptor
pyslurm.utils.mins_to_timestr(mins, default=None)
method descriptor
pyslurm.utils.date_to_timestamp(date, on_nodate=0)
method descriptor
pyslurm.utils.timestamp_to_date(timestamp)
method descriptor
pyslurm.utils.expand_range_str(range_str)
method descriptor
pyslurm.utils.humanize(num, decimals=1)
method descriptor
Humanize a number.
This will convert the number to a string and add appropriate suffixes like M,G,T,P,...
Parameters:
Name | Type | Description | Default |
---|---|---|---|
num
|
int
|
Number to humanize |
required |
decimals
|
int
|
Amount of decimals the humanized string should have. |
1
|
Returns:
Type | Description |
---|---|
str
|
Humanized number with appropriate suffix. |
pyslurm.utils.dehumanize(humanized_str, target='M', decimals=0)
method descriptor
Dehumanize a previously humanized value.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
humanized_str
|
str
|
A humanized str, for example "5M" or "10T" |
required |
target
|
str
|
Target unit. The default is "M" (Mebibytes). Allowed values are K,M,G,T,P,E,Z |
'M'
|
decimals
|
int
|
Amount of decimal places the result should have. Default is 0 |
0
|
Returns:
Type | Description |
---|---|
int
|
Dehumanized value |