I am writing a system which basically runs in JVM. But there is some activities that I need to implement in Python.
I created an activities-only worker in Python and tested. I noticed that the tasks are running one by one so the remaining tasks are waiting in pending state.
In Java worker everything work as expected in parallel. Is it possible to get the same behaviour in python?
In Python they are expected to be parallel too. Many users run many hundreds of activities concurrently. Are you using async activities or sync activities in Python? If the former, make sure you are not doing anything blocking the thread. If the latter, make sure your thread pool executor has enough max workers and you aren’t setting max concurrent activities to a low value.
This appears to be dangerous thread-blocking code which is not allowed in async def functions in Python. You’ll stop the whole processing of the async system blocking the asyncio thread. You should not make this activity async since it’s not async-capable. Make it a normal def and then you’ll be required to pass in an activity_executor to the worker (usually best as a thread pool executor). See types of activities.