-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[runless] report_asset_materialization endpoint #16602
[runless] report_asset_materialization endpoint #16602
Conversation
Current dependencies on/for this PR: This comment was auto-generated by Graphite. |
@@ -323,6 +405,11 @@ def build_routes(self): | |||
"/download_debug/{run_id:str}", | |||
self.download_debug_file_endpoint, | |||
), | |||
Route( | |||
"/report_asset_materialization/{asset_key:path}", |
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.
differs from report_runless_asset_event
naming since we are encoding the type as the part of the url path to allow for ease of use
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 about multi-part asset keys?
46c8ce8
to
85aace8
Compare
36ec391
to
7b6651d
Compare
scripts/run-pyright.py
Outdated
capture_output=True, | ||
shell=True, | ||
text=True, | ||
check=False, # dont raise on non zero exit codes |
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.
7b6651d
to
807f55b
Compare
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.
Still looking for test case that has multipart keys
# multipart key | ||
long_key = AssetKey(["foo", "bar", "baz"]) | ||
response = test_client.post( | ||
f"/report_asset_materialization/{long_key.to_user_string()}", | ||
) | ||
assert response.status_code == 200 | ||
evt = instance.get_latest_materialization_event(long_key) | ||
assert evt |
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.
multipart key test here
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.
- can you add assertion against fully expanded url (e.g. assert url == "report_asset_materialization/foo/bar/baz")
- can you add test when asset key components contain "/"
I'm concerned about the answers to 2.
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.
opted to support accepting asset_key
via query params or post body to provide ways to workaround /
in the asset key content. Could not find a clean path trying to deal url encoded /
values being part of the path since the web framework resolves those encodings
eb5f3b3
to
b387d7b
Compare
Deploy preview for dagit-storybook ready! ✅ Preview Built with commit eb5f3b3. |
Deploy preview for dagster-docs ready! Preview available at https://dagster-docs-b9q35vn7e-elementl.vercel.app Direct link to changed pages: |
b387d7b
to
5618d6d
Compare
Deploy preview for dagit-core-storybook ready! ✅ Preview Built with commit b169682. |
ce88e4a
to
5473048
Compare
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.
Cool.
Two questions:
- Are we sure we want an endpoint per type instead of a single endpoint for all event types?
- Can we put something in place to make sure the REST endpoint stays up-to-date with
ExtContext
methods?
Once possible path to doing this is writing an ExtContext
implementation that hits the REST endpoint.
) | ||
|
||
asset_key = None | ||
if request.path_params.get("asset_key"): |
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.
Can we make sure we write a test or something that ensures that this endpoint stays up-to-date with the upcomingreport_asset_materialization
method on ExtContext
?
Not sure. What pushed me to the current scheme was trying to support the simple base case of only posting to a path which led me to encoding the event type in the path. Some other ideas:
|
5473048
to
b169682
Compare
Deploy preview for dagster-university ready! ✅ Preview Built with commit b169682. |
f835959
to
27696c0
Compare
27696c0
to
7ee1775
Compare
# things that are missing on ExtContext.report_asset_materialization | ||
KNOWN_DIFF = {"partition", "description"} |
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.
should these get added to ExtContext.report_asset_materialization
or is the premise of keeping these things in alignment not right?
tags = None | ||
if ReportAssetMatParam.data_version in json_body: | ||
tags = { | ||
DATA_VERSION_TAG: json_body[ReportAssetMatParam.data_version], | ||
DATA_VERSION_IS_USER_PROVIDED_TAG: "true", | ||
} | ||
elif ReportAssetMatParam.data_version in request.query_params: | ||
tags = { | ||
DATA_VERSION_TAG: request.query_params[ReportAssetMatParam.data_version], | ||
DATA_VERSION_IS_USER_PROVIDED_TAG: "true", | ||
} |
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.
@smackesey to confirm this data_version
handling
for conversing on report API sync
7ee1775
to
22219ad
Compare
add a rest endpoint one can post to to report runless asset materializations
the endpoint
/report_asset_materialization/
takes/
is the multipart delimiter like infrom_user_string
asset_key
, which expects the db encoding of json array of strings / single stringAssetKey
How I Tested These Changes
added test coverage