-
Notifications
You must be signed in to change notification settings - Fork 58
Implement wait flag for ctl commands #91
Comments
Would it be better to flip the flag around? Have the default behavior be waiting for the actor to start, and someone can pass |
I think it depends on the use case. For actors it's not really a big deal, but for capability providers especially on constrained networks it can take time to download the 20MB+ file and so waiting around would be bad if using Overall the idea is that adding a |
I'm just thinking about other tools that do similar things, like I'm open to either though. I just think default waiting would be more in line with what an average user would expect. |
@mattwilkinsonn that's a fair point. With proper documentation, I think that we'll be able to change the behavior and provide a better experience overall 😄 . So to confirm, we'll go with |
Should this be handled inside the control interface's client? We could add a method on it that subscribes to Alternatively we could handle it inside wash by making our own connection to NATS, but i'm not sure making two separate connections makes sense. |
We have something ready for this! https://docs.rs/wasmcloud-control-interface/0.13.0/wasmcloud_control_interface/struct.Client.html#method.events_receiver. What wash could do is instantiate an events receiver before sending the operation and try to receive events for a specified longer timeout. This way you can finish the command when you receive the appropriate command. This will also reuse the same NATS connection, so no duplication. |
Imperatively interacting with a wasmcloud host, or a lattice of interconnected hosts, it's important to be able to know when certain events take place. For example, when you issue this command to a wasmcloud host:
You receive an acknowledgment that the actor start event has been received. All this means is that your command was successfully delivered to the host and that the host is going to proceed with pulling the actor from our OCI registry and starting it. What you don't get from this acknowledgment is the assurance that the actor actually was started.
I propose a
--wait
flag that can be appended to thestart
,stop
,link
andupdate
subcommands underctl
. These are all commands that return with an acknowledgment but not a confirmation of the command executing. When the--wait
flag is supplied, the command will instead block until the appropriate event can be observed (e.g. ActorStarted forstart actor
).In order to monitor the event stream, there are two possibilities:
Both of these possibilities are important. When using
wash
as a command-line interface, we'll want to monitor events that are flowing over NATS messages, as the control interface operates on a lattice that's connected to via NATS. We'll want to do the same thing whenwash up
is launched with a NATS connection. When the REPL is launched without a NATS connection (after #92 ) we should directly build a host with an event receiver that can be used to monitor these events.The text was updated successfully, but these errors were encountered: