.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples_apps/datapreproc/component.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_apps_datapreproc_component.py: Datapreproc Component Example ============================= This is a component definition that runs the example datapreproc app. .. GENERATED FROM PYTHON SOURCE LINES 14-61 .. code-block:: default from typing import Dict, Optional import torchx.specs as specs def data_preproc( image: str, entrypoint: str, output_path: str, input_path: str = "http://cs231n.stanford.edu/tiny-imagenet-200.zip", input_md5: str = "90528d7ca1a48142e341f4ef8d21d0de", env: Optional[Dict[str, str]] = None, name: str = "datapreproc", ) -> specs.AppDef: """Data PreProc app. Data PreProc app. Args: name: Name of the app. output_path: output_path Returns: specs.AppDef: Torchx AppDef """ env = env or {} resource = specs.named_resources["T1"] ddp_role = specs.Role( name="datapreproc_role", image=image, entrypoint=entrypoint, args=[ "--input_path", input_path, "--input_md5", input_md5, "--output_path", output_path, ], env=env, resource=resource, num_replicas=1, ) return specs.AppDef(name, roles=[ddp_role]) .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.000 seconds) .. _sphx_glr_download_examples_apps_datapreproc_component.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: component.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: component.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_