← Back to team overview

launchpad-dev team mailing list archive

Script and Cronscript updates

 

Some changes have landed recently to make script wragling better.

Now for scripts and cronscripts, the --log-file argument has been
decoupled from the stderr verbosity settings. It has also been
extended to specify the level of messages that go into the log file.
So now the following will emit WARNING and above messages to stderr,
and log DEBUG and above messages to the given file:

foo.py -q --log-file=/var/logs/foo.log

logrotate can be used to rotate the logs - the Python logging system
watches for rotation and handles things gracefully.


Cronscripts now generate OOPS reports for WARNING and above log
messages. Other scripts do not (they could, but it didn't seem to make
much sense).


We also have a config file that can be retrieved from a URL to enable
or disable cronscripts individually or in bulk. The default config
file location is file:cronscripts.ini (relative to the tree root, so
cronscripts.ini in the root of the tree), and can be overridden by
setting cron_control_url in the [canonical] section of the active
launchpad-lazr.conf file. The file can look like this:

"""
[DEFAULT]
enabled = True

[checkwatches]
enabled = False
"""

If a script can't find its own section, the DEFAULT is used. If the
config cannot be loaded or parsing fails, things default to enabled.
Scripts emit an INFO message if they are disabled. The script names
are the same ones the monitoring scripts look for.

Our first use of this could be to disable staging cronscripts during
staging updates - if they kick in at the wrong time during the update
it can cause deadlocks and the update to abort, like we saw yesterday.

-- 
Stuart Bishop <stuart@xxxxxxxxxxxxxxxx>
http://www.stuartbishop.net/



Follow ups