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.
- Loading branch information
Showing
4 changed files
with
274 additions
and
28 deletions.
There are no files selected for viewing
32 changes: 25 additions & 7 deletions
32
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,36 @@ | ||
use dagster_pipes_rust::{open_dagster_pipes, AssetCheckSeverity, DagsterPipesError}; | ||
use dagster_pipes_rust::{ | ||
open_dagster_pipes, AssetCheckSeverity, DagsterPipesError | ||
}; | ||
use dagster_pipes_rust::types::{PipesMetadataValue, RawValue, Type}; | ||
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 { | ||
raw_value: Some(RawValue::Integer(100)), | ||
pipes_metadata_value_type: Some(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"}}), | ||
&AssetCheckSeverity::Warn, | ||
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), | ||
} |