diff --git a/src/graph_scheduler/scheduler.py b/src/graph_scheduler/scheduler.py index d5168f8..2c3525f 100644 --- a/src/graph_scheduler/scheduler.py +++ b/src/graph_scheduler/scheduler.py @@ -776,6 +776,29 @@ def add_condition_set(self, conditions): self.conditions.add_condition_set(conditions) self._handle_modified_structural_conditions() + def remove_condition( + self, owner_or_condition: Union[Hashable, typing_condition_base] + ) -> Union[typing_condition_base, None]: + """ + Removes the condition specified as or owned by + **owner_or_condition**. + + Args: + owner_or_condition (Union[Hashable, `ConditionBase`]): + Either a condition or the owner of a condition + + Returns: + The condition removed, or None if no condition removed + + Raises: + ConditionError: + - when **owner_or_condition** is an owner and it owns + multiple conditions + - when **owner_or_condition** is a condition and its + owner is None + """ + return self.conditions.remove_condition(owner_or_condition) + ################################################################################ # Validation methods # to provide the user with info if they do something odd