Browse Source

Add more logging to `rust-dataflow` example

tags/v0.2.0-candidate
Philipp Oppermann 3 years ago
parent
commit
611103b211
Failed to extract signature
4 changed files with 18 additions and 0 deletions
  1. +2
    -0
      Cargo.lock
  2. +2
    -0
      Cargo.toml
  3. +3
    -0
      binaries/daemon/src/lib.rs
  4. +11
    -0
      examples/rust-dataflow/run.rs

+ 2
- 0
Cargo.lock View File

@@ -1009,6 +1009,8 @@ dependencies = [
"eyre",
"serde_yaml 0.8.23",
"tokio",
"tracing",
"tracing-subscriber",
"uuid 1.2.1",
]



+ 2
- 0
Cargo.toml View File

@@ -32,6 +32,8 @@ dora-core = { path = "libraries/core" }
dunce = "1.0.2"
serde_yaml = "0.8.23"
uuid = { version = "1.2.1", features = ["v4", "serde"] }
tracing = "0.1.36"
tracing-subscriber = "0.3.15"

[[example]]
name = "c-dataflow"


+ 3
- 0
binaries/daemon/src/lib.rs View File

@@ -414,6 +414,9 @@ impl Daemon {
if let Some(exit_when_done) = &mut self.exit_when_done {
exit_when_done.remove(&dataflow_id);
if exit_when_done.is_empty() {
tracing::info!(
"exiting daemon because all required dataflows are finished"
);
return Ok(RunStatus::Exit);
}
}


+ 11
- 0
examples/rust-dataflow/run.rs View File

@@ -9,6 +9,8 @@ use uuid::Uuid;

#[tokio::main]
async fn main() -> eyre::Result<()> {
set_up_tracing().wrap_err("failed to set up tracing subscriber")?;

let root = Path::new(env!("CARGO_MANIFEST_DIR"));
std::env::set_current_dir(root.join(file!()).parent().unwrap())
.wrap_err("failed to set working dir")?;
@@ -69,3 +71,12 @@ pub async fn read_descriptor(file: &Path) -> eyre::Result<Descriptor> {
serde_yaml::from_slice(&descriptor_file).context("failed to parse given descriptor")?;
Ok(descriptor)
}

fn set_up_tracing() -> eyre::Result<()> {
use tracing_subscriber::prelude::__tracing_subscriber_SubscriberExt;

let stdout_log = tracing_subscriber::fmt::layer().pretty();
let subscriber = tracing_subscriber::Registry::default().with(stdout_log);
tracing::subscriber::set_global_default(subscriber)
.context("failed to set tracing global subscriber")
}

Loading…
Cancel
Save