Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve dora start output #562

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion binaries/cli/src/attach.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 5 additions & 6 deletions binaries/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,13 @@ fn run() -> eyre::Result<()> {
&mut *session,
)?;

println!("Started dataflow {dataflow_id}");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea behind having only the dataflow id was to make it programmable to store the ID as a variable or within a file.

docker run or start gives you the name or ID as a return as well so that is why I pushed for this version.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I remember. Maybe we add some flag to get just the UUID as output? Then users that want to use dora start --detach in scripts still have a way to do that.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly it seems that the CI/CD is breaking. I'm not sure if that is a problem we want to work on now, as I rarely get feedback on how this is confusing.

I also do a lot of copy pasting of IDs and it would be harder with this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, we can leave it as is if you prefer. I just thought that also printing the dataflow name would be useful so that you don't need to use the long UUID.

(The CI failures are easy to fix, I just forgot to update the code for the multiple-daemons example.)


if attach {
attach_dataflow(
dataflow_descriptor,
dataflow,
dataflow_id,
dataflow_id.uuid,
&mut *session,
hot_reload,
)?
Expand Down Expand Up @@ -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 {
Expand All @@ -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:?}"),
}
Expand Down
13 changes: 10 additions & 3 deletions binaries/coordinator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion libraries/core/src/topics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub enum ControlRequestReply {
Error(String),
CoordinatorStopped,
DataflowStarted {
uuid: Uuid,
id: DataflowId,
},
DataflowReloaded {
uuid: Uuid,
Expand Down
Loading