This repository has been archived by the owner on Dec 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
starts using PipesMetadataValue (#26)
* starts using PipesMetadataValue * simplify construction * add changelog * fix broken auto-merge --------- Co-authored-by: Colton Padden <[email protected]>
- Loading branch information
Showing
6 changed files
with
273 additions
and
35 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
24 changes: 18 additions & 6 deletions
24
example-dagster-pipes-rust-project/rust_processing_jobs/src/main.rs
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 |
---|---|---|
@@ -1,18 +1,30 @@ | ||
use dagster_pipes_rust::types::{PipesMetadataValue, RawValue, Type}; | ||
use dagster_pipes_rust::{open_dagster_pipes, AssetCheckSeverity, DagsterPipesError}; | ||
use serde_json::json; | ||
|
||
use std::collections::HashMap; | ||
|
||
fn main() -> Result<(), DagsterPipesError> { | ||
let mut context = open_dagster_pipes()?; | ||
// See supported metadata types here: | ||
// https://github.com/dagster-io/dagster/blob/master/python_modules/dagster/dagster/_core/pipes/context.py#L133 | ||
let metadata = json!({"row_count": {"raw_value": 100, "type": "int"}}); | ||
context.report_asset_materialization("example_rust_subprocess_asset", metadata); | ||
|
||
let asset_metadata = HashMap::from([( | ||
"row_count".to_string(), | ||
PipesMetadataValue::new(RawValue::Integer(100), Type::Int), | ||
)]); | ||
context.report_asset_materialization("example_rust_subprocess_asset", asset_metadata); | ||
|
||
let check_metadata = HashMap::from([( | ||
"quality".to_string(), | ||
PipesMetadataValue { | ||
raw_value: Some(RawValue::Integer(100)), | ||
pipes_metadata_value_type: Some(Type::Int), | ||
}, | ||
)]); | ||
context.report_asset_check( | ||
"example_rust_subprocess_check", | ||
true, | ||
"example_rust_subprocess_asset", | ||
&AssetCheckSeverity::Warn, | ||
json!({"quality": {"raw_value": 5, "type": "int"}}), | ||
check_metadata, | ||
); | ||
Ok(()) | ||
} |
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
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 |
---|---|---|
|
@@ -199,5 +199,7 @@ pub enum RawValue { | |
|
||
Double(f64), | ||
|
||
Integer(i64), | ||
|
||
String(String), | ||
} |
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