"""
Call by function
================
"""

from pathlib import Path
from remote_run import (
    Executor,
    GuixEnvironment,
    SshMachine,
)

# %%
# Define an executor
executor = Executor(
    machine=SshMachine(
        host="shpc0003.ost.ch",
        working_directory=Path("/cluster/raid/home/reza.housseini"),
    ),
    environment=[
        GuixEnvironment(
            channels=Path("channels.scm").read_text(),
            manifest=Path("manifest.scm").read_text(),
        )
    ],
)


# %%
# undecorated function we want to run with the executor
def add(a, b):
    return a + b


# %%
# run on the remote machine specified in execution_context using the function call
assert executor.submit(add, 1, 2) == 3
