unexpected behavior in exclude/include in workflow api funtionality
Describe the bug In collaborator workflow steps, if the first exclude/include argument is not in the collaborator FLSpec the whole filter attributes is bypassed.
To Reproduce Steps to reproduce the behavior:
- Create workflow
- Create step for collaborators self.next( self.col_step, foreach="collaborators", exclude=["attribute_not_in_collaborator", "attribute_in_collaborator"], )
- The collaborator will still have "attribute_in_collaborator" because it doesn't have "attribute_not_in_collaborator"
Expected behavior Either any attributes in the list that are in the collaborator FLSpec should be filtered or an error should be raised informing that " they are trying to delete attributes not in the collaborator FLSpec"
Screenshots
if exclude or include [0] not in clone no attributes are filtered
Desktop (please complete the following information): Ubuntu 18.4
Summary: Issue reported could not be reproduced. Request if details of the flow where this issue is observed could be shared
Reproduction summary: Based on issue description, following steps were tried in 101_MNIST tutorial to reproduce the issue. However, in each trial an exception was raised indicating that the attributes are filtered properly. These steps were tried out in LocalRuntime as well as Aggregator Based Workflow
Trial 1 def start: ... self.next( self.aggregated_model_validation, foreach="collaborators", exclude=[“random”,”private”])
Trial 2 def aggregated_model_validation: ... self.next( self.train, foreach=“collaborators", exclude=[“random”,”agg_validation_score”])
Trial 3 def train: … self.next(self.local_model_validation, foreach = “collaborators”, exclude = [“attribute_not_in_collaborator”,“optimizer”]
Trial 4: def local_model_validation: … self.next(self.join, exclude = [“randomized”,”training_completed”]
Code Analysis: Further analysis of code indicates that the described problem shall always raise an exception in self.next when filter_attributes() is called. As per the snippet below, an exception is raised if any attribute specified in exclude is not present in cls_attrs
elif "exclude" in kwargs:
assert isinstance(kwargs["exclude"], list)
for in_attr in kwargs["exclude"]:
if in_attr not in cls_attrs:
raise RuntimeError(f"argument '{in_attr}' not found in flow task {f.__name__}")
As per the last comment, this issue cant be reproduced, hence closing it.