Skip to content
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

Merged
merged 5 commits into from
Feb 8, 2025

Conversation

saponifi3d
Copy link
Contributor

@saponifi3d saponifi3d commented Feb 7, 2025

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 in delayed_processing where each condition has different query results to evaluate for the larger data condition group.

… 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
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Feb 7, 2025
…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]],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😻

@saponifi3d saponifi3d marked this pull request as ready for review February 7, 2025 21:10
@saponifi3d saponifi3d requested a review from a team as a code owner February 7, 2025 21:10
Copy link
Member

@cathteng cathteng left a 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
Copy link
Member

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)?

Copy link
Contributor Author

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.

@saponifi3d saponifi3d merged commit 96e9fb6 into master Feb 8, 2025
49 checks passed
@saponifi3d saponifi3d deleted the jcallender/aci/ref-data-condition-eval branch February 8, 2025 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants