You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Arm backend: Make stage ids unique in the Arm TestPipeline (#8338)
Some stages in the TestPipeline may be added multiple times, such as .check(). To be able to target these by id, give them an unique suffix -> 'id.suffix'
Refering to stages in terms of id instead of an index is more self documenting and future proof.
This change modifies the add/pop_stage interface:
- pos arg in add_stage is now an optional kwarg, appending to the pipline as default
- suffix is added to add_stage as an optional_kwarg. If a suffix is not given to a non unique stage, a number is added instead.
- pop_stage now allows to use ids for referring to stages.
Additionally adds .visualize(stage) for quickly adding visualizing stages to the pipeline.
logger.debug(f"Added stage {func.__name__} to {type(self).__name__}")
162
+
logger.debug(f"Added stage {stage_id} to {type(self).__name__}")
122
163
123
164
returnself
124
165
125
-
defpop_stage(self, pos: int):
166
+
defpop_stage(self, identifier: int|str):
126
167
"""Removes and returns the stage at postion pos"""
127
-
returnself._stages.pop(pos)
168
+
ifisinstance(identifier, int):
169
+
stage=self._stages.pop(identifier)
170
+
elifisinstance(identifier, str):
171
+
pos=self.find_pos(identifier)
172
+
stage=self._stages.pop(pos)
173
+
174
+
logger.debug(f"Removed stage {stage.id} from {type(self).__name__}")
175
+
176
+
returnstage
128
177
129
178
deffind_pos(self, stage_id: str):
130
-
"""Returns the position of the stage id. Note that this only finds the first stage with the given id, i.e. it should only be used with unique stages."""
179
+
"""Returns the position of the stage id."""
131
180
fori, stageinenumerate(self._stages):
132
181
ifstage.id==stage_id:
133
182
returni
134
183
135
184
raiseException(f"Stage id {stage_id} not found in pipeline")
"""Adds a stage after the given stage id. Note that this only finds the first stage with the given id, i.e. it should only be used with unique stages."""
"""Adds a dump_artifact stage after the given stage id. Note that this only finds the first stage with the given id, i.e. it should only be used with unique stages."""
"""Adds a dump_operator_distribution stage after the given stage id. Note that this only finds the first stage with the given id, i.e. it should only be used with unique stages."""
"""Updates the args to the given stage id. Note that this only finds the first stage with the given id, i.e. it should only be used with unique stages."""
0 commit comments