pub struct AstroRunServer { /* private fields */ }

Implementations§

source§

impl AstroRunServer

source

pub fn new() -> Self

Examples found in repository?
examples/server.rs (line 6)
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
async fn main() -> Result<()> {
  let server = AstroRunServer::new();

  // Start server in background
  let handle = tokio::spawn({
    let server = server.clone();

    async move {
      server.serve("127.0.0.1:5338").await.unwrap();
    }
  });

  let astro_run = AstroRun::builder().runner(server).build();

  let workflow = r#"
    jobs:
      test:
        name: Test Job
        steps:
          - timeout: 60m
            continue-on-error: false
            run: Hello World
      "#;

  let workflow = Workflow::builder()
    .config(workflow)
    .build(&astro_run)
    .unwrap();

  let ctx = astro_run.execution_context().build();

  // Run workflow
  let _res = workflow.run(ctx).await;

  // Wait for server to stop
  handle.await.unwrap();

  Ok(())
}
source

pub fn with_scheduler<T>(scheduler: T) -> Self
where T: Scheduler + 'static,

source

pub async fn serve(self, url: impl Into<&str>) -> Result<()>

Examples found in repository?
examples/server.rs (line 13)
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
async fn main() -> Result<()> {
  let server = AstroRunServer::new();

  // Start server in background
  let handle = tokio::spawn({
    let server = server.clone();

    async move {
      server.serve("127.0.0.1:5338").await.unwrap();
    }
  });

  let astro_run = AstroRun::builder().runner(server).build();

  let workflow = r#"
    jobs:
      test:
        name: Test Job
        steps:
          - timeout: 60m
            continue-on-error: false
            run: Hello World
      "#;

  let workflow = Workflow::builder()
    .config(workflow)
    .build(&astro_run)
    .unwrap();

  let ctx = astro_run.execution_context().build();

  // Run workflow
  let _res = workflow.run(ctx).await;

  // Wait for server to stop
  handle.await.unwrap();

  Ok(())
}

Trait Implementations§

source§

impl AstroRunService for AstroRunServer

§

type SubscribeEventsStream = ReceiverStream<Result<Event, Status>>

Server streaming response type for the SubscribeEvents method.
source§

fn subscribe_events<'life0, 'async_trait>( &'life0 self, request: Request<RunnerMetadata> ) -> Pin<Box<dyn Future<Output = Result<Response<Self::SubscribeEventsStream>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

fn report_log<'life0, 'async_trait>( &'life0 self, request: Request<WorkflowLog> ) -> Pin<Box<dyn Future<Output = Result<Response<ReportLogResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

fn report_run_completed<'life0, 'async_trait>( &'life0 self, request: Request<ReportRunCompletedRequest> ) -> Pin<Box<dyn Future<Output = Result<Response<ReportRunCompletedResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

impl Clone for AstroRunServer

source§

fn clone(&self) -> AstroRunServer

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Runner for AstroRunServer

source§

fn run<'life0, 'async_trait>( &'life0 self, ctx: Context ) -> Pin<Box<dyn Future<Output = RunResponse> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

fn on_step_completed(&self, result: StepRunResult)

source§

fn on_job_completed(&self, result: JobRunResult)

source§

fn on_workflow_completed(&self, result: WorkflowRunResult)

source§

fn on_run_step(&self, event: RunStepEvent)

source§

fn on_run_job(&self, event: RunJobEvent)

source§

fn on_run_workflow(&self, event: RunWorkflowEvent)

source§

fn on_log(&self, log: WorkflowLog)

source§

fn on_state_change(&self, event: WorkflowStateEvent)

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> FromRef<T> for T
where T: Clone,

source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more