9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/startback/jobs/operation/run_job.rb', line 9
def call
services = context.factor(Services)
@job = services.get_job!(input)
job_context = context.fork(@job.op_context)
job_class = ::Kernel.const_get(@job.op_class)
job_input = @job.op_input
has_failed, op_result = with_context(job_context) do
op_result = run job_class.new(job_input)
[false, op_result]
rescue => err
[true, error_to_result(err) ]
end
services.update_job!(input, {
opResult: op_result,
hasFailed: has_failed,
isReady: true,
strategy: 'Embedded',
})
op_result
end
|