34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/barbeque/executor/docker.rb', line 34
def start_retry(job_retry, envs)
job_execution = job_retry.job_execution
docker_image = DockerImage.new(job_execution.job_definition.app.docker_image)
cmd = build_docker_run_command(docker_image, job_execution.job_definition.command, envs)
stdout, stderr, status = Open3.capture3(*cmd)
if status.success?
Barbeque::DockerContainer.create!(message_id: job_retry.message_id, container_id: stdout.chomp)
Barbeque::ApplicationRecord.transaction do
job_execution.update!(status: :retried)
job_retry.update!(status: :running)
end
else
Barbeque::ExecutionLog.try_save_stdout_and_stderr(job_retry, stdout, stderr)
Barbeque::ApplicationRecord.transaction do
job_retry.update!(status: :failed, finished_at: Time.zone.now)
job_execution.update!(status: :failed)
end
Barbeque::SlackNotifier.notify_job_retry(job_retry)
job_execution.retry_if_possible!
end
end
|