Utils¶
Utility components that are ready-to-use out of the box. These are
components that simply execute well known binaries (e.g. /bin/cp
)
and are meant to be used as tutorial materials or glue operations between
meaningful stages in a workflow.
- torchx.components.utils.echo(msg: str = 'hello world', image: str = 'ghcr.io/pytorch/torchx:0.1.0rc0', num_replicas: int = 1) → torchx.specs.api.AppDef[source]¶
Echos a message to stdout (calls /bin/echo)
- Parameters
msg – message to echo
image – image to use
num_replicas – number of replicas to run
- torchx.components.utils.touch(file: str, image: str = 'ghcr.io/pytorch/torchx:0.1.0rc0') → torchx.specs.api.AppDef[source]¶
Touches a file (calls touch)
- Parameters
file – file to create
image – the image to use
- torchx.components.utils.sh(*args: str, image: str = 'ghcr.io/pytorch/torchx:0.1.0rc0', num_replicas: int = 1) → torchx.specs.api.AppDef[source]¶
Runs the provided command via sh. Currently sh does not support environment variable substitution.
- Parameters
args – bash arguments
image – image to use
num_replicas – number of replicas to run
- torchx.components.utils.copy(src: str, dst: str, image: str = 'ghcr.io/pytorch/torchx:0.1.0rc0') → torchx.specs.api.AppDef[source]¶
copy copies the file from src to dst. src and dst can be any valid fsspec url.
This does not support recursive copies or directories.
- Parameters
src – the source fsspec file location
dst – the destination fsspec file location
image – the image that contains the copy app