Registering your Validation Mode#
Step 1: Adding to mode_registration.py#
After the new mode is implemented, it needs to be registered under vibe/mode_registration.py. To do this we first need to import our new mode at the stop of the python file and then add it to the available_modes list, filling in the necessary variables, like so:
# vibe/mode_registration.py
from vibe.core.mode import Mode, ModeType
from vibe.core.helper.working_groups import DPGroup, SkimWorkingGroup
from vibe.analysis_validation_modes.example.docExampleMode_validation_mode import DocExampleMode
available_modes = [
# -- At the bottom of the list
Mode(
validation_class = DocExampleMode,
mode_type = ModeType.analysis_validation,
group = DPGroup.example
)
]
There are 3 variables that you must pass an argument to when registering your class.
validation_class: This is the name of your mode class you imported at the top of the script
mode_type: This is required to be some variant of ModeType, which is an enum. For validation modes, the variant we choose is the ModeType.analysis_validation, there are also ModeType.skim_production and ModeType.run_quality but more on those later
group: This is required to be some variant of DPGroup if ModeType.analysis_validation or SkimWorkingGroup if ModeType.skim_production. This is determined by the subdirectory you created your mode in. In our DocExampleMode we created the python file in vibe/analysis_validation_modes/examples/ and so we must choose the DPGroup.example variant. Other variants include DPGroup.physics and DPGroup.tracking
Step 2: Adding to the appropriate {group}_validation_modes.json#
Next we must register our new mode inside of the group’s JSON file like so:
{
"docExampleMode" : {
"dataset_dict" : {
"release-06-00-00" : {"lpn" : "/path/to/release-06-00-00/dataset/on/grid"},
"prerelease-07-00-00d" : {"lpn" : "/path/to/prerelease-07-00-00d/dataset/on/grid"}
},
"local_test_file" : "path/to/local/test/file.mdst.root"
}
}
The key things to note here are:
We must set the name of the mode to ma
Inside of our mode name, we must add two key-value pairs:
dataset_dict: This is a dictionary containing the LPN’s of the datasets you with to run validation over and are indexed by a unique identifier. This can be the specific release of the dataset, the type (data, charged, uubar etc) and so one
local_test_file: This is where you will put the path to the local test file which will be used to test locally your new validation Mode.
Version Update (v0.5.0)
In version 0.5.0 we have introduced additional functionality to be able to run mode releases locally in parallel to online modes (i.e sent to the grid). If you wish to set a release to be ran offline, you can pass offline=True, for example:
{
"docExampleMode" : {
"dataset_dict" : {
"release-06-00-00" : {"lpn" : "/path/to/release-06-00-00/dataset/on/grid"},
"prerelease-07-00-00d" : {"lpn" : "/path/to/prerelease-07-00-00d/dataset/on/grid"},
"offline_release" : {"lpn" : "path/to/local/ntuples", "offline" : true}
},
"local_test_file" : "path/to/local/test/file.mdst.root"
}
}
How this differs from the local_test_file is that the local_test_file is used in place of each releases assigned lpn when test_mode = True inside the config.yaml. When test_mode = False, we are conducting a full run of VIBE and in this instance, a release that is set to offline will be ran locally whilst all releases that do not pass this flag will be sent as jobs to the grid. Note that releases have offline=False by default and is not required when adding online releases.
And with that, our validation mode is officially registered and ready to be ran!