.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/example_remote_decorator.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_example_remote_decorator.py: Decorate your function ====================== .. GENERATED FROM PYTHON SOURCE LINES 5-15 .. code-block:: Python from pathlib import Path from remote_run.run import ( ExecutionContext, GuixRunner, GitProject, remote, SshExecution, ) .. GENERATED FROM PYTHON SOURCE LINES 16-17 Define an execution context .. GENERATED FROM PYTHON SOURCE LINES 17-27 .. code-block:: Python execution_context = ExecutionContext( execution=SshExecution( machine="shpc0003.ost.ch", working_directory=Path("/cluster/raid/home/reza.housseini"), ), project=GitProject(), runner=GuixRunner(channels=Path("channels.scm").read_text()), ) .. GENERATED FROM PYTHON SOURCE LINES 28-30 decorate your functions you want to run in the specified execution context .. GENERATED FROM PYTHON SOURCE LINES 30-35 .. code-block:: Python @remote(execution_context) def add(a, b): return a + b .. GENERATED FROM PYTHON SOURCE LINES 36-37 this call will run on the remote machine specified in execution_context .. GENERATED FROM PYTHON SOURCE LINES 37-38 .. code-block:: Python assert add(1, 2) == 3 .. _sphx_glr_download_auto_examples_example_remote_decorator.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: example_remote_decorator.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: example_remote_decorator.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: example_remote_decorator.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_