This repository was archived by the owner on Mar 26, 2025. It is now read-only.
enhancement: allow control over JSON serialization, nested_asyncio, and Context class #12
Labels
enhancement
New feature or request
Hi, I would like to suggest a few enhancements to the sdk.
Version:
0.23.0
In my own workflow library, I've had to implement a few patches in order to overcome the existing behavior of the sdk.
JSON Serialization
If there was a way to allow for a custom JSON serialization/deserialization method, it would be extremely useful to handle the input, especially with object hooks. It's very easy to forget a custom
datetime.datetime
object, and if the ser/deser hook can handle those inputs, it would allow for more flexibility for the end-user.I currently patch the behavior of the following:
hatchet_sdk.worker.Worker
hatchet_sdk.context.Context
hatchet_sdk.context.ChildWorkflowRef
nest_asyncio
My use case is that I would like to spawn multiple workflows, each with their own workers at the same time.
Due to
nest_asyncio
, this causes potential problems with downstream libraries that rely on the sameEventLoop
, which is a problem, depending on whenhatchet_sdk
is imported andnest_asyncio.apply()
occurs.It would be helpful if I was able to disable
nest_asyncio.apply()
with an env var, understanding the implications of doing so.Context Class
It would be very useful to allow for the user to provide a custom
Context
class that gets used to createContext
within workflow steps by theWorker
. This would enable the user to add properties or methods.Currently, I have it implemented as:
Thanks!
The text was updated successfully, but these errors were encountered: