ifelse

package
v0.0.0-...-0f879ca Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

README

If Conditional

This is a simple example of a workflow with if/else functionality in LittleHorse. The pseudocode is as follows:

int number_of_donuts = input()

if number_of_donuts > 10:
    eat_salad()
else:
    eat_donut()

Start the Task Worker

We have two TaskDef's and thus two Task Functions. Note that worker/main.go kicks off two threads, one for each Task Worker.

go run ./conditionals/ifelse/worker

Register the WfSpec

In another terminal, run:

go run ./conditionals/ifelse/deploy

Run a WfRun

Let's run the WfRun with a small amount of donuts:

lhctl run donut-workflow number-of-donuts 3

Let's view the output of the Task

lhctl get nodeRun <wfRunId from before> 0 2 | jq .result.task.output.str

That should print:

Have another donut!

Let's run it after we've had too many donuts:

lhctl run donut-workflow number-of-donuts 15

Let's view the output of the Task

lhctl get nodeRun <wfRunId from before> 0 2 | jq .result.task.output.str

That should print:

Have a salad!

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Donut

func Donut() string

func DonutWorkflow

func DonutWorkflow(thread *wflib.ThreadBuilder)

func Salad

func Salad() string

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL