Class: Plines::EnqueuedJob
Overview
Once a Plines::Job has been enqueued as a Qless job into redis, an EnqueuedJob is used to represent and hold the additional state that Plines needs to track about the job.
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#declared_redis_object_keys, included, #key_prefix, #new_redis_object
Constructor Details
#initialize(qless, pipeline, jid, &block) ⇒ EnqueuedJob
Returns a new instance of EnqueuedJob.
12
13
14
15
16
17
|
# File 'lib/plines/enqueued_job.rb', line 12
def initialize(qless, pipeline, jid, &block)
@qless = qless
@redis = qless.redis
super(pipeline, jid)
instance_eval(&block) if block
end
|
Instance Attribute Details
#jid ⇒ Object
Also known as:
id
Returns the value of attribute jid
7
8
9
|
# File 'lib/plines/enqueued_job.rb', line 7
def jid
@jid
end
|
#pipeline ⇒ Object
Returns the value of attribute pipeline
7
8
9
|
# File 'lib/plines/enqueued_job.rb', line 7
def pipeline
@pipeline
end
|
#qless ⇒ Object
Returns the value of attribute qless.
10
11
12
|
# File 'lib/plines/enqueued_job.rb', line 10
def qless
@qless
end
|
#redis ⇒ Object
Returns the value of attribute redis.
10
11
12
|
# File 'lib/plines/enqueued_job.rb', line 10
def redis
@redis
end
|
Class Method Details
.create(qless, pipeline, jid, *external_dependencies) ⇒ Object
19
20
21
22
23
24
25
|
# File 'lib/plines/enqueued_job.rb', line 19
def self.create(qless, pipeline, jid, *external_dependencies)
new(qless, pipeline, jid) do
external_dependencies.each do |dep|
pending_ext_deps << dep
end
end
end
|
Instance Method Details
#all_external_dependencies ⇒ Object
43
44
45
46
47
|
# File 'lib/plines/enqueued_job.rb', line 43
def all_external_dependencies
pending_ext_deps.union(
resolved_ext_deps, timed_out_ext_deps
)
end
|
#pending_external_dependencies ⇒ Object
31
32
33
|
# File 'lib/plines/enqueued_job.rb', line 31
def pending_external_dependencies
pending_ext_deps.members
end
|
#qless_job ⇒ Object
27
28
29
|
# File 'lib/plines/enqueued_job.rb', line 27
def qless_job
qless.jobs[jid]
end
|
#resolve_external_dependency(name) ⇒ Object
53
54
55
56
|
# File 'lib/plines/enqueued_job.rb', line 53
def resolve_external_dependency(name)
update_external_dependency \
name, resolved_ext_deps, pending_ext_deps, timed_out_ext_deps
end
|
#resolved_external_dependencies ⇒ Object
35
36
37
|
# File 'lib/plines/enqueued_job.rb', line 35
def resolved_external_dependencies
resolved_ext_deps.members
end
|
#timed_out_external_dependencies ⇒ Object
39
40
41
|
# File 'lib/plines/enqueued_job.rb', line 39
def timed_out_external_dependencies
timed_out_ext_deps.members
end
|
#timeout_external_dependency(name) ⇒ Object
58
59
60
61
|
# File 'lib/plines/enqueued_job.rb', line 58
def timeout_external_dependency(name)
update_external_dependency \
name, timed_out_ext_deps, pending_ext_deps
end
|
#unresolved_external_dependencies ⇒ Object
49
50
51
|
# File 'lib/plines/enqueued_job.rb', line 49
def unresolved_external_dependencies
pending_ext_deps.union(timed_out_ext_deps)
end
|