Skip to content

Superevent validator for CI tests

Added a SEventValidator class useful for end-to-end tests of the low-latency infrastructure.

Init

The class inherits from SEventCacheEntry, which is initialized by providing a cache path.

  • SEventValidator.from_sevent_id(): downloads the input S-event from the target GraceDB instance and returns a SEventValidator object.
  • SEventValidator.from_gevent_id(): downloads a G-event from the target GraceDB instance and queries for the associated superevent. It the calls SEventValidator.from_sevent_id().

Validation

The SEventValidator.validate() method loads the superevent description and compares the created labels and files with a checklist. It raises an error if any item is missing. It always produces a plot with a timeline reporting the creation time of each item.

CLI

The validation can be run via CLI with the meg validate command:

$ meg validate --help
                                                                                                                                                                                                                                           
 Usage: meg validate [OPTIONS] EVENTS...                                                                                                                                                                                                   
                                                                                                                                                                                                                                           
 Validate G-event or S-event.                                                                                                                                                                                                              
                                                                                                                                                                                                                                           
╭─ Arguments ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ *    events      EVENTS...  G-events or S-events to be validated. [default: None] [required]                                                                                                                                            │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --source                                 TEXT  GraceDB instance (production, playground, test, DEV, cnaf, local, mocked or <URL>) from which the original events are downloaded. [default: playground]                                  │
│ --cache-path                             PATH  Directory where the event's data files are downloaded. [default: /home/alessio/.cache/mock-event-generator]                                                                              │
│ --refresh-cache    --no-refresh-cache          If set, ignore the event's potential cache entry. [default: no-refresh-cache]                                                                                                            │
│ --save-plot-to                           PATH  Where the latency plot will be saved. [default: None]                                                                                                                                    │
│ --help                                         Show this message and exit.                                                                                                                                                              │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Examples

Click to expand

Validation passed:

meg validate --source=cnaf M0382 --refresh-cache --save-plot-to=./
2023-05-13 15:11:32 INFO     Downloading M0382 from GraceDB (cnaf)...
2023-05-13 15:11:46 INFO     Downloading MS230316m from GraceDB (cnaf)...
[ ... ]
2023-05-13 13:53:14 INFO     Validating MS230316m submitted 2023-03-16 12:45:13
[ ... ]
2023-05-13 13:53:15 INFO     Plot saved to MS230316m_latency_plot.png

Validation not passed:

meg validate --source=cnaf MS230513g --save-plot-to=./
2023-05-13 13:51:56 INFO     Validating MS230513g submitted 2023-05-13 07:18:59
[ ... ]
2023-05-13 13:51:56 INFO     Plot saved to MS230513g_latency_plot.png.
Validation failed for S-event MS230513g

MS230316m_latency_plot

Merge request reports