from gjirafatech.truai.task import TruTaskClient, TruInputs, TruOutputs
from gjirafatech.truai.task.path import TruPathANY
class MyEnum(enum.Enum):
Small = 1
Medium = 2
class MyInputs(TruInputs):
string_input: str
float_input: float
int_input: int
enum_input: MyEnum
bool_input: bool
path_input: TruPathANY
class MyOutputs(TruOutputs):
string_output: str
float_output: float
int_output: int
path_output: TruPathANY
client = TruTaskClient()
my_alias = "my_task"
task = client.get(alias=my_alias)
if not task:
client.create(
alias=my_alias,
title="MyTask",
task_type=TaskType.Read,
script_path="task_v1.py",
requirements_path="task_requirements.txt",
description="MyTask description",
inputs=MyInputs,
outputs=MyOutputs,
local_file=False
)
else:
client.update(
alias=my_alias,
script_path="task_v2.py",
local_file=False
)