From 372c326a22bb9f92fc26c83c433fe58ce60f3a1f Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Mon, 24 Jun 2024 11:29:44 +0200 Subject: [PATCH] Improve `dora start` output Print a proper sentence and include the dataflow name in addition to its UUID. --- binaries/cli/src/attach.rs | 2 +- binaries/cli/src/main.rs | 11 +++++------ binaries/coordinator/src/lib.rs | 13 ++++++++++--- libraries/core/src/topics.rs | 2 +- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/binaries/cli/src/attach.rs b/binaries/cli/src/attach.rs index 62745e14..0d0f1dc0 100644 --- a/binaries/cli/src/attach.rs +++ b/binaries/cli/src/attach.rs @@ -130,7 +130,7 @@ pub fn attach_dataflow( let result: ControlRequestReply = serde_json::from_slice(&reply_raw).wrap_err("failed to parse reply")?; match result { - ControlRequestReply::DataflowStarted { uuid: _ } => (), + ControlRequestReply::DataflowStarted { id: _ } => (), ControlRequestReply::DataflowStopped { uuid, result } => { info!("dataflow {uuid} stopped"); break result diff --git a/binaries/cli/src/main.rs b/binaries/cli/src/main.rs index a746d0b8..b878e040 100644 --- a/binaries/cli/src/main.rs +++ b/binaries/cli/src/main.rs @@ -368,11 +368,13 @@ fn run() -> eyre::Result<()> { &mut *session, )?; + println!("Started dataflow {dataflow_id}"); + if attach { attach_dataflow( dataflow_descriptor, dataflow, - dataflow_id, + dataflow_id.uuid, &mut *session, hot_reload, )? @@ -480,7 +482,7 @@ fn start_dataflow( name: Option, local_working_dir: PathBuf, session: &mut TcpRequestReplyConnection, -) -> Result { +) -> eyre::Result { let reply_raw = session .request( &serde_json::to_vec(&ControlRequest::Start { @@ -495,10 +497,7 @@ fn start_dataflow( let result: ControlRequestReply = serde_json::from_slice(&reply_raw).wrap_err("failed to parse reply")?; match result { - ControlRequestReply::DataflowStarted { uuid } => { - eprintln!("{uuid}"); - Ok(uuid) - } + ControlRequestReply::DataflowStarted { id } => Ok(id), ControlRequestReply::Error(err) => bail!("{err}"), other => bail!("unexpected start dataflow reply: {other:?}"), } diff --git a/binaries/coordinator/src/lib.rs b/binaries/coordinator/src/lib.rs index 3b0c6459..2ad40a00 100644 --- a/binaries/coordinator/src/lib.rs +++ b/binaries/coordinator/src/lib.rs @@ -339,15 +339,22 @@ async fn start_inner( }; let reply = inner.await.map(|dataflow| { let uuid = dataflow.uuid; + let id = DataflowId { + uuid, + name: dataflow.name.clone(), + }; running_dataflows.insert(uuid, dataflow); - ControlRequestReply::DataflowStarted { uuid } + ControlRequestReply::DataflowStarted { id } }); let _ = reply_sender.send(reply); } ControlRequest::Check { dataflow_uuid } => { let status = match &running_dataflows.get(&dataflow_uuid) { - Some(_) => ControlRequestReply::DataflowStarted { - uuid: dataflow_uuid, + Some(dataflow) => ControlRequestReply::DataflowStarted { + id: DataflowId { + uuid: dataflow_uuid, + name: dataflow.name.clone(), + }, }, None => ControlRequestReply::DataflowStopped { uuid: dataflow_uuid, diff --git a/libraries/core/src/topics.rs b/libraries/core/src/topics.rs index 8e90e48f..e048d264 100644 --- a/libraries/core/src/topics.rs +++ b/libraries/core/src/topics.rs @@ -60,7 +60,7 @@ pub enum ControlRequestReply { Error(String), CoordinatorStopped, DataflowStarted { - uuid: Uuid, + id: DataflowId, }, DataflowReloaded { uuid: Uuid,