LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pausing multiple services

I have a system that runs several services in parallel each controls different hardware and each has it's own queue.  I have been tasked to implement a pause button on the main gui that will interrupt all services to pause them and restart where they left off when pause is turned off.  How do I make sure each of the parallel services are all stopping and restarting correctly?

mdtsnodog425

0 Kudos
Message 1 of 6
(1,269 Views)

Once we know your program architecture, we can come up with an easy solution.

 

(I won't make assumptions, so I won't even try to offer specific advice.)

 

What is a "service" in this context? What if a service is in the middle of doing something?

0 Kudos
Message 2 of 6
(1,244 Views)

This is a huge system that controls an automated sampling machine.  Each service is a separate queued message handler set up in a producer consumer architecture, and each service controls a different aspect of the hardware or data collection.  There are at least 8 services, each with between 10 and 30 cases in the consumer loop.  The machine that is having samples taken has recently changed to randomly to self tests throughout its operation, and we want the sampling to be paused while the test is going on.  In the event a service is doing something when the pause occurs we want it to stop what it is doing and restart at the same place it left off when the pause occurred. 

 

By the way, my company is very restrictive of what we can share outside the company, so I am unable to share any images.  We are using LabVIEW 2012.

0 Kudos
Message 3 of 6
(1,228 Views)

You will need some master level control task that will need to send a pause message to each of the services via its queue. this would be the most straightforward way given you have a QMH architecture. If all of your tasks also include an event structure, you could use a user event which would be broadcast to all registered tasks. If you don't currently have an event structure this would require adding it to all of your services. The other alternative would be to use a notifier  but this is the ugliest solution since your services would need to check both it's message queue and the notifier. However the notifier could use a timeout of 0 which would have minimal impact on performance.

 

In any case, you will need to modify all of your services to check for the pause/unpause message as well as to cache the current state so it can resume properly.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 6
(1,207 Views)

@Mark_Yedinak wrote:

You will need some master level control task that will need to send a pause message to each of the services via its queue. this would be the most straightforward way given you have a QMH architecture. If all of your tasks also include an event structure, you could use a user event which would be broadcast to all registered tasks. If you don't currently have an event structure this would require adding it to all of your services. The other alternative would be to use a notifier  but this is the ugliest solution since your services would need to check both it's message queue and the notifier. However the notifier could use a timeout of 0 which would have minimal impact on performance.

 

In any case, you will need to modify all of your services to check for the pause/unpause message as well as to cache the current state so it can resume properly.


Adding to Mark_Yedinak's points, you also need a way of acknowledgement from all services that they wrapped up their work and paused. This way you can execute any operation with confidence that it will never be interfered with by the services or vice versa.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 5 of 6
(1,200 Views)

Thank you.  I will try to implement these suggestions and let you know how it goes.

0 Kudos
Message 6 of 6
(1,175 Views)