Module clients.convert.duration_convertor
Functions
duration_to_seconds
def duration_to_seconds(duration: str) ‑> str
Converts duration specified in seconds, minutes, hours or days into a durating specified in seconds. [duration] = [number][suffix] [suffix] = s | m | h | d
Args
duration
- string representing duration in format of number with a
s
suffix. Example3600s
.
Returns
string representing duration in seconds with a s
suffix.
Raises
ValueError
- Invalid duration value passed.
Examples
- "1s" -> "1s"
- "1m" -> "60s"
- "1h" -> "3600s"
- "1d" -> "86400s"
- "1w" -> "ValueError"
- "60" -> "ValueError"
none_duration_to_seconds
def none_duration_to_seconds(duration: Optional[str]) ‑> Optional[str]
none_seconds_to_duration
def none_seconds_to_duration(seconds: Optional[str]) ‑> Optional[str]
seconds_to_duration
def seconds_to_duration(seconds: str) ‑> str
Converts seconds into a human-readable duration string. The highest possible duration unit will be applied.
Args
seconds
- number of seconds followed with a
s
suffix. Decimal values will be rounded down.
Returns
string representing duration in highest possible unit available (up to d
representing days).
Examples
"1s" -> "1s" "1.9s" -> "1s" "60s" -> "1m" "61s" -> "61s" "3600s" -> "1h" "3601s" -> "3601s"
Feedback
- Submit and view feedback for this page
- Send feedback about AI Engine Manager to cloud-feedback@h2o.ai