EasyJobsBase.AsyncExecutor
— TypeAsyncExecutor(; maxattempts=1, interval=1, delay=0, wait=false)
Handle the asynchronous execution of jobs.
Arguments
maxattempts::UInt64=1
: the maximum number of attempts to execute the job.interval::Real=1
: the time interval between each attempt to execute the job, in seconds.delay::Real=0
: the delay before the first attempt to execute the job, in seconds.wait::Bool=false
: determines whether to wait for the job to complete before executing the next task.
EasyJobsBase.IndependentJob
— TypeJob(core::Thunk; description="", username="")
Create a simple job.
Arguments
core
: aThunk
that encloses the job core definition.name
: give a short name to the job.description::String=""
: describe what the job does in more detail.username::String=""
: indicate who executes the job.
Examples
julia> using Thinkers
julia> a = Job(Thunk(sleep, 5); username="me", description="Sleep for 5 seconds");
julia> b = Job(Thunk(run, `pwd` & `ls`); username="me", description="Run some commands");
EasyJobsBase.:←
— Method←(y, x)
Chain two AbstractJob
s reversely.
EasyJobsBase.:→
— Method→(x, y)
Chain two AbstractJob
s.
EasyJobsBase.chain!
— Methodchain!(x::AbstractJob, y::AbstractJob, z::AbstractJob...)
Chain multiple AbstractJob
s one after another.
EasyJobsBase.countchildren
— Methodcountchildren(job::AbstractJob)
Count the number of child jobs for a given job
.
EasyJobsBase.countexecution
— Methodcountexecution(job::AbstractJob)
Count how many times the job
has been run.
EasyJobsBase.countparents
— Methodcountparents(job::AbstractJob)
Count the number of parent jobs for a given job
.
EasyJobsBase.creationtimeof
— Methodcreationtimeof(job::AbstractJob)
Return the creation time of the job
.
EasyJobsBase.descriptionof
— Methoddescriptionof(job::AbstractJob)
Return the description of the job
.
EasyJobsBase.endtimeof
— Methodendtimeof(job::AbstractJob)
Return the end time of the job
. Return nothing
if it has not exited.
EasyJobsBase.execute!
— Methodexecute!(job::AbstractJob, exec::Executor)
Execute a given AbstractJob
associated with the Executor
.
This function checks if the job
has succeeded. If so, it stops immediately. If not, it sleeps for a exec.delay
, then runs the job
. If exec.maxattempts
is more than $1$, it loops over the remaining attempts, sleeping for an exec.interval
, running the job
, and waiting in each loop.
EasyJobsBase.filterexited
— Methodfilterexited(jobs)
Filter the exited jobs in a sequence of jobs.
EasyJobsBase.filterfailed
— Methodfilterfailed(jobs)
Filter the failed jobs in a sequence of jobs.
EasyJobsBase.filterpending
— Methodfilterpending(jobs)
Filter the pending jobs in a sequence of jobs.
EasyJobsBase.filterrunning
— Methodfilterrunning(jobs)
Filter the running jobs in a sequence of jobs.
EasyJobsBase.filtersucceeded
— Methodfiltersucceeded(jobs)
Filter the succeeded jobs in a sequence of jobs.
EasyJobsBase.getstatus
— Methodgetstatus(job::AbstractJob)
Get the current status of the job
.
EasyJobsBase.isexited
— Methodisexited(job::AbstractJob)
Test if the job
has exited.
EasyJobsBase.isfailed
— Methodisfailed(job::AbstractJob)
Test if the job
failed during running.
EasyJobsBase.ispending
— Methodispending(job::AbstractJob)
Test if the job
is still pending.
EasyJobsBase.isrunning
— Methodisrunning(job::AbstractJob)
Test if the job
is running.
EasyJobsBase.issucceeded
— Methodissucceeded(job::AbstractJob)
Test if the job
was successfully run.
EasyJobsBase.run!
— Methodrun!(job::Job; maxattempts=1, interval=1, delay=0, wait=false)
run!(job::Job, worker::Integer; maxattempts=1, interval=1, delay=0, wait=false)
Run a Job
with a maximum number of attempts, with each attempt separated by interval
seconds and an initial delay
in seconds.
EasyJobsBase.starttimeof
— Methodstarttimeof(job::AbstractJob)
Return the start time of the job
. Return nothing
if it is still pending.
EasyJobsBase.timecostof
— Methodtimecostof(job::AbstractJob)
Return the time cost of the job
since it started running.
If nothing
, the job
is still pending. If it is finished, return how long it took to complete.
Thinkers.getresult
— Methodgetresult(job::AbstractJob)
Get the running result of the job
.
The result is wrapped by a Some
type. Use something
to retrieve its value. If it is nothing
, the job
is not finished.