-
Notifications
You must be signed in to change notification settings - Fork 1
/
hello_world.py
61 lines (53 loc) · 1.18 KB
/
hello_world.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import json
from typing import List
from dflow import (
Workflow,
Step,
argo_range,
SlurmRemoteExecutor,
upload_artifact,
download_artifact,
InputArtifact,
OutputArtifact,
ShellOPTemplate
)
from dflow.python import (
PythonOPTemplate,
OP,
OPIO,
OPIOSign,
Artifact,
Slices
)
import subprocess, os, shutil, glob
from pathlib import Path
from typing import List
class PrintHello(OP):
def __init__(self):
pass
@classmethod
def get_input_sign(cls):
return OPIOSign({
"repeat_numb": int
})
@classmethod
def get_output_sign(cls):
return OPIOSign()
@OP.exec_sign_check
def execute(self, op_in: OPIO) -> OPIO:
for i in range(op_in["repeat_numb"]):
print("hello world")
return OPIO()
def main():
slurm_remote_executor = <your slurm set up>
print_hello = Step(
"hello-world-print",
PythonOPTemplate(PrintHello, image="your image"),
parameters={"repeat_numb": 10},
executor=slurm_remote_executor,
)
wf = Workflow("print-hello")
wf.add(print_hello)
wf.submit()
if __name__ == '__main__':
main()