Browse Source

Improve `dora start` output

Print a proper sentence and include the dataflow name in addition to its UUID.
improve-dora-start-output
Philipp Oppermann 1 year ago
parent
commit
372c326a22
Failed to extract signature
4 changed files with 17 additions and 11 deletions
  1. +1
    -1
      binaries/cli/src/attach.rs
  2. +5
    -6
      binaries/cli/src/main.rs
  3. +10
    -3
      binaries/coordinator/src/lib.rs
  4. +1
    -1
      libraries/core/src/topics.rs

+ 1
- 1
binaries/cli/src/attach.rs View File

@@ -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


+ 5
- 6
binaries/cli/src/main.rs View File

@@ -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<String>,
local_working_dir: PathBuf,
session: &mut TcpRequestReplyConnection,
) -> Result<Uuid, eyre::ErrReport> {
) -> eyre::Result<DataflowId> {
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:?}"),
}


+ 10
- 3
binaries/coordinator/src/lib.rs View File

@@ -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,


+ 1
- 1
libraries/core/src/topics.rs View File

@@ -60,7 +60,7 @@ pub enum ControlRequestReply {
Error(String),
CoordinatorStopped,
DataflowStarted {
uuid: Uuid,
id: DataflowId,
},
DataflowReloaded {
uuid: Uuid,


Loading…
Cancel
Save