.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto/remote_access/remote_task.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_auto_remote_access_remote_task.py: Running a Task -------------------- Flytectl ======== This is a multi-step process where we create an execution spec file, update the spec file, and then create the execution. More details can be found in the `Flytectl API reference `__. **Generate execution spec file** :: flytectl get tasks -d development -p flytesnacks workflows.example.generate_normal_df --latest --execFile exec_spec.yaml **Update the input spec file for arguments to the workflow** :: iamRoleARN: 'arn:aws:iam::12345678:role/defaultrole' inputs: n: 200 mean: 0.0 sigma: 1.0 kubeServiceAcct: "" targetDomain: "" targetProject: "" task: workflows.example.generate_normal_df version: "v1" **Create execution using the exec spec file** :: flytectl create execution -p flytesnacks -d development --execFile exec_spec.yaml **Monitor the execution by providing the execution id from create command** :: flytectl get execution -p flytesnacks -d development FlyteRemote =========== A task can be launched via FlyteRemote programmatically. .. code-block:: python from flytekit.remote import FlyteRemote from flytekit.configuration import Config, SerializationSettings # FlyteRemote object is the main entrypoint to API remote = FlyteRemote( config=Config.for_endpoint(endpoint="flyte.example.net"), default_project="flytesnacks", default_domain="development", ) # Get Task flyte_task = remote.fetch_task(name="workflows.example.generate_normal_df", version="v1") flyte_task = remote.register_task( entity=flyte_task, serialization_settings=SerializationSettings(image_config=None), version="v2", ) # Run Task execution = remote.execute( flyte_task, inputs={"n": 200, "mean": 0.0, "sigma": 1.0}, execution_name="task_execution", wait=True ) # Inspecting execution # The 'inputs' and 'outputs' correspond to the task execution. input_keys = execution.inputs.keys() output_keys = execution.outputs.keys() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.000 seconds) .. _sphx_glr_download_auto_remote_access_remote_task.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: remote_task.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: remote_task.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_