diff --git a/src/knoc_plugin_template/process.py b/src/knoc_plugin_template/process.py new file mode 100644 index 0000000..c657348 --- /dev/null +++ b/src/knoc_plugin_template/process.py @@ -0,0 +1,13 @@ +from datetime import datetime + +from pydantic import BaseModel + +from knoc_plugin_template import __version__ + + +class SimpleOutput(BaseModel): + message: str + + +async def plugin_template_process() -> SimpleOutput: + return SimpleOutput(message=f"Foo v{__version__} at {datetime.now()}") diff --git a/src/knoc_plugin_template/workflows.py b/src/knoc_plugin_template/workflows.py index 3a0920f..c47b767 100644 --- a/src/knoc_plugin_template/workflows.py +++ b/src/knoc_plugin_template/workflows.py @@ -1,15 +1,9 @@ -from datetime import datetime -from pydantic import BaseModel - from hatchet_sdk import Context, EmptyModel -from knoc_plugin_template import __version__ -from knoc.settings import settings from knoc.hatchet_client import hatchet - - -class SimpleOutput(BaseModel): - message: str +from pandas._libs.lib import is_np_dtype +from knoc_plugin_template import __version__ +from knoc_plugin_template.process import plugin_template_process, SimpleOutput do_nothing_wf = hatchet.workflow( @@ -18,7 +12,11 @@ do_nothing_wf = hatchet.workflow( ) -@do_nothing_wf.task() +@hatchet.task(input_validator=EmptyModel) async def do_nothing(input: EmptyModel, ctx: Context) -> SimpleOutput: + """A template for Do nothing""" ctx.log("Just a workflow template") - return SimpleOutput(message=f"Foo v{__version__} at {datetime.now()}") + return await plugin_template_process() + + +do_nothing_wf.add_task(do_nothing)