Split processing in separate file
This commit is contained in:
parent
b1bd86962f
commit
b0d7a82ac9
2 changed files with 22 additions and 11 deletions
13
src/knoc_plugin_template/process.py
Normal file
13
src/knoc_plugin_template/process.py
Normal file
|
@ -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()}")
|
|
@ -1,15 +1,9 @@
|
||||||
from datetime import datetime
|
|
||||||
from pydantic import BaseModel
|
|
||||||
|
|
||||||
from hatchet_sdk import Context, EmptyModel
|
from hatchet_sdk import Context, EmptyModel
|
||||||
|
|
||||||
from knoc_plugin_template import __version__
|
|
||||||
from knoc.settings import settings
|
|
||||||
from knoc.hatchet_client import hatchet
|
from knoc.hatchet_client import hatchet
|
||||||
|
from pandas._libs.lib import is_np_dtype
|
||||||
|
from knoc_plugin_template import __version__
|
||||||
class SimpleOutput(BaseModel):
|
from knoc_plugin_template.process import plugin_template_process, SimpleOutput
|
||||||
message: str
|
|
||||||
|
|
||||||
|
|
||||||
do_nothing_wf = hatchet.workflow(
|
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:
|
async def do_nothing(input: EmptyModel, ctx: Context) -> SimpleOutput:
|
||||||
|
"""A template for Do nothing"""
|
||||||
ctx.log("Just a workflow template")
|
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)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue