[sensors] Make AutomationConditionSensorDefinition entity limit configurable via max_entities#33917
Open
raghav-reglobe wants to merge 1 commit into
Open
Conversation
5035704 to
02383dc
Compare
Contributor
Comment on lines
254
to
256
| default_condition: AutomationCondition | None, | ||
| max_entities: int | None = None, | ||
| ) -> "AutomationConditionSensorDefinition": |
Contributor
There was a problem hiding this comment.
Remove the
= None default to satisfy the IHasInternalInit contract. The only caller (with_attributes) already passes this kwarg explicitly, so no callers break.
Suggested change
| default_condition: AutomationCondition | None, | |
| max_entities: int | None = None, | |
| ) -> "AutomationConditionSensorDefinition": | |
| default_condition: AutomationCondition | None, | |
| max_entities: int | None, | |
| ) -> "AutomationConditionSensorDefinition": |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
…gurable via max_entities The 500-entity limit on user-code automation condition sensors is currently a hardcoded module constant. Large external-asset graphs (thousands of assets materialized by out-of-process writers) need either dozens of sensors or a configurable ceiling. This adds an optional max_entities parameter (beta, requires use_user_code_server=True), keeping the 500 default unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
02383dc to
cef35a7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary & Motivation
User-code automation condition sensors (
use_user_code_server=True) are capped at a hardcodedMAX_ENTITIES = 500assets/checks. Deployments with large external-asset graphs (assets materialized by out-of-process writers, where customAutomationConditionsubclasses — which require the user-code-server path — drive scheduling) currently have to define dozens of sensors purely to satisfy the constant, even when a single selection is the natural unit.This makes the limit configurable via an optional
max_entitiesparameter (beta, requiresuse_user_code_server=True). The default behavior is unchanged (500), and the error message now points at the new parameter as one of the remediation options. The docstring already described the limit as what "currently" applies, suggesting it was intended to be tunable eventually.Test Plan
Extended
dagster_tests/definitions_tests/test_automation_condition_sensor_definition.py:use_user_code_server, mirroringdefault_condition)with_attributescopiesmax_entities=1000evaluates,max_entities=100raises with the lowered limitAll 8 tests in the file pass locally.
Changelog
AutomationConditionSensorDefinitionnow accepts an optionalmax_entitiesparameter (beta), allowing the default 500 assets-or-checks limit for user-code-server sensors to be adjusted.🤖 Generated with Claude Code