EasyJobsBase.AsyncExecutorType
AsyncExecutor(; 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.IndependentJobType
Job(core::Thunk; description="", username="")

Create a simple job.

Arguments

  • core: a Thunk 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.chain!Method
chain!(x::AbstractJob, y::AbstractJob, z::AbstractJob...)

Chain multiple AbstractJobs one after another.

EasyJobsBase.endtimeofMethod
endtimeof(job::AbstractJob)

Return the end time of the job. Return nothing if it has not exited.

EasyJobsBase.execute!Method
execute!(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.run!Method
run!(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.starttimeofMethod
starttimeof(job::AbstractJob)

Return the start time of the job. Return nothing if it is still pending.

EasyJobsBase.timecostofMethod
timecostof(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.getresultMethod
getresult(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.