OP-2642 - added subset filter to limit Slack notifications

This commit is contained in:
Petr Kalis 2022-02-21 13:55:24 +01:00
parent 8565a44a1a
commit dbcb8f63e3
4 changed files with 16 additions and 1 deletions

View file

@ -411,9 +411,11 @@ class CollectTextures(pyblish.api.ContextPlugin):
Raises:
ValueError - if broken 'input_naming_groups'
"""
self.log.info("{} {} {}".format(name, input_naming_patterns, input_naming_groups))
for input_pattern in input_naming_patterns:
for cs in color_spaces:
pattern = input_pattern.replace('{color_space}', cs)
self.log.info("{} {}".format(pattern, name))
regex_result = re.findall(pattern, name)
if regex_result:
idx = list(input_naming_groups).index(key)
@ -424,6 +426,7 @@ class CollectTextures(pyblish.api.ContextPlugin):
try:
parsed_value = regex_result[0][idx]
self.log.info("par{}".format(parsed_value))
return parsed_value
except IndexError:
self.log.warning("Wrong index, probably "

View file

@ -20,18 +20,23 @@ class CollectSlackFamilies(pyblish.api.InstancePlugin):
def process(self, instance):
task_name = io.Session.get("AVALON_TASK")
family = self.main_family_from_instance(instance)
key_values = {
"families": family,
"tasks": task_name,
"hosts": instance.data["anatomyData"]["app"],
"subsets": instance.data["subset"]
}
profile = filter_profiles(self.profiles, key_values,
logger=self.log)
if not profile:
self.log.info("No profile found, notification won't be send")
return
# make slack publishable
if profile:
self.log.info("Found profile: {}".format(profile))
if instance.data.get('families'):
instance.data['families'].append('slack')
else:

View file

@ -10,6 +10,7 @@
"hosts": [],
"task_types": [],
"tasks": [],
"subsets": [],
"channel_messages": []
}
]

View file

@ -69,6 +69,12 @@
"type": "list",
"object_type": "text"
},
{
"key": "subsets",
"label": "Subset names",
"type": "list",
"object_type": "text"
},
{
"type": "separator"
},