[weewx-user] Re: (Off Topic?) How does weewx tell systemctl it is running

2019-01-19 Thread vk3anz
OK - I found the problem and the underlying fault is mine (as usual)!
What was happening is, during the startup phase, the driver was reading the 
'historic' records from the weather station. It reads these in batches and 
then processes therm into the database (and any other places that Weewx 
sends the records - in my case this is WOW, CWOP and the local 
Meteotemplate).
It then goes back to read the next batch of records and repeats until it is 
up to date. It then moves to the normal loop phase.
What was happening is that the time to process each 'batch' of records 
(about 2 minutes as it turned out) was longer than the weather station 
maintained the link - when the driver went back to read the next match it 
got a 'broken pipe' error. However, in trying to get things written in the 
first place, I had inadvertently told Python to let the default error 
handler process this error which it did by silently stopping the 
program.
The solution is to process in smaller batches, let Python tell the program 
of the error and then handle it properly.
As far as systemd is concerned, it saw the program stop and restarted it, 
so it was doing exactly what it was supposed to do.
During the initial testing, I was processing the historical records only 
back to the database and so it was occurring fairly quickly. I suspect (but 
have not confirmed) that adding in the connections to the other places - 
especially WOW as I get a number of log entries about retry failures to 
there - has added the extra time and led to the 'broken pipe' timeout.
I've re-written that part of the driver and loaded it back into the Github 
repository.
Susan

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[weewx-user] Re: (Off Topic?) How does weewx tell systemctl it is running

2018-12-16 Thread vince
On Sunday, December 16, 2018 at 6:00:04 PM UTC-8, vk3...@gmail.com wrote:
>
>
> So the question now seems to be why systemd is not detecting (on its own) 
> that weewx is running while it is reading the historical records, but is 
> detecting that it is running once that is complete?
>
>
>
Lets go back to the usual beginning...

   - did you install with apt-get or with setup.py ?
   - did you do anything to create your own startup file perhaps ?

>From your logs, it looks like it references /home/weewx so that means 
setup.py was used (?)

Also your version 3.6.2 is 'really' old.  I know things were done to deal 
better with systemd, but I can't recall when exactly.

 

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[weewx-user] Re: (Off Topic?) How does weewx tell systemctl it is running

2018-12-16 Thread vk3anz
Thanks everyone.

