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

Nodes with no inputs has empty events stream #500

Open
haixuanTao opened this issue May 17, 2024 · 3 comments
Open

Nodes with no inputs has empty events stream #500

haixuanTao opened this issue May 17, 2024 · 3 comments
Labels

Comments

@haixuanTao
Copy link
Collaborator

If a node does not specify any inputs, it will have no event stream. And the event stream is always returning None.

This is however misleading as we might want to check the event stream for other event than INPUT event such as Stopping event.

Quick example

use std::time::Duration;

use dora_node_api::{self, dora_core::config::DataId, DoraNode, Event, IntoArrow};

fn main() -> eyre::Result<()> {
    println!("hello");

    let output = DataId::from("random".to_owned());

    let (mut node, mut events) = DoraNode::init_from_env()?;

    if events.recv_timeout(Duration::from_secs(100)).is_none() {
        eprintln!("Evemt is None");
    }
    Ok(())
}

With an empty input dataflow description, will return immediately instead of timing out on 100s.

@github-actions github-actions bot added the rust label May 17, 2024
@phil-opp
Copy link
Collaborator

Our current behavior is that an event stream is closed as soon as all of its inputs are closed. This way, we enable dataflows to finish "naturally" without requiring a manual stop.

The "stop" event is only sent to signal a premature exit caused by a manual stop operation.

When a node has no inputs, it will never receive any input events. So there is no way to prematurely stop the input stream, as it's already finished from the start. In other words, a node with no inputs always finishes "naturally" even if a manual stop command is sent because the manual stop always happens after the last input has already been closed.


We can of course discuss whether we want to change this behavior. However, if we always wait for a manual stop command, it's no longer possible to have dataflows that finish "naturally".

Could you give more details on your use case for a node without inputs?

@haixuanTao
Copy link
Collaborator Author

Sure thing. Basically, I have some source nodes that generates output without any input.

I guess, the thing is I wish to make them stop when I click on Ctrl+C but I don't have any easy way to do that at the moment.

We don't have to fix this just now.

@phil-opp
Copy link
Collaborator

phil-opp commented May 22, 2024

Some ideas how we could support this use case:

  • Add a some sort of dummy input to the source node that never fires. We could e.g. provide a built-in dora/never input for this use case.
  • Add a config key to allow nodes to wait for manual stop, e.g. via the YAML file or as argument to init_from_env.
  • Add a new EventChannelClosed event that is sent immediately before the stream returns None. This event could contain a manual stop channel so that it is possible to wait for manual stop commands even after the event stream returned None.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants