Class: Ductr::Job
- Inherits:
-
ActiveJob::Base
- Object
- ActiveJob::Base
- Ductr::Job
- Extended by:
- Annotable, Forwardable
- Includes:
- JobStatus
- Defined in:
- lib/ductr/job.rb
Overview
The base class for any job, you can use it directly if you don’t need an ETL job.
Instance Attribute Summary collapse
-
#error ⇒ Exception
readonly
The occurred error if any.
-
#status ⇒ Symbol
readonly
The job’s status, one of ‘:queued`, `:working`, `:completed` and `:failed`.
Instance Method Summary collapse
-
#adapter(name) ⇒ Adapter
The configured adapter instances.
-
#logger ⇒ Ductr::Log::Logger
The job’s logger instance.
-
#perform(*_) ⇒ void
The active job’s perform method.
-
#run ⇒ void
The entry point of jobs.
Methods included from JobStatus
Instance Attribute Details
#error ⇒ Exception (readonly)
Returns The occurred error if any.
14 15 16 |
# File 'lib/ductr/job.rb', line 14 def error @error end |
#status ⇒ Symbol (readonly)
Returns The job’s status, one of ‘:queued`, `:working`, `:completed` and `:failed`.
16 17 18 |
# File 'lib/ductr/job.rb', line 16 def status @status end |
Instance Method Details
#adapter(name) ⇒ Adapter
The configured adapter instances.
36 37 38 |
# File 'lib/ductr/job.rb', line 36 def adapter(name) Ductr.config.adapter(name) end |
#logger ⇒ Ductr::Log::Logger
The job’s logger instance.
45 46 47 |
# File 'lib/ductr/job.rb', line 45 def logger @logger ||= Ductr.config.logging.new(self.class) end |
#perform(*_) ⇒ void
This method returns an undefined value.
The active job’s perform method. DO NOT override it, implement the #run method instead.
25 26 27 |
# File 'lib/ductr/job.rb', line 25 def perform(*_) run end |
#run ⇒ void
This method returns an undefined value.
The entry point of jobs.
54 55 56 |
# File 'lib/ductr/job.rb', line 54 def run raise NotImplementedError, "A job must implement the `#run` method" end |