-
Notifications
You must be signed in to change notification settings - Fork 1
Feat: TPwriter's enable/disable logic now determined by readout apps #290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
henry-wallace-phys
wants to merge
10
commits into
develop
Choose a base branch
from
hwallace/feature/tp_disable
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
eb39020
Update TPWriter application to have disable/enable decided by connect…
930d8d9
Make logic use datatype instead of specifically named connection, fix…
30fd8e5
is_disabled->compute_disabled_state
35b6b64
Update application src
3eef2a9
Fix comments, rename 'casted' to readout for clarity
4cacd69
Update is_disabled to skip readout apps that aren't referenced
40b47bb
Merge remote-tracking branch 'origin' into hwallace/feature/tp_disable
1be667e
Move to compute_disabled_state
d6f81f2
Draft of TriggerApplication disable logic
mroda88 542f8d6
Fix missing include
mroda88 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,14 +13,15 @@ | |
| #include "conffwk/Configuration.hpp" | ||
| #include "oks/kernel.hpp" | ||
| #include "confmodel/Connection.hpp" | ||
| #include "confmodel/Service.hpp" | ||
| #include "confmodel/NetworkConnection.hpp" | ||
| #include "appmodel/ReadoutApplication.hpp" | ||
| #include "confmodel/Service.hpp" | ||
| #include "appmodel/SourceIDConf.hpp" | ||
| #include "appmodel/TPStreamWriterApplication.hpp" | ||
| #include "appmodel/TPStreamWriterModule.hpp" | ||
| #include "appmodel/TPStreamWriterConf.hpp" | ||
| #include "appmodel/NetworkConnectionRule.hpp" | ||
| #include "appmodel/NetworkConnectionDescriptor.hpp" | ||
| #include "appmodel/SourceIDConf.hpp" | ||
| #include "appmodel/appmodelIssues.hpp" | ||
| #include "logging/Logging.hpp" | ||
|
|
||
|
|
@@ -79,5 +80,40 @@ TPStreamWriterApplication::generate_modules(std::shared_ptr<appmodel::Configurat | |
| obj_fac.update_modules(modules); | ||
| } | ||
|
|
||
| bool TPStreamWriterApplication::is_disabled(const dunedaq::confmodel::ResourceTree& holder) const { | ||
| /* Disabled if: | ||
| 1. I am explicitly disabled | ||
| 2. All ReadoutApplications are disabled | ||
| 3. TPGeneration is disabled in all readout applications | ||
| */ | ||
|
|
||
| // First we can just check if the application itself is disabled | ||
| if (!holder.disabled_components().is_enabled(this)){ | ||
| return true; | ||
| } | ||
|
|
||
| // Now for the tricky bit, we need to loop over the connections | ||
|
|
||
| for(auto& rule : get_network_rules()){ | ||
| /// HACK (minor): We assume TPs will always contain this exact rule | ||
| if(rule->UID()!="tpset-net-rule"){continue;} | ||
|
|
||
| // We now loop over the parents | ||
| for(auto parent : configuration().referenced_by(*rule)){ | ||
|
|
||
| // Safer than blindly casting to ReadoutApplication (RA) | ||
| if(!parent->castable("ReadoutApplication")) continue; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think casting and checking for nullptr is just as safe. The continue should really be on a line of its own, surrounded by braces. If statements without braces are against the coding conventions and really screw up my reading of code. |
||
| auto casted = parent->cast<appmodel::ReadoutApplication>(); | ||
|
|
||
| /// If the RA is disabled then so is its TP | ||
| if(casted->is_disabled(holder)){continue;} | ||
| // If the TP is enabled on ANY RA then we're enabled | ||
| if(casted->get_tp_generation_enabled()){return false;} | ||
| } | ||
| } | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
| } // namespace appmodel | ||
| } // namespace dunedaq | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use the same logic as at line 50 where you will at least be consistent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah because I was being silly! Will fix in a moment