Some responses:
- the log I showed in the OP was from journalctl - thanks for the 
suggestion though
- I didn't think that weewx as doing something special during the 
'genStartupRecords' step but I just wanted to check
- I did Google those messages and (as with the replies here) they so often 
degenerate into a 'systemd is bad/dumb/' argument without 
addressing the underlying issue/questions being asked; also running the 
latest Rasbian versions you don't really have a choice as the SysV init 
files are used to dynamically create the service files - that is why I 
created my own as the conversion did not do any of the required dependency 
checking.
- weewx *is * being stopped and started again as the snippets of  the log 
show - and there is only one process with weewx running in it on the system 
as a 'ps -aux' shows
- learning what I can about systemd, I suspect that the message about 
monitoring the PID file is a bit misleading; it would appear to come up 
when systemd finds a PID file already in existence but the process not 
running and restarts a new process - the new PID file does hold the new 
Process ID and the PID reported is the correct new one
- mwall - the thread you referenced has my comments in it already; the key 
difference is that the original question there does not reference any error 
messages before the crash - at least I'm getting that one about the holdoff 
timer (even if I still don't understand why). Also the system  itself keeps 
running in my case rather than what appears to be a (silent) system crash

So the question now seems to be why systemd is not detecting (on its own) 
that weewx is running while it is reading the historical records, but is 
detecting that it is running once that is complete?

Back to the books (err Google searches).

Thanks all

Susan

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[weewx-user] Re: (Off Topic?) How does weewx tell systemctl it is running

2018-12-12 Thread vince
On Wednesday, December 12, 2018 at 1:03:02 AM UTC-8, mwall wrote:
>
>  (systemd is *supposed* to be just an init system, but it continues to 
> extend beyond that, much like a virus or poorly designed/implemented 
> software)
>
>
>
Let it go man, the sysV init and anybody-but-systemd camps lost that war 
years ago..
(although yes, it is sure a Borg, much like NetworkManager is becoming)

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[weewx-user] Re: (Off Topic?) How does weewx tell systemctl it is running

2018-12-12 Thread vince
On Tuesday, December 11, 2018 at 1:19:53 AM UTC-8, vk3...@gmail.com wrote:

> Does anyone know what weewx does when in the main packet loop that tells 
> systemctl that the service is running in the 'genLoopPackets' area that it 
> does not do in the 'genStartuprecords' space?
>
>
>
Try a little googling for the messages you mentioned, with 'weewx' and any 
process IDs omitted from your query

   - google for => "systemd[1]: holdoff time over, scheduling restart."
   - google for => "systemd[1] Supervising process which is not our child. 
   We'll most likely not notice when it exits."



-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[weewx-user] Re: (Off Topic?) How does weewx tell systemctl it is running

2018-12-12 Thread tomnykds
BTW, if there's nothing useful in /var/log/messages (or where ever you log 
weewx), try journalctl (that's a cmd).  It dumps systemd's log.
googling that message does imply that weewx crashed, so also check the log 
for weewx's pid before and after you see that.

Chris

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[weewx-user] Re: (Off Topic?) How does weewx tell systemctl it is running

2018-12-12 Thread mwall


On Tuesday, December 11, 2018 at 4:19:53 AM UTC-5, vk3anz wrote:
>
>
> Does anyone know what weewx does when in the main packet loop that tells 
> systemctl that the service is running in the 'genLoopPackets' area that it 
> does not do in the 'genStartuprecords' space?
>

weewx does not know or care about systemd.  nor should it.  (systemd is 
*supposed* to be just an init system, but it continues to extend beyond 
that, much like a virus or poorly designed/implemented software)

could you verify that weewx is actually running continuously through these 
episodes?

it is possible that you are experiencing the same sudden-cessation-of-weewx 
that was reported in this thread:

https://groups.google.com/forum/#!topic/weewx-user/oSN_aT6MA-4

and systemd is simply starting a new weewx process since it noticed that 
the original process is now dead.

this message:

Dec 11 20:02:08 weather systemd[1]: Stopping weewx weather system...

might be misleading - systemd is probably not, in fact, stopping weewx.  it 
is probably just cleaning up whatever it uses to keep track of the weewxd 
process.

m

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[weewx-user] Re: (Off Topic?) How does weewx tell systemctl it is running

2018-12-11 Thread gjr80
Susan,

No systemd expert by a long shot but I can't say I have ever seen anything 
like

Dec 11 20:02:08 weather systemd[1]: weewx.service holdoff time over, 
scheduling restart.

before.


As for weeWX changing from genStartupRecords to genLoopPackets, as far as I 
am aware there is no interaction with systemd. When the weeWX engine starts 
up one of the things it does is have the StdArchive service attempt to do a 
catchup which involves a call to genStartupRecords. If there are any 
records to catchup they are downloaded and processed, no notification to 
anything outside of weeWX. WeeWX then moves on and when the main packet 
loop is started genLoopPackets takes over.

Tom or Matthew may be able to add more, but I am fairly certain weeWX is 
not dealing with systemd other than the normal daemon 
start/stop/load/status activities.

Gary

On Tuesday, 11 December 2018 19:19:53 UTC+10, vk3...@gmail.com wrote:
>
> (Note: Probably off topic but weewx related)
>
> I am running weewx (on a raspberry Pi Zero) and I'm seeing something that 
> I can't explain
>
> Using my HP1000 driver to access my WS1001, weewx and the driver seem to 
> be doing what they should in that the driver is reading the old records 
> that it missed while it was stopped as shown in the following log:
>
> Dec 11 20:02:02 weather weewx[1181]: manager: added record 2018-12-11 19:
> 47:51 AEDT (1544518071) to daily summary in 'weewx.sdb'
>
> Dec 11 20:02:02 weather weewx[1181]: manager: added record 2018-12-11 19:
> 52:51 AEDT (1544518371) to database 'weewx.sdb'
>
> Dec 11 20:02:02 weather weewx[1181]: manager: added record 2018-12-11 19:
> 52:51 AEDT (1544518371) to daily summary in 'weewx.sdb'
>
> Dec 11 20:02:02 weather weewx[1181]: restx: Meteotemplate: Published 
> record 2018-12-11 19:47:51 AEDT (1544518071)
>
> Dec 11 20:02:02 weather weewx[1181]: restx: WOW: Published record 2018-12-
> 11 15:37:51 AEDT (1544503071)
>
> Dec 11 20:02:08 weather systemd[1]: weewx.service holdoff time over, 
> scheduling restart.
>
> Dec 11 20:02:08 weather systemd[1]: Stopping weewx weather system...
>
> Dec 11 20:02:08 weather systemd[1]: Starting weewx weather system...
>
> Dec 11 20:02:08 weather systemd[1]: Started weewx weather system.
>
> Dec 11 20:02:09 weather weewx[1274]: engine: Initializing weewx version 
> 3.6.2
>
> Dec 11 20:02:09 weather weewx[1274]: engine: Using Python 2.7.9 (default, 
> Sep 26 2018, 05:58:52) 
>
>  [GCC 4.9.2]
>
> Dec 11 20:02:09 weather weewx[1274]: engine: Platform Linux-4.9.35+-armv6l
> -with-debian-8.0
>
> Dec 11 20:02:09 weather weewx[1274]: engine: pid file is /var/run/weewx.
> pid
>
> Dec 11 20:02:09 weather systemd[1]: weewx.service: Supervising process 
> 1278 which is not our child. We'll most likely not notice when it exits.
>
> Dec 11 20:02:09 weather weewx[1278]: engine: Using configuration file 
> /home/weewx/weewx.conf
>
> Dec 11 20:02:09 weather weewx[1278]: engine: Loading station type HP1000 
> (user.HP1000)
>
> Then after about 2 minutes of weewx running, I get the message from 
> systemctl that the holdoff time is over and it restarts the service.
>
> However, when all of the historic records have been read and weewx starts 
> its main loop, then the service is not restarted by systemctl:
>
> Dec 11 20:02:10 weather weewx[1278]: engine: Starting up weewx version 3.6
> .2
>
> Dec 11 20:02:11 weather weewx[1278]: HP1000: Connected to address (
> '10.1.1.97', 53495)
>
> Dec 11 20:02:12 weather weewx[1278]: HP1000: Established contact at 11/12/
> 18 20:02:12
>
> Dec 11 20:02:12 weather weewx[1278]: HP1000: Retrieving startup records
>
> Dec 11 20:02:30 weather weewx[1278]: engine: Starting main packet loop.
>
> Dec 11 20:03:22 weather wpa_supplicant[453]: wlan0: WPA: Group rekeying 
> completed with b8:8d:12:5f:bf:7b [GTK=CCMP]
>
> Dec 11 20:04:00 weather python[705]: INFO:apscheduler.executors.default:
> Running job "bomIRJob (trigger: cron[minute='4-55/10'], next run at: 
> 2018-12-11 20:04:00 AEDT)" (scheduled at 2018-12-11 20:04:00+11:00)
>
> Dec 11 20:04:00 weather animatedgif.py[705]: Running BoM IR Satellite at 
> 11/12/2018 20:04:00
>
> Dec 11 20:04:00 weather python[705]: INFO:apscheduler.executors.default:
> Running job "bomRadarJob (trigger: cron[minute='4-58/6'], next run at: 
> 2018-12-11 20:04:00 AEDT)" (scheduled at 2018-12-11 20:04:00+11:00)
>
> Dec 11 20:04:00 weather animatedgif.py[705]: Running BoM Radar at 11/12/
> 2018 20:04:00
>
> Dec 11 20:04:05 weather python[705]: INFO:apscheduler.executors.default:
> Job "bomRadarJob (trigger: cron[minute='4-58/6'], next run at: 2018-12-11 
> 20:10:00 AEDT)" executed successfully
>
> Dec 11 20:05:01 weather CRON[1284]: pam_unix(cron:session): session 
> opened for user root by (uid=0)
>
> Dec 11 20:05:01 weather CRON[1288]: (root) CMD (command -v debian-sa1 > 
> /dev/null && debian-sa1 1 1)
>
> Dec 11 20:05:01 weather CRON[1284]: pam_unix(cron:session): session 
> closed for user root
>
> Dec 11 20:05:24 

[weewx-user] Re: (Off Topic?) How does weewx tell systemctl it is running

2018-12-11 Thread tomnykds
Try 
here: https://people.redhat.com/mskinner/rhug/q1.2014/Demystifying_Systemd.pdf

Not an answer, but background.  On a new box I'm setting up, I went as far 
as finding a distribution
that doesn't use systemd, if that ways anything.

Chris

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.