Skip to content

Conversation

@wdconinc
Copy link
Contributor

@wdconinc wdconinc commented Jan 22, 2026

Briefly, what does this PR introduce?

Needs:

  • JANA2, v2026.01.01

This PR ensures that failing init() calls in algorithms immediately lead to that algorithm being taken out of operation for the rest of the run. This prevents the failing algorithms to attempt to get re-initialized the whole time.

What kind of change does this PR introduce?

  • Bug fix (issue #__)
  • New feature (issue #__)
  • Documentation update
  • Other: __

Please check if this PR fulfills the following:

  • Tests for the changes have been added
  • Documentation has been added / updated
  • Changes have been communicated to collaborators

Does this PR introduce breaking changes? What changes might users need to make to their code?

No.

Does this PR change default behavior?

Yes.

Copilot AI review requested due to automatic review settings January 22, 2026 19:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces error handling for factory initialization failures in JOmniFactory. When the Init() method fails, the factory is marked with CreationStatus::NeverCreated and continues to exist but produces only empty collections instead of attempting to re-initialize or process events.

Changes:

  • Added try-catch block in Init() to handle initialization failures gracefully
  • Factories with failed initialization are marked as NeverCreated and log an error
  • Process() method now checks for NeverCreated status and returns early with empty collections
Comments suppressed due to low confidence (1)

src/extensions/jana/JOmniFactory.h:546

  • The BeginRun method should check if the factory is in NeverCreated status before attempting to execute. If initialization failed, calling ChangeRun on resources or the algorithm could lead to undefined behavior since Configure was never successfully called.
  void BeginRun(const std::shared_ptr<const JEvent>& event) override {
    for (auto* resource : m_resources) {
      resource->ChangeRun(*event);
    }
    static_cast<AlgoT*>(this)->ChangeRun(event->GetRunNumber());
  }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings January 22, 2026 19:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

src/extensions/jana/JOmniFactory.h:546

  • The BeginRun method should also check if the factory is in NeverCreated status and return early, similar to the Process method. If initialization failed, BeginRun shouldn't attempt to execute ChangeRun operations on resources or the algorithm itself, as they may depend on successful initialization.
  void BeginRun(const std::shared_ptr<const JEvent>& event) override {
    for (auto* resource : m_resources) {
      resource->ChangeRun(*event);
    }
    static_cast<AlgoT*>(this)->ChangeRun(event->GetRunNumber());
  }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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