DQMH Consortium Toolkits Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read from all your cloneables at once?

Solved!
Go to solution

If I have lets say 10 cloneable modules then is there a way to call the "GimmeTheResult" request using module ID -1 and get the result in an array?

 

I can read them one by one in a for loop (but if returning the result takes time then getting all results might take a long time), or I can send them the request and register for their broadcast messages to get the result.

 

Is there an easier way?

0 Kudos
Message 1 of 6
(785 Views)
Solution
Accepted by topic author 1984

Very timely, we just discussed this internally.

 

Long story short: There is not "an easier way" built into the DQMH framework (edited for clarity). Either of the options you listed (individual request w/ reply to each module or broadcast) is valid and it depends on the use case which one fits better.

 

In our Dokuwiki, we added this:

 

  • Cloneable modules share their event references: The first started clone instance creates them for all, and the last clone instance that stops destroys them
    • Do not use “Request and Wait for Reply” with module ID set to -1, as only one instance will actually respond (all the others will not be able to as the Notifier reference is closed with the first response). Instead, either send individual R&W4R's to each instance, or use a broadcast to collect responses from all instances.

 




DSH Pragmatic Software Development Workshops (Fab, Steve, Brian and me)
Release Automation Tools for LabVIEW (CI/CD integration with LabVIEW)
HSE Discord Server (Discuss our free and commercial tools and services)
DQMH® (Developer Experience that makes you smile )


0 Kudos
Message 2 of 6
(758 Views)

The "easier way" is a messaging pattern called Scatter-Gather where one sends the message to all Modules in parallel and waits for all existing Modules to reply, then returns an array of replied info.  But I don't know how easy this would be to add to DQMH. 

0 Kudos
Message 3 of 6
(734 Views)

@drjdpowell wrote:

The "easier way" is a messaging pattern called Scatter-Gather where one sends the message to all Modules in parallel and waits for all existing Modules to reply, then returns an array of replied info.  But I don't know how easy this would be to add to DQMH. 


I would guess one would need a thin async module to actually do the requests and collect the responses before passing it back to the true caller. I think this is basically how you do it in messenger library, but the less coupled address architecture makes it much simpler. I think for DQMH one would need to use something like HSE's generic system request. So you would probably lose the strict type restrictions, the message would go to EVERY module regardless of type, and the relevant modules would have to detect that it was for them? Just basing this off memory so I may be amiss.

Message 4 of 6
(729 Views)

@drjdpowell wrote:

The "easier way" is a messaging pattern called Scatter-Gather where one sends the message to all Modules in parallel and waits for all existing Modules to reply, then returns an array of replied info.  But I don't know how easy this would be to add to DQMH. 


Thanks, James, for pointing this out. I edited my post to say "there is no easier way built into the DQMH framework".




DSH Pragmatic Software Development Workshops (Fab, Steve, Brian and me)
Release Automation Tools for LabVIEW (CI/CD integration with LabVIEW)
HSE Discord Server (Discuss our free and commercial tools and services)
DQMH® (Developer Experience that makes you smile )


0 Kudos
Message 5 of 6
(699 Views)

I haven't looked at DQMH in a while, but I suspect one could add this feature.  One would need to substitute a Queue for the Notifier that returns replies, and you would wait for the right number of replies (this requires that you know exactly how many clones are running).

Message 6 of 6
(670 Views)