75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
# File 'lib/barbeque/executor/docker.rb', line 75
def poll_retry(job_retry)
container = Barbeque::DockerContainer.find_by!(message_id: job_retry.message_id)
job_execution = job_retry.job_execution
info = inspect_container(container.container_id)
if info['State'] && info['State']['Status'] != 'running'
finished_at = Time.zone.parse(info['State']['FinishedAt'])
exit_code = info['State']['ExitCode']
status = exit_code == 0 ? :success : :failed
Barbeque::ApplicationRecord.transaction do
job_retry.update!(status: status, finished_at: finished_at)
job_execution.update!(status: status)
end
stdout, stderr = get_logs(container.container_id)
Barbeque::ExecutionLog.save_stdout_and_stderr(job_retry, stdout, stderr)
Barbeque::SlackNotifier.notify_job_retry(job_retry)
if status == :failed
job_execution.retry_if_possible!
end
end
end
|