-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ref(workflow_engine): Refactor the process_data_condition_group
method
#84809
Conversation
… composable. moving the processing methods and separating from pure logic evaluation
…is will allow us to reuse the condition processor and allow other areas to define the data coming in. this is especially useful with delayed processing
…ta_conditions -- seems like a really good break down
…sults to match pattern where processors are expected to be used more externally
) -> DataConditionGroupResult: | ||
# TODO - @saponifi3d - refactor the DataConditionGroup.Type (logic_type) so we can use it as a mypy type as well. | ||
def evaluate_data_conditions( | ||
conditions_to_evaluate: list[tuple[DataCondition, T]], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
many a tuple
|
||
return evaluate_condition_group(group, value) | ||
return (logic_result, condition_results), remaining_conditions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the reason for returning a tuple here? because ProcessedDataConditionResult
is already a type and we're just returning something in addition to that (remaining_conditions
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep! i found that super helpful in all the places we're using the processor
method, i could drop results as needed for different areas and it would allow us to easily add features like enqueuing slow conditions for detector triggers in the future.
Description
Refactor
process_data_condition_group
to be the method that handles fast / slow splitting and gathering conditions.Introduces a new method,
evaluate_data_conditions
that takes a list of tuples; the data condition and the value to evaluate against. This method will iterate through each of the conditions + values, and then apply logic gates accordingly. This method will be reused indelayed_processing
where each condition has different query results to evaluate for the larger data condition group.