12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/ductwork/models/job.rb', line 12
def self.enqueue(step, *args)
now = Ductwork::DatabaseClock.now
job = step.create_job!(
klass: step.klass,
started_at: now,
input_args: JSON.dump({ args: })
)
execution = job.executions.create!(
started_at: now,
retry_count: 0,
crash_count: 0
)
execution.create_availability!(
started_at: now,
pipeline_klass: step.run.pipeline_klass
)
Ductwork.logger.info(
msg: "Job enqueued",
job_id: job.id,
job_klass: job.klass
)
job
end
|