-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[external assets] report_asset_check endpoint
- Loading branch information
1 parent
f465ec0
commit cceaf17
Showing
5 changed files
with
285 additions
and
31 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
External Assets (Experimental) | ||
============================== | ||
|
||
Instance API | ||
------------ | ||
|
||
External asset events can be recorded using :py:func:`DagsterInstance.report_runless_asset_event` on :py:class:`DagsterInstance`. | ||
|
||
*Example* | ||
.. code-block:: python | ||
from dagster import DagsterInstance, AssetMaterialization, AssetKey | ||
instance = DagsterInstance.get() | ||
instance.report_runless_asset_event(AssetMaterialization(AssetKey('my_asset'))) | ||
Rest API | ||
-------- | ||
|
||
The `dagster-webserver` makes available endpoints for reporting asset events. | ||
|
||
`/report_asset_materialization/` | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
A `POST` request made to this endpoint with the required information will result in an `AssetMaterialization` event being recorded. Parameters can be passed in multiple ways, listed in precedence order below. | ||
|
||
**Params** | ||
* `asset_key` (required) | ||
* URL: the asset key can be specified as path components after `/report_asset_materialization/`, where each `/` delimits parts of a multipart :py:class:`AssetKey`. | ||
* JSON Body `asset_key`: value is passed to the :py:class:`AssetKey` constructor. | ||
* Query Param `asset_key`: accepts string or json encoded array for multipart keys. | ||
* `metadata` (optional) | ||
* JSON Body `metadata`: value is passed to the :py:class:`AssetMaterialization` constructor. | ||
* Query Param `metadata`: accepts json encoded object. | ||
* `data_version` (optional) | ||
* JSON Body `data_version`: value is passed to the :py:class:`AssetMaterialization` constructor. | ||
* Query Param `data_version`: value is passed to the :py:class:`AssetMaterialization` constructor. | ||
* `description` (optional) | ||
* JSON Body `description`: value is passed to the :py:class:`AssetMaterialization` constructor. | ||
* Query Param `description`: value is passed to the :py:class:`AssetMaterialization` constructor. | ||
* `partition` (optional) | ||
* JSON Body `partition`: value is passed to the :py:class:`AssetMaterialization` constructor. | ||
* Query Param `partition`: value is passed to the :py:class:`AssetMaterialization` constructor. | ||
|
||
|
||
*Examples* | ||
|
||
.. code-block:: bash | ||
curl -X POST localhost:3000/report_asset_materialization/my_asset | ||
.. code-block:: bash | ||
curl --request POST \ | ||
--url https://org.dagster.cloud/deployment/report_asset_materialization/ \ | ||
--header 'Content-Type: application/json' \ | ||
--header 'Dagster-Cloud-Api-Token: token' \ | ||
--data '{ | ||
"asset_key": "my_asset", | ||
"metadata": { | ||
"rows": 10 | ||
}, | ||
}' | ||
.. code-block:: python | ||
import requests | ||
url = f"{dagster_ui_host}/report_asset_materialization/my_asset" | ||
response = requests.request("POST", url) | ||
response.raise_for_status() | ||
.. code-block:: python | ||
import requests | ||
url = "http://org.dagster.cloud/deploy/report_asset_materialization/" | ||
payload = { | ||
"asset_key": "my_asset", | ||
"metadata": {"rows": 10}, | ||
} | ||
headers = { | ||
"Content-Type": "application/json", | ||
"Dagster-Cloud-Api-Token": "token" | ||
} | ||
response = requests.request("POST", url, json=payload, headers=headers) | ||
response.raise_for_status() |
This file contains 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
This file contains 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
Oops, something went wrong.