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

Merge standalone-binaries to the main CLI #259

Merged
merged 1 commit into from
Dec 9, 2024

Conversation

Hennzau
Copy link
Contributor

@Hennzau Hennzau commented Nov 23, 2024

Merge standalon-binaries inside zfctl CLI

This PR introduces improvements to the zfctl CLI for better usability.

Daemon

The zenoh-flow-standalone-daemon crate has been removed and replaced by the CLI command:

zfctl daemon start <NAME | CONFIGURATION>

Runtime

The zenoh-flow-standalone-runtime crate has been removed and replaced by the CLI command:

zfctl run-local <dataflow.yml> <optional configuration>

@@ -1,2 +1,2 @@
[toolchain]
channel = "1.72.1"
channel = "1.75"
Copy link
Contributor

Choose a reason for hiding this comment

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

A small comment on this: the version of the Rust toolchain is linked to the version of Zenoh. The reason being that Zenoh-Flow can be compiled to a Zenoh plugin and, in order for Zenoh to load the plugin, it needs to have been compiled with the same version of Rust.

Hence, if you want to tackle this part, I'd suggest to make a separate PR that does both: bump Zenoh to version 1.0.x and update the toolchain to 1.75 😉

(I did not look closely at the rest of your PR as you marked it as a draft)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh thx! Yeah bumping Zenoh was also in my mind, I should definitely separate it in two PR.

@J-Loudet
Copy link
Contributor

J-Loudet commented Nov 27, 2024

@Hennzau In order to accept your contribution, you need to create an account -- with the same e-mail address associated to your GitHub account (this is how Eclipse validates the contributions) -- on the Eclipse Foundation website and then sign the ECA. 😉
This page gives you all the information: https://www.eclipse.org/legal/eca/

@Hennzau Hennzau changed the title [WIP] Merge standalone binaries to the main CLI Merge standalone binaries to the main CLI Nov 28, 2024
@Hennzau Hennzau marked this pull request as ready for review November 28, 2024 17:32
@J-Loudet
Copy link
Contributor

Thanks for the contribution @Hennzau!

I am currently traveling so I will be able to look at it thoroughly starting next week. There is however one aspect that caught my attention, you say:

  • Before this PR: Executing zfctl runtime list did not return any output.
  • Now: The command communicates with all active daemons and presents the running runtimes in a clear, organized format.

That is an odd behavior that I am unable to reproduce. I tried on my machine and that of a colleague and we both obtained the expected result.
Given we both use macOS, I'm wondering if it could be an OS specific issue. Could you explain what you tried and if you can reproduce it consistently?

@Hennzau
Copy link
Contributor Author

Hennzau commented Nov 29, 2024

Thanks for the contribution @Hennzau!

I am currently traveling so I will be able to look at it thoroughly starting next week. There is however one aspect that caught my attention, you say:

  • Before this PR: Executing zfctl runtime list did not return any output.
  • Now: The command communicates with all active daemons and presents the running runtimes in a clear, organized format.

That is an odd behavior that I am unable to reproduce. I tried on my machine and that of a colleague and we both obtained the expected result. Given we both use macOS, I'm wondering if it could be an OS specific issue. Could you explain what you tried and if you can reproduce it consistently?

Oh wait... I just realized I got the command wrong! I was actually referring to the zfctl instance list command. I will update my message

Comment on lines 199 to 228
InstancesQuery::List => {
let mut table = Table::new();
table.set_width(80);
table.set_header(row!("Instance Name", "Instance ID", "Instance State"));

while let Ok(response) = reply.recv_async().await {
match response.sample {
Ok(sample) => {
match serde_json::from_slice::<
HashMap<InstanceId, (Arc<str>, InstanceState)>,
>(&sample.value.payload.contiguous())
{
Ok(list) => {
for (id, (name, state)) in list {
table.add_row(row!(name, id, state));
}
}
Err(e) => tracing::error!(
"Failed to parse 'list' reply from < {} >: {:?}",
response.replier_id,
e
),
}
}
Err(err) => tracing::error!("{:?}", err),
}
}

println!("{table}");
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the code I added

Copy link
Contributor

@J-Loudet J-Loudet left a comment

Choose a reason for hiding this comment

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

Again, thanks for your contribution @Hennzau 🙂

Your PR is, in this state, doing multiple things at the same time and it is not making it easy to follow (it's not unreadable at all, simply not as easy as it could be).

Hence, I would like you to reduce the scope to what the title of your PR says: simply merging the standalone binaries in zfctl.

I am not against changing the name and functionality of some of the commands but it would be better if it was done in a separate PR: that way we can discuss the changes.

For instance, I don't think the run in zfctl daemon run is the best verb. Something like spawn or start is more commonly used in similar contexts — e.g. you do systemctl start <service> to run a background daemon/service.
Similarly, maybe we could use zfctl run-local <dataflow.yaml> for the standalone runtime and zfctl instance deploy <dataflow.yaml> + zfctl instance start <uuid> for the distributed version.

The addition of the instance list is indeed welcomed!

Other than that I have no comment on the code itself. 😉

Copy link
Contributor

Choose a reason for hiding this comment

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

We already have an example that does exactly this in the Zenoh repository (here). Given that you are inclined to add this, maybe more specific instructions are required in the README?

@Hennzau
Copy link
Contributor Author

Hennzau commented Dec 4, 2024

Hi! Thank you very much, I understood everything! I’ll clarify all of this.

@Hennzau Hennzau marked this pull request as draft December 4, 2024 12:44
@Hennzau Hennzau changed the title Merge standalone binaries to the main CLI Merge standalone-binaries to the main CLI Dec 4, 2024
@Hennzau Hennzau marked this pull request as ready for review December 4, 2024 16:19
@Hennzau
Copy link
Contributor Author

Hennzau commented Dec 4, 2024

It should be good now! Thx for the previous review :)

Copy link
Contributor

@J-Loudet J-Loudet left a comment

Choose a reason for hiding this comment

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

Sorry for the delay.

After taking some time to play with this new version of zfctl — having less command-line tools provides indeed a better experience — I don't think it makes sense to have zfctl runtime + zfctl daemon and I would suggest to fuse them in the daemon sub-command.

I understand this goes against my previous feedback of "just merging", so that one is on me. 😉
I can take care of it if you want.

@Hennzau
Copy link
Contributor Author

Hennzau commented Dec 9, 2024

Great! I can take care of it, but I won't have time until December 20th. So if you want this fusion done before that, you can do it; otherwise, I'll handle it :)

@J-Loudet J-Loudet merged commit 23bae3b into eclipse-zenoh-flow:main Dec 9, 2024
5 checks passed
@J-Loudet
Copy link
Contributor

J-Loudet commented Dec 9, 2024

I have merged it as is and I will do the changes later on. ;-)

@Hennzau Hennzau deleted the bump_and_cli branch December 9, 2024 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants