#3159 Slurm agent shell task
Pull request opened by
JiangJiaWei1103
Tracking issue
flyteorg/flyte#5634
Why are the changes needed?
We want to let users to run shell task on slurm cluster via flyte.
What changes were proposed in this pull request?
add 2 types of shell task to run on slurm cluster.
How was this patch tested?
local execution and remote execution.
for remote execution, Han-Ru used Union Cloud to do it.
import os
from flytekit import workflow
from flytekitplugins.slurm import Slurm, SlurmTask, SlurmRemoteScript, SlurmShellTask
echo_job = SlurmTask(
name="test-slurm",
task_config=SlurmRemoteScript(
ssh_config={
"host": "aws2",
"username": "ubuntu",
},
batch_script_path="/home/ubuntu/test/echo.sh",
sbatch_conf={
"partition": "debug",
"job-name": "tiny-slurm",
}
)
)
shell_task = SlurmShellTask(
name="test-shell",
script="""#!/bin/bash
echo "Run a Flyte SlurmShellTask...\n"
""",
task_config=Slurm(
ssh_config={
"host": "aws2",
"username": "ubuntu",
},
sbatch_conf={
"partition": "debug",
"job-name": "tiny-slurm",
}
),
)
@workflow
def wf():
echo_job()
shell_task()
if
name == "__main__":
from flytekit.clis.sdk_in_container import pyflyte
from click.testing import CliRunner
runner = CliRunner()
path = os.path.realpath(
file)
# Local run
print(f">>> LOCAL EXEC <<<")
result = runner.invoke(pyflyte.main, ["run", path, "wf"])
print(result.output)
Setup process
Screenshots
Check all the applicable boxes
• I updated the documentation accordingly.
• All new and existing tests passed.
• All commits are signed-off.
Related PRs
#3150
Summary by Bito
This pull request refines the Slurm plugin by removing outdated documentation and enhancing the task implementation. The function module now omits obsolete docstrings, while the script module is reworked to improve parameter handling and validation. These changes support a more robust configuration for running shell tasks on a Slurm cluster.
Unit tests added: False
Estimated effort to review (1-5, lower is better): 1
flyteorg/flytekit