Make the workflow and step decorators not depend on the creation of a Hatchet instance
Closed this issue · 0 comments
As it stands, the workflow and step decorators have to be defined using a Hatchet App instance:
workflow
hatchet-python/hatchet_sdk/hatchet.py
Line 59 in e358266
step
hatchet-python/hatchet_sdk/hatchet.py
Line 82 in e358266
As far as I can tell, the only place where the client attribute that is set on the workflow meta is actually used is here where it is actually just used to access the configuration namespace.
hatchet-python/hatchet_sdk/workflow.py
Line 16 in e358266
Since workflows have to be registered with the worker ANYWAY, I don't see why all the things that might need the client or additional configuration can't be handled at that point:
hatchet-python/hatchet_sdk/worker.py
Line 500 in 2b54d54
It seems to me that it would be much cleaner if Workflows could be defined declarative apart from any dynamic configuration that is needed to actually talk to a particular hatchet instance.
one idea for how to pull this off is to make everything that is calculated eagerly in the new of workflow meta, instead be calculated dynamically/lazily as part of the call to get_actions, here:
hatchet-python/hatchet_sdk/worker.py
Line 514 in 2b54d54