class Mosquito::JobRun
- Mosquito::JobRun
- Reference
- Object
Overview
A JobRun is a unit of work which will be performed by a Job. JobRuns know how to:
- store and retrieve their data to and from the datastore
- figure out what Job class they match to
- build an instance of that Job class and pass off the config data
- Ask the job to run
JobRun data is called config
and is persisted in the backend under the key
mosquito:job_run:job_run_id
.
Defined in:
mosquito/job_run.crConstant Summary
-
CONFIG_KEY_PREFIX =
"job_run"
Constructors
Class Method Summary
-
.config_key(*parts)
The config key is the backend storage key for the metadata of this job_run.
-
.retrieve(id : String)
Used to construct a job_run from the parameters stored in the backend.
Instance Method Summary
-
#==(other : self)
Returns
true
if this reference is the same as other. -
#build_job : Mosquito::Job
Builds a Job instance from this job_run.
-
#config_key
The config key is the backend storage key for the metadata of this job_run.
-
#delete(in ttl : Int = 0)
Deletes this job_run from the backend.
- #enqueue_time : Time
-
#fail
Fails this job run and make sure it's persisted as such.
- #id : String
- #job : Mosquito::Job | Nil
- #job! : Mosquito::Job
-
#reload : Nil
Updates this job_run config from the backend.
-
#reschedule_interval
For the current retry count, how long should a runner wait before retry?
-
#rescheduleable?
For the current retry count, is the job rescheduleable?
- #retry_count : Int32
-
#run
Builds and runs the job with this job_run config.
-
#store
Stores this job run configuration and metadata in the backend.
-
#to_s(io : IO)
Appends a short String representation of this object which includes its class name and its object address.
- #type : String
Constructor Detail
Class Method Detail
The config key is the backend storage key for the metadata of this job_run.
Used to construct a job_run from the parameters stored in the backend.
Instance Method Detail
Returns true
if this reference is the same as other. Invokes same?
.
Builds a Job instance from this job_run. Populates the job with config from the backend.
Deletes this job_run from the backend. Optionally, after a delay in seconds (handled by the backend).
Appends a short String representation of this object which includes its class name and its object address.
class Person
def initialize(@name : String, @age : Int32)
end
end
Person.new("John", 32).to_s # => #<Person:0x10a199f20>