Start Nodejs activity parallel along with Python activity in NodeJS workflow

I have Python & NodeJS activities which I’m calling from NodeJS workflow.
Want to use same task-queue for all activities i.e NodeJS & Python.
Using following approach to start activities & workflow:

Starting Python activities: poetry run python activity_worker.py (referred this example)
Starting NodeJS activities: npm run workflow (ts-node src/client.ts)
Starting NodeJS workflow: npm run start.watch (nodemon src/worker.ts)

But above approach is creating different workflows and I want all activities in one workflow only.

Can you please tell how can I achieve that?

activity-worker has following code:
image

NodeJS client has following code:
image

Have tried following approach as well:

Starting Python activities: poetry run python activity_worker.py (referred this example)
Starting NodeJS workflow: npm run start.watch (nodemon src/worker.ts)

Here, not starting NodeJS activities explicitly. Getting expected output NodeJS activities are getting called. But getting below error:

Is this correct approach or I’m doing it in wrong way?

That code is not just running a worker, it is also executing a workflow with the client. Is that by intention?

I don’t see these activities, but make sure they are on a different task queue than the Python ones when you create the worker. You can specify the task queue to call the activities inside the workflow.

You’re starting a workflow on python-worker-taskQueue. Is that by intention that you are starting a nodejs workflow on a task queue with a python name?

@nehapatil7199 you can also have a look at this post that shows how to set up and invoke an activity from typescript and run the activity from a java worker

This video might be interesting as well https://www.youtube.com/watch?v=LSXP_o6sTic

1 Like

My understanding is in order to invoke activities will need to start respective workers and then start workflow. In my case it is Python & NodeJS worker.

Following is the use case I’m trying to implement:

  • Start NodeJS worker
  • Start Python worker
  • Start NodeJS workflow which will invoke Python & NodeJS activities

And as you mentioned I’m starting worker as well as workflow using poetry run python activity_worker.py.

How can I start Python worker only because this python-samples are starting workflow as well along with worker.

To not start a workflow, don’t call client.execute_workflow. You can just async with Worker(... with something asyncio blocking inside or my_worker = Worker(... + await my_worker.run(). There are other examples that show just running a worker, e.g. this encryption one.