def par

snap@1.4.0.0 · main.bend:30

import snap@1.4.0.0/main.bend as Snap
import Base
import snap@1.4.0.0/src/effect.bend as Effect
import snap@1.4.0.0/src/par.bend as Par

30# several programs run at once, each answered exactly as `run` answers one, in
31# the order the jobs were given; a job `run` would refuse answers 127 in its
32# place. `at` is a directory the caller owns and this fills: job n writes to
33# `at/n`. A width of "" leaves the count to the effect, which reads the cores
34# and divides them by `gb`, the memory cap each job runs under. `by` is the
35# second every job must be finished by, or "0" for none.
36def par(  # noqa: L001 IO entry point
37  js: List<&2, List<&2, String>>,
38  +width: String,
39  +gb: String,
40  +at: String,
41  +by: String
42) -> IO(List<&2, String>):
43  do IO<List<&2, String>>:
44    +out : String <- Effect.snaprun.par(Par.par.plan(js, width, gb, at, by))
45    +cs : List<&2, String> <- IO.pure(List<&2, String>, Par.par.nonblank(String.lines(out)))
46    bodies : List<&2, Maybe<&2, String>> <- Par.par.bodies(cs, at, 0n)
47    return Par.par.answers(cs, bodies)

Uses (12)

Used by (2)