Skip to content

♻️ Broker: polymorphic process revival#7361

Draft
GeigerJ2 wants to merge 1 commit into
aiidateam:mainfrom
GeigerJ2:refactor/broker-revive-process
Draft

♻️ Broker: polymorphic process revival#7361
GeigerJ2 wants to merge 1 commit into
aiidateam:mainfrom
GeigerJ2:refactor/broker-revive-process

Conversation

@GeigerJ2
Copy link
Copy Markdown
Collaborator

@GeigerJ2 GeigerJ2 commented May 4, 2026

Copy of commit msg here:

`verdi process repair` previously branched on `isinstance(broker,
ZmqBroker)` to choose between writing tasks directly to the
PersistentQueue (ZMQ) and calling a `RemoteProcessThreadController`
(RabbitMQ). Move both paths behind a polymorphic
`Broker.revive_process(pid)` method so the CLI is broker-agnostic and
third-party brokers can plug in their own strategy.

The default raises `NotImplementedError` rather than being abstract, so
existing out-of-tree `Broker` subclasses remain instantiable; they opt
in by overriding.

@GeigerJ2 GeigerJ2 changed the title ♻️ Broker.revive_process: hoist from CLI to ABC ♻️ Broker: polymorphic process revival May 4, 2026
@GeigerJ2 GeigerJ2 force-pushed the refactor/broker-revive-process branch from 43959e8 to 3c559e6 Compare May 4, 2026 15:11
@codecov
Copy link
Copy Markdown

codecov Bot commented May 4, 2026

Codecov Report

❌ Patch coverage is 91.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.27%. Comparing base (f87e241) to head (daafeab).

Files with missing lines Patch % Lines
src/aiida/brokers/broker.py 33.34% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7361      +/-   ##
==========================================
- Coverage   80.27%   80.27%   -0.00%     
==========================================
  Files         577      577              
  Lines       45520    45521       +1     
==========================================
  Hits        36537    36537              
- Misses       8983     8984       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

`verdi process repair` previously branched on `isinstance(broker,
ZmqBroker)` to choose between writing tasks directly to the
PersistentQueue (ZMQ) and calling a `RemoteProcessThreadController`
(RabbitMQ). Move both paths behind a polymorphic
`Broker.revive_process(pid)` method so the CLI is broker-agnostic
and third-party brokers can plug in their own strategy.

The default raises `NotImplementedError` rather than being abstract,
so existing out-of-tree `Broker` subclasses remain instantiable;
they opt in by overriding.

Cache the `PersistentQueue` instance on `ZmqBroker` via
`cached_property` so crash recovery runs once and the in-memory
pending deque stays consistent across `iterate_tasks` and
`revive_process`.

Add tests covering the revive shape, multiple PIDs, the
revive-then-iterate round trip, and the RabbitMQ delegation.
@GeigerJ2 GeigerJ2 force-pushed the refactor/broker-revive-process branch from 3c559e6 to daafeab Compare May 4, 2026 15:40
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.

1 participant