proxystore.utils
General purpose utility functions.
chunk_bytes ¶
Yield chunks of binary data.
Parameters:
Returns:
Source code in proxystore/utils.py
create_key ¶
fullname ¶
Return full name of object.
Source code in proxystore/utils.py
home_dir ¶
Return the absolute path to the proxystore home directory.
If set, $PROXYSTORE_HOME
is preferred. Otherwise,
$XDG_DATA_HOME/proxystore
is returned where $XDG_DATA_HOME
defaults
to $HOME/.local/share
if unset.
Source code in proxystore/utils.py
hostname ¶
bytes_to_readable ¶
Convert bytes to human readable value.
Note
This method uses base-10 values for KB, MB, GB, etc. instead of base-2 values (i.e., KiB, MiB, GiB, etc.).
Parameters:
Returns:
-
str
–String with human readable number of bytes.
Raises:
-
ValueError
–If size is negative.
Source code in proxystore/utils.py
readable_to_bytes ¶
Convert string with bytes units to the integer value of bytes.
Parameters:
-
size
(
str
) –String to parse for bytes size.
Returns:
-
int
–Integer number of bytes parsed from the string.
Raises:
-
ValueError
–If the input string contains more than two parts (i.e., a value and a unit).
-
ValueError
–If the unit is not one of KB, MB, GB, TB, KiB, MiB, GiB, or TiB.
-
ValueError
–If the value cannot be cast to a float.