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

[amp-refactor][15/n] Rename AssetConditionCursor -> AssetConditionEvaluationState #19035

Merged
merged 1 commit into from
Jan 19, 2024

Conversation

OwenKephart
Copy link
Contributor

Summary & Motivation

After some deliberation, "cursor" seems to be a poor name for what these objects are actually tracking. Instead, we go with AssetConditionEvaluationInfo as a more general name.

We do still want to distinguish this object, which is used to index/checkpoint computation, from the AssetConditionEvaluationResult object, which contains only a subset of the total information (related to what was actually calculated on that tick)

This PR also removes the unnecessary AssetConditionEvaluationResult object that used to exist as an in-memory-only organizational tool, in light of the fact that we can just directly return AssetConditionEvaluationInfo objects from the body of the evaluate function.

How I Tested These Changes

@OwenKephart
Copy link
Contributor Author

OwenKephart commented Jan 4, 2024

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

@OwenKephart OwenKephart force-pushed the 01-03-Fix_non-subsettable_multi-asset_handling branch from f08149c to 7c58a41 Compare January 5, 2024 16:42
@OwenKephart OwenKephart force-pushed the 01-04-Rename_AssetConditionCursor branch from a4ccc5e to f7ef51e Compare January 5, 2024 16:42
@OwenKephart OwenKephart force-pushed the 01-04-Rename_AssetConditionCursor branch from f7ef51e to 0bd84b0 Compare January 8, 2024 20:40
@OwenKephart OwenKephart force-pushed the 01-03-Fix_non-subsettable_multi-asset_handling branch from 7c58a41 to 4583f25 Compare January 8, 2024 20:40
Copy link

github-actions bot commented Jan 8, 2024

Deploy preview for dagit-storybook ready!

✅ Preview
https://dagit-storybook-4ug7zbmak-elementl.vercel.app
https://01-04-Rename-AssetConditionCursor.components-storybook.dagster-docs.io

Built with commit 0bd84b0.
This pull request is being automatically deployed with vercel-action

Copy link

github-actions bot commented Jan 8, 2024

Deploy preview for dagster-university ready!

✅ Preview
https://dagster-university-h41vw8l2k-elementl.vercel.app
https://01-04-Rename-AssetConditionCursor.dagster-university.dagster-docs.io

Built with commit 0bd84b0.
This pull request is being automatically deployed with vercel-action

@OwenKephart OwenKephart force-pushed the 01-03-Fix_non-subsettable_multi-asset_handling branch from 4583f25 to dd4086f Compare January 9, 2024 17:08
@OwenKephart OwenKephart force-pushed the 01-04-Rename_AssetConditionCursor branch from 0bd84b0 to 26af907 Compare January 9, 2024 17:08
@OwenKephart OwenKephart force-pushed the 01-03-Fix_non-subsettable_multi-asset_handling branch from dd4086f to 18d1b83 Compare January 11, 2024 22:21
@OwenKephart OwenKephart force-pushed the 01-04-Rename_AssetConditionCursor branch from 26af907 to 0313f70 Compare January 11, 2024 22:22
@OwenKephart OwenKephart force-pushed the 01-04-Rename_AssetConditionCursor branch from e98b265 to 14d39a6 Compare January 12, 2024 18:02
@OwenKephart OwenKephart force-pushed the 01-03-Fix_non-subsettable_multi-asset_handling branch from 42b91bc to 309325a Compare January 12, 2024 22:12
@OwenKephart OwenKephart force-pushed the 01-04-Rename_AssetConditionCursor branch from 14d39a6 to 953dffd Compare January 12, 2024 22:12
@OwenKephart OwenKephart changed the title [amp-refactor][?/n] Rename AssetConditionCursor -> AssetConditionEvaluationInfo [amp-refactor][15/n] Rename AssetConditionCursor -> AssetConditionEvaluationInfo Jan 12, 2024
@OwenKephart OwenKephart requested a review from sryza January 12, 2024 23:41
@OwenKephart OwenKephart marked this pull request as ready for review January 12, 2024 23:41
Copy link
Contributor

@sryza sryza left a comment

Choose a reason for hiding this comment

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

We settled on different names in this thread, right? https://dagsterlabs.slack.com/archives/C04UD72HHQX/p1704326165574669

@OwenKephart OwenKephart force-pushed the 01-03-Fix_non-subsettable_multi-asset_handling branch from 309325a to 1bb1419 Compare January 16, 2024 22:25
@OwenKephart OwenKephart force-pushed the 01-04-Rename_AssetConditionCursor branch 2 times, most recently from 674bc95 to cb8d03b Compare January 17, 2024 00:49
@OwenKephart OwenKephart requested a review from sryza January 17, 2024 00:50
@OwenKephart
Copy link
Contributor Author

@sryza renamed/refactored to align w/ that thread

@OwenKephart OwenKephart force-pushed the 01-04-Rename_AssetConditionCursor branch from cb8d03b to 7add39d Compare January 17, 2024 01:18
Copy link
Contributor

@sryza sryza left a comment

Choose a reason for hiding this comment

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

A few final comments / questions, otherwise looks good to go

