12This script provides callback functions to use the recommended global tags.
15from basf2
import B2INFO
17from versioning
import recommended_global_tags_v2
20def _get_recommended_tags(base_tags, user_tags, metadata):
21 """Get the recommendation from versioning and print a message if there is one"""
23 recommendation = recommended_global_tags_v2(get_release(), base_tags, user_tags, metadata)
24 if 'message' in recommendation.keys():
25 B2INFO(
'Your global tag manager says: ' + recommendation[
'message'])
26 return recommendation[
'tags']
30 """Return concatenated list of GTs"""
31 return sum((entry
for entry
in tags
if entry
is not None), [])
34def recommended_tags(base_tags, user_tags, metadata):
35 """Return the the user GTs + the recommended GTs"""
37 recommendation = _get_recommended_tags(base_tags, user_tags, metadata)
38 return _join_tags(user_tags, recommendation)
41def recommended_analysis_tags(base_tags, user_tags, metadata):
42 """Return the the user GTs + the recommended analysis GTs + the base tags"""
44 recommendation = [tag
for tag
in _get_recommended_tags(base_tags, user_tags, metadata)
if tag.startswith(
'analysis')]
45 return _join_tags(user_tags, recommendation, base_tags)