Skip to content
Snippets Groups Projects

Make "process" a required input and configure pyconf functions globally once with user input

Merged Abhijit Mathad requested to merge AM_process into master
1 file
+ 19
1
Compare changes
  • Side-by-side
  • Inline
@@ -11,6 +11,7 @@
from contextlib import contextmanager
from typing import Optional
from GaudiConf.LbExec import Options as DefaultOptions, ProcessTypes
from pydantic import root_validator
from PyConf.reading import (upfront_decoder, reconstruction, get_tes_root,
get_odin, get_hlt_reports, get_mc_track_info)
@@ -48,13 +49,30 @@ class Options(DefaultOptions):
metainfo_additional_tags: Optional[list]
annsvc_config: Optional[str]
process: ProcessTypes
stream: str = "default"
stream: Optional[str] = 'default'
lumi: bool = False
evt_pre_filters: Optional[dict[str, str]] = None
enable_unpack: bool = True
write_fsr: bool = True
merge_genfsr: bool = False
@root_validator(pre=False)
def _stream_default(cls, values):
"""
This is a validator that sets the default "stream" value based on "process"
Args:
values (dict): User-specified attributes of the Options object.
Returns:
dict: Modified attributes of the Options object
"""
process = values.get("process")
if process == ProcessTypes.Hlt2:
values['stream'] = ''
return values
@contextmanager
def apply_binds(self):
"""
Loading