while

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

While Conditional

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

int number_of_donuts = input()

while number_of_donuts > 0:
    number_of_donuts = number_of_donuts - 1

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/while/worker

Register the WfSpec

In another terminal, run:

go run ./conditionals/while/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 look at the different outputs (donuts left) of each loop in the while

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

That should print:

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

That should print:

"1"
lhctl get nodeRun <wfRunId from before> 0 8 | jq .result.task.output.int

That should print:

"0"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Donut

func Donut(num int) int

func DonutWorkflow

func DonutWorkflow(thread *wflib.ThreadBuilder)

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