Skip to content

Add RunParallelProcess component - #414

Merged
MFA-X-AI merged 2 commits into
XpressAI:masterfrom
the-virtual-brain:run-parallel-process
Jul 14, 2025
Merged

MFA-X-AI merged 2 commits into
XpressAI:masterfrom
the-virtual-brain:run-parallel-process

Conversation

@romina1601

Copy link
Copy Markdown
Contributor

Description

Xircuits already includes a RunParallelThread component that executes tasks in parallel using threads. However, in CPython, threads are not truly parallel due to the GIL. For our use case - running TVB simulations that involve heavy mathematical computations - threading actually performed worse than running everything sequentially.

To address this, I created a new RunParallelProcess component that uses separate processes instead of threads, enabling true parallelism for CPU-bound workloads.

Note: Logs from components executed in parallel processes will no longer appear in the JupyterLab output. They will only be visible in the terminal from which JupyterLab was launched.

This feature introduces a new dependency: dill, used for serializing Python objects.

Pull Request Type

  • Xircuits Core (Jupyterlab Related changes)
  • Xircuits Canvas (Custom RD Related changes)
  • Xircuits Component Library
  • Xircuits Project Template
  • Testing Automation
  • Documentation
  • Others (Please Specify)

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Tests

I added a test file /examples/RunParallelProcess.xircuits to demonstrate the usage of this new component.

Tested on? Specify Version.

  • Windows
  • Linux
  • Mac
  • Others (State here -> xxx )

@github-actions

Copy link
Copy Markdown

Binder 👈 Launch a binder notebook on branch the-virtual-brain/tvb-ext-xircuits/run-parallel-process

@MFA-X-AI MFA-X-AI left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!
This is super helpful, dill seems to solve quite a lot of our parallel processing needs. It doesn't seem to have any other deps to other packages so that's good too. Everything seems good, just that since the workflow name is the same name as the component, it goes into an infinite loop. If you can update the workflow name, we should be good to merge.

@romina1601
romina1601 requested a review from MFA-X-AI July 2, 2025 13:35

@MFA-X-AI MFA-X-AI left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks a bunch!

@MFA-X-AI
MFA-X-AI merged commit e95a21e into XpressAI:master Jul 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants