Skip to content

Create event with labels

Tanner Prestegard requested to merge create_event_with_labels into master

Adds a 'labels' argument to the createEvent() method. 'labels' can be specified as a string (for a single label) or a list of strings (for one or more labels). 'labels' is then joined into a comma-separated string for passing to the server, which parses the string and adds the labels.

Adds the allowed_labels property to the GraceDb class, which gets the list of available labels from the server. This is used to test the labels submitted by the user and raise an exception if it doesn't match a label in the list.

Adds unit tests for testing this feature and for testing removal of labels. I've run the unit tests successfully and manually tested creating events with no labels, one label, several labels, bad labels, etc. to ensure that it works as expected.

This patch should be coordinated with the merge request to the server code shown here: https://git.ligo.org/lscsoft/gracedb/merge_requests/3. It cannot function properly unless the server code patch is already in place.

Merge request reports