~/bend-docscommunity

src/par.bend checks

raw source on the hub · import snap@1.1.0.0/src/par.bend as Par

src/par: what par sends its effect and how it reads the answers back. par.plan frames every job on one wire, sending a job run would refuse as the empty job; par.answers pairs each status with the body its job wrote.

3 imports
import Base
import ./argv.bend as Argv
import ./file.bend as File

Definitions

def job.fields source · line 12 · raw

@argv:List<&2, String> -> List<&2, String>

one job's fields on the par wire: each argument marked with a + in front, then an empty field that ends the job. A marked field is never empty, so the empty one cannot be mistaken for an argument, whatever the arguments hold; and the empty job is the empty field alone.

def par.job.of source · line 22 · raw

@ok:Bool -> @argv:List<&2, String> -> List<&2, String>

a job accepted as run would accept it is sent as it is; any other is sent as the empty job, which the effect answers as a program that could not be started, in its own place

def par.job source · line 30 · raw

@+argv:List<&2, String> -> List<&2, String>

the job par sends for an argv

def par.fields source · line 34 · raw

@js:List<&2, List<&2, String>> -> List<&2, String>

every job's fields, in the order the jobs were given

def par.plan source · line 44 · raw

@js:List<&2, List<&2, String>> -> @width:String -> @gb:String -> @at:String -> @by:String -> String

what the par effect is handed: how many may run at once, how many gigabytes each was given, where they write, the second they must all be finished by, and then every job's fields, all joined on NUL

def par.nonblank source · line 49 · raw

@ss:List<&2, String> -> List<&2, String>

the strings that are not empty, which is what a list of statuses amounts to once a trailing newline has been counted as a line

def par.of source · line 60 · raw

@+code:String -> @got:Maybe<&2, String> -> String

one job's answer, in the shape run gives: the status on its own first line, then everything the program printed, read back out of the file it was pointed at

def par.answers source · line 65 · raw

@cs:List<&2, String> -> @bodies:List<&2, Maybe<&2, String>> -> List<&2, String>

every job's answer: each status paired with the body at its place in the order, or with none when there is no body there

def par.bodies source · line 75 · raw

@cs:List<&2, String> -> @+at:String -> @+nn:Nat -> IO(List<&2, Maybe<&2, String>>)

the file each job wrote, one per status, by its place in the order