EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Notifying systemd when IOC start is complete (plus showing progress)
From: "Konrad, Martin via Tech-talk" <tech-talk at aps.anl.gov>
To: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Mon, 22 Jun 2020 22:46:18 +0000
Hi,
On 6/19/20 9:20 AM, Ben Franksen via Tech-talk wrote:
> I understand the motivation here but I guess this will not be as 
> useful in practice as you imagine it to be. Knowing whether an IOC
> is "running" or not is very little information.
True. But knowing that several hundred IOC processes are running after
deploying an update might be exactly the kind of information I'm after.
It is the fact that it all boils down to a simple "running" vs. "dead"
that allows me to feed this information into our IT monitoring system
which is already monitoring the health of all the other services running
on our Linux machines. Note that I'm getting this kind of monitoring
more or less for free. There's only thing we have to do to get the most
out of it: we have to make our IOC service behave as similar as possible
to other services.

> There is also the question when you regard an IOC as "running". Is
> that after the process was started? After iocInit? Or after all CA 
> connections have connected?
I think for most use-cases an IOC cannot be considered fully operational
until it has completed iocInit(). But sometimes we might also want to
wait for autosave to complete and all finite-state machines to start up.
You have a point here: Different use cases certainly come with different
requirements. We need something flexible.

> And how do you signal readiness to systemd? Make the IOC core depend
> on the sd-notify API?
I first thought about that but that would obviously require modifying
EPICS Base or writing a extension (which sounds like overkill for
essentially one line of code). But looking at the systemd documentation
I realized that there is actually a simpler way that I wasn't aware of
so far: Adding the following line at the end of st.cmd does the trick:

system '/usr/bin/systemd-notify --ready'

systemd-notify simply wraps sd-notify. This of course requires

Type=notify
NotifyAccess=all

in the foo.service file. The advantage of this compared to writing an
extension? Users can put the call wherever they desire in their st.cmd
file :-) With a few more lines it is even possible to communicate
information on the IOC start progress to systemd (which can be useful
for large IOCs that take some time to start). See [1] in case you're
interested in a little demo.

Cheers,

Martin

[1] https://youtu.be/uzvn67aVXnQ

-- 
Martin Konrad
Facility for Rare Isotope Beams
Michigan State University
640 South Shaw Lane
East Lansing, MI 48824-1321, USA
Tel. 517-908-7253
Email: konrad at frib.msu.edu

Replies:
Re: Notifying systemd when IOC start is complete (plus showing progress) Ben Franksen via Tech-talk
References:
How to run IOC in docker containers properly xiao zhang via Tech-talk
Re: How to run IOC in docker containers properly Johnson, Andrew N. via Tech-talk
Re: How to run IOC in docker containers properly Ben Franksen via Tech-talk
Re: How to run IOC in docker containers properly J. Lewis Muir via Tech-talk
Re: How to run IOC in docker containers properly Johnson, Andrew N. via Tech-talk
Re: How to run IOC in docker containers properly Konrad, Martin via Tech-talk

Navigate by Date:
Prev: Re: SRQ over VXI Mark Rivers via Tech-talk
Next: Does IOC name have any restrictions ? Hitesh Dhola via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
Navigate by Thread:
Prev: Re: How to run IOC in docker containers properly Ben Franksen via Tech-talk
Next: Re: Notifying systemd when IOC start is complete (plus showing progress) Ben Franksen via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
ANJ, 24 Jun 2020 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·