Skip to content

Commit

Permalink
Scheduler: add remove_condition wrapper method
Browse files Browse the repository at this point in the history
  • Loading branch information
kmantel committed Dec 13, 2023
1 parent 0168d25 commit 81198a2
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/graph_scheduler/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 81198a2

Please sign in to comment.