python-common issueshttps://gitlab.mpcdf.mpg.de/nomad-lab/python-common/-/issues2018-09-12T17:55:25Zhttps://gitlab.mpcdf.mpg.de/nomad-lab/python-common/-/issues/1Individual onClose triggers for SimpleMatchers2018-09-12T17:55:25ZLauri HimanenIndividual onClose triggers for SimpleMatchersTo transform collected information into meaningful quantities there currently exist "onClose" triggers that are called when a section closes. There are however situations where the same section will be opened on multiple separate occasio...To transform collected information into meaningful quantities there currently exist "onClose" triggers that are called when a section closes. There are however situations where the same section will be opened on multiple separate occasions but one wishes not to use the same "onClose" trigger. One can circumvent this problem by creating new sections that are created only for this purpose, have unique names and unique "onClose" triggers but this seems cumbersome.
An example: A SimpleMatcher opens a section "settings_run" and collects information by caching different metainfos. At the end of the SimpleMatcher the "settings_run" closes and an "onClose_settings_run" trigger gets called. In this trigger the different information are gathered and transformed and pushed to the backend. Later on another SimpleMatcher again opens the "settings_run" section to parse more information into it. This time the "onClose_settings_run" trigger shouldn't be called because completely new information is parsed. The workaround would be to create completely new sections just in order to fire different onClose triggers. This would require modifying the metainfo files, and possibly creating completely "meaningless" sections that are there just in order to fire a trigger.
Is there a simple solution to this problem that I'm just not seeing? Should I just always create a new dummy section for this purpose? Otherwise I would suggest that the SimpleMatcher objects would have an attribute called "onClose" that is a function that gets called when the SimpleMatcher is finished. This function would get as parameters the backend and a dictionary of the metainfos that were parsed by this SimpleMatcher or by it's children. I can implement this functionality but first I have to get an approval.Mohamed, Fawzi Roberto (fawzi)fawzi.mohamed@fhi-berlin.mpg.deMohamed, Fawzi Roberto (fawzi)fawzi.mohamed@fhi-berlin.mpg.de