Converts the given dictionary to WLCG message format.
- Parameters:
msg - A dictionary of key value pairs.
include_microseconds - If microseconds should be included in the date format, default
True.
The keys and values are converted to strings using str() with
the following exceptions:
-
if key is 'detailsData' and the value is a list or tuple,
then its value is converted to a multi-line string using
str() for each item and the WLCG-specified line separator.
-
if value is None, then it is converted to an empty string.
-
if value is an instance of datetime.datetime, and it is naive
(i.e. it contains no timezone info), then it is assumed to be
UTC and converted to the WLCG date format. i.e.
YYYY-MM-DDTHH:MM:SS.mmmmmmZ or YYYY-MM-DDTHH:MM:SSZ if
include_microseconds is False.
Apart from detailsData, which is by definition the final
entry, the entries are sorted according to natural ordering.
See also:
-
WLCG message format.
https://twiki.cern.ch/twiki/bin/view/LCG/GridMonitoringProbeSpecification#Message_Formats
-
WLCG date format.
https://twiki.cern.ch/twiki/bin/view/LCG/GridMonitoringProbeSpecification#Date_Formats
|