class Mosquito::JobRun

Overview

A JobRun is a unit of work which will be performed by a Job. JobRuns know how to:

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.cr

Constant Summary

CONFIG_KEY_PREFIX = "job_run"

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(type : String, enqueue_time : Time = Time.utc, id : String | Nil = nil, retry_count : Int32 = 0) #

[View source]

Class Method Detail

def self.config_key(*parts) #

The config key is the backend storage key for the metadata of this job_run.


[View source]
def self.retrieve(id : String) #

Used to construct a job_run from the parameters stored in the backend.


[View source]

Instance Method Detail

def ==(other : self) #
Description copied from class Reference

Returns true if this reference is the same as other. Invokes same?.


[View source]
def build_job : Mosquito::Job #

Builds a Job instance from this job_run. Populates the job with config from the backend.


[View source]
def config_key #

The config key is the backend storage key for the metadata of this job_run.


[View source]
def delete(in ttl : Int = 0) #

Deletes this job_run from the backend. Optionally, after a delay in seconds (handled by the backend).


[View source]
def enqueue_time : Time #

[View source]
def fail #

Fails this job run and make sure it's persisted as such.


[View source]
def id : String #

[View source]
def job : Mosquito::Job | Nil #

[View source]
def job! : Mosquito::Job #

[View source]
def reload : Nil #

Updates this job_run config from the backend.


[View source]
def reschedule_interval #

For the current retry count, how long should a runner wait before retry?


[View source]
def rescheduleable? #

For the current retry count, is the job rescheduleable?


[View source]
def retry_count : Int32 #

[View source]
def run #

Builds and runs the job with this job_run config.


[View source]
def store #

Stores this job run configuration and metadata in the backend.


[View source]
def to_s(io : IO) #
Description copied from class Reference

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>

[View source]
def type : String #

[View source]