Decorate your function

from pathlib import Path
from remote_run.run import (
    ExecutionContext,
    SlurmSchedulingEngine,
    GuixRunner,
    remote,
)

Define an execution context

execution_context = ExecutionContext(
    machine="shpc0003.ost.ch",
    working_directory=Path("/cluster/raid/home/reza.housseini"),
    runner=GuixRunner(channels_file=Path("channels.scm")),
)

decorate your functions you want to run in the specified execution context

@remote(execution_context)
def add(a, b):
    return a + b

this call will run on the remote machine specified in execution_context

assert add(1, 2) == 3

Gallery generated by Sphinx-Gallery