What is the timeline for a python client that works with temporal?
I’ve been looking at GitHub - firdaus/cadence-python: Python framework for Cadence Workflow Service and assume it is not compatible with temporal.
What is the timeline for a python client that works with temporal?
I’ve been looking at GitHub - firdaus/cadence-python: Python framework for Cadence Workflow Service and assume it is not compatible with temporal.
@firdaus has been working hard on a python experience for Temporal. He will know the exact status better than I do.
Been overloaded with work this month. Targeting September to be on par with cadence-python in terms of features.
Looking forward to this! Thank you for all of your efforts @firdaus
@firdaus What is the status on the python experience for Temporal?
really looking forward to this ^^
Current status:
Hard to give a date at the moment because my workload varies quite a bit.
Just to set expectations, I won’t be making the repo public until all currently implemented features in cadence-python have been ported over.
You can sign up to participate in the beta test here:
EDIT: fixed URL.
I like how @ryland does regular transparency updates to the community. I thought it would be a good idea to follow in his footsteps and update my progress on a regular basis as well.
I know a number of people are waiting on the Python SDK release and really the only way to get the library into a production quality state is for people to try it out for their use cases and report bugs — but my feeling is that if I publish before it’s on par with cadence-python that I would be spending too much time doing support.
To manage expectations, I’m publishing my functional testing tasks. I’ll tick the items below as the functional tests get done and once everything on this list has functional tests in place I’ll make the repo public and publish a beta to PYPI.
Is this still under active development? We are starting a new project and Temporal would be perfect. We are using a Django stack and Python SDK would be ideal.
Yes, still under development. Will be updating that list soon.
It seems that Discourse limits edits based on some criteria – so I’m not able to modify the original “todo list”.
The latest status is now at: https://gist.github.com/firdaus/4ec442f2c626122ad0c8d379a7ffd8bc
Current status – there are some issues with serializing/deserializing exceptions that were discovered while testing complete_exceptionally
– partly due to the changes I made in my betterproto fork.
The idea is that exceptions don’t need to be serialized as they are converted to ApplicationFailure without serialization.
Eagerly waiting for Python support, would love to get started to see if temporal can be part of solutions.
Made a lot of progress in the past few days. Have a look at the GIST link for updates.
Wanted to get some feedback on this:
In the new client, any functions that talk to the Temporal service are async def
and therefore must be executed from an async def
function.
Activity functions have to be async def
too but activities run in their own thread and there is a separate event loop per thread so you are free to call blocking coding from it – it wont interfere with other coroutines.
Are there any GIL concerns with running an activity per thread? I suppose my activities can fork themselves so that the work isnt GIL-limited, but I’m wondering if the SDK should do that as well, both for process isolation and also to avoid GIL limitations.
Or on the opposite side of spectrum, stick to “pure” asyncio and let the user make the decisions about threading/forking for blocking code in the activity. I’d sort of prefer this, if we’re making people use async def
anyways.
Good point, probably should launch activity workers in a separate process using multiprocessing.
The downside of using a process pool is that it may be harder for the user to use/manage shared resources (caches, conn pools, etc) between activities. Still maybe possible if the SDK uses a process pool with worker reuse, but the user gives up some control there.
The more I think about it the more I prefer for the SDK to defer all these decisions to the user, and only manage the asyncio-level request handling . Are we worried that it will be hard to use for people who don’t want to worry about blocking calls? If so, perhaps we can have a high-level thread/process-pool-based API built on top of the lower-level asyncio single-threaded core?
I agree with this.
FWIW, in new async packages like FastAPI / Starlette, there is often auto-detection (asyncio.iscoroutinefunction(..)
) so that you can run a combination of standard / async functions. The standard functions are executed in a dedicated threadpool (e.g. https://github.com/encode/starlette/blob/master/starlette/concurrency.py), separate from the main loop.
See also Django’s asgiref
also: https://github.com/django/asgiref/blob/master/asgiref/sync.py#L224
Yeah, here is the relevant code in temporal-python
if inspect.iscoroutinefunction(fn):
return_value = await fn(*args)
else:
return_value = fn(*args)
If we are keeping the SDK asyncio-centric (which is what I think what @mrsaints and I are both suggesting), we should probably push user-defined functions to a thread pool in case they are blocking. Something roughly equivalent to this:
if inspect.iscoroutinefunction(fn):
return_value = await fn(*args)
else:
return_value = await loop.run_in_executor(executor, fn, *args)