-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathtemplate_python_plugin.py
More file actions
42 lines (34 loc) · 1.01 KB
/
template_python_plugin.py
File metadata and controls
42 lines (34 loc) · 1.01 KB
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
#!/usr/bin/env python3
import sys
import typing
from arcaflow_plugin_sdk import plugin
from arcaflow_plugin_template_python.template_python_schema import (
InputParams,
SuccessOutput,
ErrorOutput,
)
@plugin.step(
id="hello-world",
name="Hello world!",
description="Says hello :)",
outputs={"success": SuccessOutput, "error": ErrorOutput},
)
def hello_world(
params: InputParams,
) -> typing.Tuple[str, typing.Union[SuccessOutput, ErrorOutput]]:
"""The function is the implementation for the step. It needs the decorator
above to make it into a step. The type hints for the params are required.
:param params:
:return: the string identifying which output it is, as well the output
structure
"""
return "success", SuccessOutput("Hello, {}!".format(params.name))
if __name__ == "__main__":
sys.exit(
plugin.run(
plugin.build_schema(
# List your step functions here:
hello_world,
)
)
)