Trait MessageWriter

Source
pub trait MessageWriter {
    type Channel: MessageWriterChannel;

    // Required method
    fn open(&self, params: Map<String, Value>) -> Self::Channel;

    // Provided methods
    fn get_opened_payload(&self, _: Token) -> HashMap<&str, Option<Value>> { ... }
    fn get_opened_extras(&self) -> Map<String, Value> { ... }
}
Expand description

Write messages back to Dagster, via its associated MessageWriterChannel.

Required Associated Types§

Required Methods§

Source

fn open(&self, params: Map<String, Value>) -> Self::Channel

Initialize a channel for writing messages back to Dagster.

This method should takes the params passed by the orchestration-side PipesMessageReader and use them to construct and yield MessageWriterChannel.

Provided Methods§

Source

fn get_opened_payload(&self, _: Token) -> HashMap<&str, Option<Value>>

Return a payload containing information about the external process to be passed back to the orchestration process. This should contain information that cannot be known before the external process is launched.

§Note

This method is sealed — it should not be overridden by users. Instead, users should override Self::get_opened_extras to inject custom data.

struct MyMessageWriter(u64);

impl MessageWriter for MyMessageWriter {
     // ...
}

MyMessageWriter(42).get_opened_payload(private::Token); // use of undeclared crate or module `private`
Source

fn get_opened_extras(&self) -> Map<String, Value>

Return arbitary reader-specific information to be passed back to the orchestration process. The information will be returned under the extras key of the initialization payload.

Implementors§