system¶
job_cache_runner.wake¶
- def mkJobCacheRunner (hashFn: Result RunnerInput Error¶
wakeroot is the absolute sandbox-path from which input and output files will be interpreted as being relative to if they’re in fact relative.
Parameters:
Result RunnerInput Error, Result String Error, String, Runner
Return Type:
Runner
remote_cache_runner.wake¶
- target rscRunner (rscApi: RemoteCacheApi): Runner¶
rscRunner: Creates a remote cache runner for a given api config
` rscRunner (RemoteCacheApi "local" 1234 "auth") = (Runner ...) `
- def mkRemoteCacheRunner (rscApi: RemoteCacheApi) (hashFn: Result RunnerInput Error¶
mkRemoteCacheRunner: Creates a remote cache runner from an underlying runner
rscApi: the remote cache to connect to
hashFn: a runner provided hash, used to invalate jobs that match by key but not by something
known only to the runner - wakeroot: Absolute path to the root of the wake project - baseRunner: The runner that should be used for a cache miss
` mkRemoteCacheRunner (RemoteCacheApi ...) (\_ Pass "") "" baseRunner = (Runner ...) `
Parameters:
RemoteCacheApi, Result RunnerInput Error, Result String Error, String, Runner
Return Type:
Runner
job.wake¶
- def runJobImp label cmd env dir stdin res usage finputs foutputs vis pers run (LogLevel echo) (LogLevel stdout) (LogLevel stderr) isatty¶
No description for this feature yet.
Parameters:
String, List String, List String, String, String, List String, Usage, List String, List String, List String, List String, List Path, Persistence, Job, Result RunnerInput Error, Result RunnerOutput Error, LogLevel, LogLevel, LogLevel, Boolean
Return Type:
Job
- def runJobWith (Runner _ _ run) (Plan label cmd vis env dir stdin stdout stderr echo pers res usage finputs foutputs isatty)¶
No description for this feature yet.
Parameters:
Runner, Plan
Return Type:
Job
- def setJobTag (key: String) (value: String) (job: Job): Job¶
Set the value of a tag on a Job This is useful for post-build reflection into the database
Parameters:
key: String, value: String, job: Job
Return Type:
Job
- def getJobReport (job: Job): Result Usage Error¶
Actual usage of a finished job
Parameters:
job: Job
Return Type:
Result Usage Error
- def getJobRecord (job: Job): Option Usage¶
From database, available the moment a Job exists
Parameters:
job: Job
Return Type:
Option Usage
- def getJobStdoutRaw (job: Job): Result String Error¶
No description for this feature yet.
Parameters:
job: Job
Return Type:
Result String Error
- def getJobStderrRaw (job: Job): Result String Error¶
No description for this feature yet.
Parameters:
job: Job
Return Type:
Result String Error
- def getJobFailedStdoutRaw (job: Job): Result String Error¶
Gives the full stdout of a job as a string, without any manipulation. Returns the result successfully as long as the job was successfully launched and closed its stdout handle at some point during its execution. This generally occurs by the process simply terminating. The only case where this would return a failure is if the job did not successfully launch.
Parameters:
job: Job
Return Type:
Result String Error
- def getJobFailedStderrRaw (job: Job): Result String Error¶
Gives the full stderr of a job as a string, without any manipulation. Returns the result successfully as long as the job was successfully launched and closed its stderr handle at some point during its execution. This generally occurs by the process simply terminating. The only case in which this would return a failure is if the job did not successfully launch.
Parameters:
job: Job
Return Type:
Result String Error
- def getJobStdout (job: Job): Result String Error¶
Gives the job’s stdout if the job exited with an exit code of zero. The output will be manipulated to not contain ANSI escape codes.
Parameters:
job: Job
Return Type:
Result String Error
- def getJobStderr (job: Job): Result String Error¶
Gives the job’s stderr if the job exited with an exit code of zero. The output will be manipulated to not contain ANSI escape codes.
Parameters:
job: Job
Return Type:
Result String Error
- def getJobFailedStdout (job: Job): Result String Error¶
Gives the job’s stdout if the job was launched successfully and closed its stdout at some point. The output will be manipulated to not contain ANSI escape codes.
Parameters:
job: Job
Return Type:
Result String Error
- def getJobFailedStderr (job: Job): Result String Error¶
Gives the job’s stdout if the job was launched successfully and closed its stdout at some point. The output will be manipulated to not contain ANSI escape codes.
Parameters:
job: Job
Return Type:
Result String Error
- def getJobInputs (job: Job): Result (List Path) Error¶
No description for this feature yet.
Parameters:
job: Job
Return Type:
Result (List Path) Error
- def getJobOutputs (job: Job): Result (List Path) Error¶
No description for this feature yet.
Parameters:
job: Job
Return Type:
Result (List Path) Error
- def getJobFailedInputs (job: Job): Result (List Path) Error¶
No description for this feature yet.
Parameters:
job: Job
Return Type:
Result (List Path) Error
- def getJobFailedOutputs (job: Job): Result (List Path) Error¶
No description for this feature yet.
Parameters:
job: Job
Return Type:
Result (List Path) Error
- def getJobId (job: Job): Integer¶
No description for this feature yet.
Parameters:
job: Job
Return Type:
Integer
- def getJobDescription (job: Job): String¶
No description for this feature yet.
Parameters:
job: Job
Return Type:
String
- def getJobOutput (job: Job): Result Path Error¶
No description for this feature yet.
Parameters:
job: Job
Return Type:
Result Path Error
- def isJobOk (job: Job): Boolean¶
No description for this feature yet.
Parameters:
job: Job
Return Type:
Boolean
- def getJobStatus (job: Job): Status¶
No description for this feature yet.
Parameters:
job: Job
Return Type:
Status
- def access (file: String) (mode: Integer): Boolean¶
No description for this feature yet.
Parameters:
file: String, mode: Integer
Return Type:
Boolean
plan.wake¶
- tuple Plan¶
A Plan describes a not-yet-executed Job
Parameters:
Label: String, Command: List String, Visible: List Path, Environment: List String, Directory: String, Stdin: String, Stdout: LogLevel, Stderr: LogLevel, Echo: LogLevel, Persistence: Persistence, Resources: List String, Usage: Usage, FnInputs: List String, List String, FnOutputs: List String, List String, IsAtty: Boolean
Return Type:
Plan
- def getPlanOnce p¶
No description for this feature yet.
Parameters:
p: Plan
Return Type:
Boolean
- def getPlanKeep p¶
No description for this feature yet.
Parameters:
p: Plan
Return Type:
Boolean
No description for this feature yet.
Parameters:
p: Plan
Return Type:
Boolean
- def setPlanFilterOutputs (filterFn: (file: String)¶
Sets the FnOutputs field in a Plan by using the given filter function to filter out unneeded files created during a job. This function is recommended over directly setting the FnOutputs field with setPlanFnOutputs.
Parameters: - filterFn: Determines whether to keep a file that was created or not. True means keep the file.
Parameters:
filterFn: file: String, Boolean, Plan
Return Type:
Plan
- def setPlanOnce v p¶
If Once is set to False, no job deduplication is performed and so it must not write any files (stdout/stderr are fine) or be guaranteed to only be encountered once in any wake execution anyway.
Parameters:
v: Boolean, p: Plan
Return Type:
Plan
- def setPlanKeep v p¶
No description for this feature yet.
Parameters:
v: Boolean, p: Plan
Return Type:
Plan
No description for this feature yet.
Parameters:
v: Boolean, p: Plan
Return Type:
Plan
- def prependPlanPath (value: String) (plan: Plan): Plan¶
Prepend ‘value’ to the Plan’s ‘PATH’ environment value
Parameters:
value: String, plan: Plan
Return Type:
Plan
- def setPlanEnvVar (name: String) (value: String) (plan: Plan): Plan¶
Set an environment variable in a Plan
Parameters:
name: String, value: String, plan: Plan
Return Type:
Plan
- def editPlanOnce (f: Boolean¶
If Once is set to False, no job deduplication is performed and so it must not write any files (stdout/stderr are fine) or be guaranteed to only be encountered once in any wake execution anyway.
Parameters:
f: Boolean, Boolean, Plan
Return Type:
Plan
- def editPlanKeep (f: Boolean¶
No description for this feature yet.
Parameters:
f: Boolean, Boolean, Plan
Return Type:
Plan
No description for this feature yet.
Parameters:
f: Boolean, Boolean, Plan
Return Type:
Plan
- def getPlanHash (plan: Plan): Integer¶
Get a unique hash-code for the job
Parameters:
plan: Plan
Return Type:
Integer
- def makePlan (label: String) (visible: List Path) (command: String): Plan¶
Create a labeled shell plan.
Parameters:
label: String, visible: List Path, command: String
Return Type:
Plan
- def makeExecPlan (cmd: List String) (visible: List Path): Plan¶
Set reasonable defaults for all Plan arguments
Parameters:
cmd: List String, visible: List Path
Return Type:
Plan
- def makeShellPlan (script: String) (visible: List Path): Plan¶
No description for this feature yet.
Parameters:
script: String, visible: List Path
Return Type:
Plan
runner.wake¶
- tuple Usage¶
No description for this feature yet.
Parameters:
Status: Integer, Runtime: Double, CPUtime: Double, MemBytes: Integer, InBytes: Integer, OutBytes: Integer
Return Type:
Usage
- def getUsageThreads (Usage _ run cpu _ _ _: Usage): Double¶
No description for this feature yet.
Parameters:
Usage
Return Type:
Double
- tuple RunnerInput¶
RunnerInput is a subset of the fields supplied in the execution Plan
Parameters:
Label: String, Command: List String, Visible: List Path, Environment: List String, Directory: String, Stdin: String, Resources: List String, Prefix: String, Record: Usage, IsAtty: Boolean
Return Type:
RunnerInput
- tuple RunnerOutput¶
No description for this feature yet.
Parameters:
Inputs: List String, Outputs: List String, Usage: Usage
Return Type:
RunnerOutput
- tuple Runner¶
A Runner describes a way to invoke a Plan to get a Job
Parameters:
Name: String, Score: Plan, Result Double String, Fn: Job, Result RunnerInput Error, Result RunnerOutput Error
Return Type:
Runner
- def makeRunner name score pre post (Runner _ _ run)¶
No description for this feature yet.
Parameters:
String, Plan, Result Double String, Result RunnerInput Error, Pair Result RunnerInput Error a, Pair Result RunnerOutput Error a, Result RunnerOutput Error, Runner
Return Type:
Runner
- def makeJSONRunnerPlan (rawScript: String) (score: Plan¶
make a
JSONRunnerPlan
withNil
and(_)
as defaults forExtraArgs
andEstimate
respectively rawScript: String; the path to the script to run jobs with score: runJob chooses the runner with the largest score for a PlanParameters:
rawScript: String, score: Plan, Result Double String
Return Type:
JSONRunnerPlan
- def makeJSONRunner (plan: JSONRunnerPlan): Runner¶
Make a Runner that runs a named script to run jobs plan: JSONRunnerPlan; a tuple containing the arguments for this function
Parameters:
plan: JSONRunnerPlan
Return Type:
Runner
http.wake¶
plan_scorer.wake¶
environment.wake¶
- topic path: String¶
A topic used to globally add directories to the default PATH of a Plans
- topic environment: String¶
A topic used to globally add variables to the default environment of Plans
- def getenv (key: String): Option String¶
getenv: access environment variables provided to the wake executable Use of this function can lead to unnecessary rebuilds!
Parameters:
key: String
Return Type:
Option String
- def getEnvironment (key: String) (environment: List String): Option String¶
Retrieve the value for ‘key’ from a KEY=VALUE environment list
Parameters:
key: String, environment: List String
Return Type:
Option String
- def unsetEnvironment (key: String) (environment: List String): List String¶
Remove a key from a KEY=VALUE environment list
makePlan … | editPlanEnvironment (unsetEnvironment “JAVA_HOME”) | …
Parameters:
key: String, environment: List String
Return Type:
List String
- def setEnvironment (key: String) (value: String) (environment: List String): List String¶
Set key=value in an environment list, removing all prior values for that key
makePlan … | editPlanEnvironment (setEnvironment “HELLO” “world”) | …
Parameters:
key: String, value: String, environment: List String
Return Type:
List String
- def editEnvironment (key: String) (fn: Option String¶
Update a key’s value in a KEY=VALUE environment list All prior values for that key are rmeoved Only the first match (if any) is supplied to fn
Parameters:
key: String, fn: Option String, Option String, environment: List String
Return Type:
List String
- def addEnvironmentPath (path: String) (environment: List String): List String¶
Add a component to the PATH in a KEY=VALUE environment
makePlan … | editPlanEnvironment (addEnvironmentPath “/usr/local/bin”) | …
Parameters:
path: String, environment: List String
Return Type:
List String
- def addEnvironmentPathOpt (pathopt: Option String) (environment: List String): List String¶
Optionally add a component to the PATH in a KEY=VALUE environment
Parameters:
pathopt: Option String, environment: List String
Return Type:
List String
path.wake¶
- def simplify (path: String): String¶
Simplify away the ..s and .s in a String
Parameters:
path: String
Return Type:
String
- def sortPaths (paths: List Path): List Path¶
No description for this feature yet.
Parameters:
paths: List Path
Return Type:
List Path
- def in (dir: String) (path: String): String¶
Concatenate two paths in “foo” “bar” => “foo/bar” in “foo” “/bar ” => “/bar” in “/foo” “bar” => “/foo/bar” in “foo” “../bar” => “bar”
Parameters:
dir: String, path: String
Return Type:
String
- def relative (dir: String) (path: String): String¶
Reframe path into a form accesible relative to dir For example: relative “bin” “bin/usr” => “usr” relative “bin” “bin” => “.” relative “bin” “hax” => “../hax”
Parameters:
dir: String, path: String
Return Type:
String
- target whichIn (path: String) (exec: String): String¶
Locate an executable in the search path
- def which (exec: String): String¶
No description for this feature yet.
Parameters:
exec: String
Return Type:
String
- target whichInEnvPath (exec: String): Option String¶
Locate an executable in the users env PATH
- def basename (file: String): String¶
Remove any leading directories from file.
Parameters: - file: The filename to simplify
Guarantees: - The resulting String contains no ‘/’s
` basename "abc/def" = "def" basename "abc/def/" = "def" basename "/foo/bar" = "bar" basename "/foo" = "foo" basename "foo-bar" = "foo-bar" `
Parameters:
file: String
Return Type:
String
- def dirname (file: String): String¶
Extract the directory name from file.
Parameters: - file: The filename to simplify
Guarantees: - The resulting String is non-empty
` dirname "foo/bar" = "foo" dirname "bar" = "." dirname "/bar" = "/" dirname "/foo/bar" = /foo" `
Parameters:
file: String
Return Type:
String
- def isPathDir (path: Path): Boolean¶
No description for this feature yet.
Parameters:
path: Path
Return Type:
Boolean
- def getPathParent (path: Path): Path¶
No description for this feature yet.
Parameters:
path: Path
Return Type:
Path
- target markFileCleanable (filepath: String): Result Unit Error¶
Allow an untracked file to be removed via wake –clean
io.wake¶
- tuple Permission¶
The various flags of a given file permission.
Parameters:
Read: Boolean, Write: Boolean, Execute: Boolean
Return Type:
Permission
- def perm2bits (perm: Permission)¶
Converts a Permission tuple to a masked Linux permission bit field.
perm2bits (Permission False True True) -> 3 perm2bits (Permission True True False) -> 6
Parameters:
perm: Permission
Return Type:
Integer
- def bits2perm (bits: Integer)¶
Converts a masked Linux permission bit field to a Permission tuple
bits2perm 3 -> (Permission False True True) bits2perm 6 -> (Permission True True False)
Parameters:
bits: Integer
Return Type:
Permission
- tuple Mode¶
The full permission set of a given Path
Parameters:
User: Permission, Group: Permission, Other: Permission
Return Type:
Mode
- def bits2mode (bits: Integer)¶
Converts an unmasked permission bit field into a Mode tuple
bits2mode 365 -> Mode (Permission True False True) (Permission True False True) (Permission True False True)
Parameters:
bits: Integer
Return Type:
Mode
- def mode2bits (mode: Mode)¶
Converts Mode tuple into an unmasked permission bit field
mode2bits Mode (Permission True False True) (Permission True False True) (Permission True False True) -> 365
Parameters:
mode: Mode
Return Type:
Integer
- tuple Stat¶
The system Stat of a given Path
Parameters:
Type: PathType, Mode: Mode, SizeBytes: Integer
Return Type:
Stat
- target stat (path: Path): Result Stat Error¶
Returns the system Stat for a given path
- target unsafe_stat (path: String): Result Stat Error¶
Returns the system Stat for a given path string. Prefer stat instead
Should only be used in rare cases where wake invariants are upheld by the caller
- def read (path: Path): Result String Error¶
Read the file contents of a Path
Parameters:
path: Path
Return Type:
Result String Error
- def write (path: String) (content: String): Result Path Error¶
Create all directories and the named file. The content string is written verbatim with no processing. For example, a final terminating newline character is not appended to the end of the string.
Parameters:
path: String, content: String
Return Type:
Result Path Error
- def writeTempFile (prefix: String) (content: String): Result Path Error¶
Writes a string to an intermediate file that will not conflict with other files.
Identical prefix+files will be automatically deduplicated
Parameters:
prefix: String, content: String
Return Type:
Result Path Error
- def writeIn (parent: Path) (mode: Integer) (name: String) (content: String): Result Path Error¶
Create a file with the given mode in the specified directory
Parameters:
parent: Path, mode: Integer, name: String, content: String
Return Type:
Result Path Error
- def installAs (dest: String) (file: Path): Result Path Error¶
installAs: copy a file to a specified destination
Parameters:
dest: String, file: Path
Return Type:
Result Path Error
- def installIn (toRoot: String) (fromRoot: String) (sourcePath: Path): Result Path Error¶
Copy a file from one directory subtree to another installIn “/to” “from” “from/subdir/file” => “/to/subdir/file” installIn “/to” “.” “from/subdir/file” => “/to/from/subdir/file” installIn “/to” “/from” “/from/subdir/file” => “/to/subdir/file” installIn “/to” “/” “/from/subdir/file” => “/to/from/subdir/file” These fail: installIn “/to” “from” “subdir/file” installIn “/to” “/from” “/subdir/file” installIn “/to” “from” “/from/subdir/file” installIn “/to” “/from” “from/subdir/file”
Parameters:
toRoot: String, fromRoot: String, sourcePath: Path
Return Type:
Result Path Error
- def mkdirIn (parent: Path) (mode: Integer) (name: String): Result Path Error¶
Create a directory in the parent
Parameters:
parent: Path, mode: Integer, name: String
Return Type:
Result Path Error
- def mkdir (path: String): Result Path Error¶
Make all every element in the directory path with mode 0755
Parameters:
path: String
Return Type:
Result Path Error
remote_cache_api.wake¶
- tuple RemoteCacheApi¶
Configuration details required to connect to the remote shared cache.
Parameters:
Domain: String, Port: Integer, Authorization: Option String
Return Type:
RemoteCacheApi
- def makeRemoteCacheApi (config: String): Result RemoteCacheApi Error¶
makeRemoteCacheApi: Parses config string into RemoteCacheApi
` makeRemoteCacheApi "local:1234:myauth" = Pass (RemoteCacheApi "local" 1234 (Some "myauth")) makeRemoteCacheApi "local:1234:" = Pass (RemoteCacheApi "local" 1234 None) makeRemoteCacheApi "local:1234" = Fail (...) makeRemoteCacheApi "local" = Fail (...) makeRemoteCacheApi "local:asdf:myauth" = Fail (...) `
Parameters:
config: String
Return Type:
Result RemoteCacheApi Error
- def rscApiPostStringBlob (name: String) (value: String) (api: RemoteCacheApi): Result String Error¶
rscApiPostStringBlob: Posts a named string as a blob to the remote server defined by api then returns the id associated to the blob. Requires authorization.
` api | rscApiPostStringBlob "foo" "my foo contents" = Pass "asdf-fdsa-asdf-fdsa" (RemoteCacheApi "foo" 1 None) | rscApiPostStringBlob "foo" "my foo contents" = Fail "authorization required" `
Parameters:
name: String, value: String, api: RemoteCacheApi
Return Type:
Result String Error
- def rscApiPostFileBlob (name: String) (file: String) (api: RemoteCacheApi): Result String Error¶
rscApiPostFileBlob: Posts a named file on disk to the remote server defined by api then returns the id associated to the blob. Requires authorization.
` api | rscApiPostFileBlob "foo" "/some/path/to/foo" = Pass "asdf-fdsa-asdf-fdsa" (RemoteCacheApi "foo" 1 None) | rscApiPostFileBlob "foo" "/some/path/to/foo" = Fail "authorization required" `
Parameters:
name: String, file: String, api: RemoteCacheApi
Return Type:
Result String Error
- def rscApiPostJob (req: CachePostRequest) (api: RemoteCacheApi): Result Unit Error¶
rscApiPostJob: Posts a job defined by req to the remote cache server. Requires authorization.
` api | rscApiPostJob (CachePostRequest ...) = Pass Unit (RemoteCacheApi "foo" 1 None) | rscApiPostJob (CachePostRequest ...) = Fail "authorization required" `
Parameters:
req: CachePostRequest, api: RemoteCacheApi
Return Type:
Result Unit Error
- def rscApiFindMatchingJob (req: CacheSearchRequest) (api: RemoteCacheApi): Result CacheSearchResponse Error¶
rscApiFindMatchingJob: Searches the remote server defined by api for a cached job that matches the job key provided by req. Returns a response that may or may not have the matching job. Does not require authorization.
` api | rscApiFindMatchingJob (CacheSearchRequest ...) = Pass (CacheSearchResponse ...) `
Parameters:
req: CacheSearchRequest, api: RemoteCacheApi
Return Type:
Result CacheSearchResponse Error
- def rscApiGetStringBlob ((CacheSearchBlob _ uri): CacheSearchBlob): Result String Error¶
rscApiGetStringBlob: Downloads a blob and returns the contents as a string
` rscApiGetStringBlob (RemoteCacheBlob "asdf" "https://...") = Pass "foo\nbar\nbat" `
Parameters:
CacheSearchBlob
Return Type:
Result String Error
- def rscApiGetFileBlob ((CacheSearchBlob _ uri): CacheSearchBlob) (path: String) (mode: Integer): Result String Error¶
rscApiGetFileBlob: Downloads a blob to path with mode permisssions and return path
` rscApiGetFileBlob (RemoteCacheBlob "asdf" "https://...") "foo/bar" 0644 = Pass "foo/bar" `
Parameters:
CacheSearchBlob, String, Integer
Return Type:
Result String Error
sources.wake¶
- def files (dir: String) (regexp: RegExp): List String¶
Find files WARNING! Use of this method can make a build unreproducible. Depending on when the method is invoked, the results may vary! This method is intended to be used by the outputFn of localRunner Jobs.
Parameters:
dir: String, regexp: RegExp
Return Type:
List String
- def source (file: String): Result Path Error¶
No description for this feature yet.
Parameters:
file: String
Return Type:
Result Path Error
- def claim (file: String): Result Path Error¶
Allows claiming of a file so long as the file is within wake’s workspace. Keep in mind that if another job produced this file in the same run of wake, claim will fail. Likewise if you claim a file then any job that produces this file will fail. Claim should be thought of as a “virtual” job and wake demands that all paths be produced by exactly one job, virtual or otherwise.
For source files please use source. For files outside of wake’s workspace please use claimFileAsPath or claimFileAsPathIn. claim is good for claiming artifacts of previous builds that should not be rebuilt during this run.
Parameters: - file: The string giving the path to the file to be claimed
Example:
` claim "build/my_flow/my_step/previous-output.txt" # Claims the file `
Parameters:
file: String
Return Type:
Result Path Error
- def sources (dir: String) (filterRegexp: RegExp): Result (List Path) Error¶
Find sources files
Parameters:
dir: String, filterRegexp: RegExp
Return Type:
Result (List Path) Error
- def claimFileAsPath (existingFile: String) (desiredWorkspacePath: String): Result Path Error¶
This API makes it possible to include a non-source file into a wake build. Generally, one should obtain Paths from sources or as the output of Jobs. This API is useful for things like a command-line-supplied input file.
Parameters:
existingFile: String, desiredWorkspacePath: String
Return Type:
Result Path Error
- def claimFileAsPathIn (outputDirectory: Path) (existingFile: String) (desiredName: String): Result Path Error¶
No description for this feature yet.
Parameters:
outputDirectory: Path, existingFile: String, desiredName: String
Return Type:
Result Path Error