def equivalent_to_stored_evaluation(self, other: Optional["AssetConditionEvaluation"]) -> bool:
"""Returns if all fields other than `run_ids` are equal."""
"""Returns if this evaluation is functionally equivalent to the given stored evaluation.
Copy link
Contributor

Choose a reason for hiding this comment

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

What are the situations where they would be considered functionality equivalent but not __equal__? Worth mentioning at least an example here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

evaluation: AssetConditionEvaluation
extra_values_by_unique_id: Mapping[str, PackableValue]
evaluation_timestamp: Optional[float]
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this redundant with the timestamp on evaluation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not exactly. The "evaluation_timestamp" is used as the explicit timestamp for the entire tick's evaluation. This is synchronized across all assets (in theory, this means that you can't get weird situations where we evaluate right at an hour boundary and so two assets with identical partitions definitions were interpreted as having a different set of partitions if one was evaluated before and the other after the hour transition).

This timestamp is used for things like cron schedule ticks as well.

In contrast, the "start_timestamp" on the root evaluation is just when we started evaluating that particular asset (so we can calculate how long that evaluation took).

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, got it. Would it make sense to call it previous_tick_evaluation_timestamp to disambiguate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!


condition: "AssetCondition"
evaluation: AssetConditionEvaluation
Copy link
Contributor

Choose a reason for hiding this comment

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

Thoughts on calling this latest_evaluation (with implications for some of the other properties)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I've been going back and forth on that point -- my feeling was that it might be redundant, as we can just call the entire object previous_evaluation_state. If we do that, then previous_evaluation_state.previous_evaluation is a bit weird.

Copy link
Contributor

Choose a reason for hiding this comment

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

The way I am inclined to look at it is that the "state" isn't exactly the state of the previous valuation. It's more that the ongoing incremental state we track includes the previous evaluation.

E.g. imagine a world where we want to get smart about the order that we compute rules in, and, to do that, we want to track statistics on the typical amount of time it takes to evaluate conditions. To avoid overfitting on the previous tick, we might want to track the last N ticks. That data could make sense to store inside this object, but wouldn't be part of the previous evaluation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok updated it to previous_evaluation and previous_tick_evaluation_timestamp. kept "max_storage_id" as is, as "previous_max_storage_id" feels like the max storage id that was used for the previous evaluation, which is one level "too deep"

@OwenKephart OwenKephart force-pushed the 01-04-Rename_AssetConditionCursor branch from 7add39d to 60e1c31 Compare January 17, 2024 17:29
@OwenKephart OwenKephart changed the title [amp-refactor][15/n] Rename AssetConditionCursor -> AssetConditionEvaluationInfo [amp-refactor][15/n] Rename AssetConditionCursor -> AssetConditionEvaluationState Jan 17, 2024
@OwenKephart OwenKephart requested a review from sryza January 17, 2024 17:50
@OwenKephart OwenKephart force-pushed the 01-03-Fix_non-subsettable_multi-asset_handling branch from 1bb1419 to b1a03c9 Compare January 17, 2024 23:11
@OwenKephart OwenKephart force-pushed the 01-04-Rename_AssetConditionCursor branch from 60e1c31 to d27f79a Compare January 17, 2024 23:11
@OwenKephart OwenKephart force-pushed the 01-03-Fix_non-subsettable_multi-asset_handling branch from b1a03c9 to c068ebc Compare January 18, 2024 23:17
@OwenKephart OwenKephart force-pushed the 01-04-Rename_AssetConditionCursor branch from d27f79a to d0f2f5b Compare January 18, 2024 23:17
@OwenKephart
Copy link
Contributor Author

OwenKephart commented Jan 19, 2024

Merge activity

  • Jan 19, 4:20 PM: @OwenKephart started a stack merge that includes this pull request via Graphite.
  • Jan 19, 4:47 PM: Graphite rebased this pull request as part of a merge.
  • Jan 19, 4:48 PM: @OwenKephart merged this pull request with Graphite.

@OwenKephart OwenKephart force-pushed the 01-03-Fix_non-subsettable_multi-asset_handling branch from c068ebc to d08f558 Compare January 19, 2024 21:44
Base automatically changed from 01-03-Fix_non-subsettable_multi-asset_handling to master January 19, 2024 21:46
@OwenKephart OwenKephart force-pushed the 01-04-Rename_AssetConditionCursor branch from d0f2f5b to 4e26389 Compare January 19, 2024 21:47
@OwenKephart OwenKephart merged commit 1e15fef into master Jan 19, 2024
1 check was pending
@OwenKephart OwenKephart deleted the 01-04-Rename_AssetConditionCursor branch January 19, 2024 21:48
PedramNavid pushed a commit that referenced this pull request Jan 26, 2024
…luationState (#19035)

## Summary & Motivation

After some deliberation, "cursor" seems to be a poor name for what these objects are actually tracking. Instead, we go with AssetConditionEvaluationInfo as a more general name.

We do still want to distinguish this object, which is used to index/checkpoint computation, from the AssetConditionEvaluationResult object, which contains only a subset of the total information (related to what was actually calculated on that tick)

This PR also removes the unnecessary AssetConditionEvaluationResult object that used to exist as an in-memory-only organizational tool, in light of the fact that we can just directly return AssetConditionEvaluationInfo objects from the body of the evaluate function.

## How I Tested These Changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants