Skip to content

Retry hako oneshot when no tasks started - #104

Merged
eagletmt merged 2 commits into
cookpad:masterfrom
eagletmt:retry-if-no-tasks-started
Jun 18, 2026
Merged

eagletmt merged 2 commits into
cookpad:masterfrom
eagletmt:retry-if-no-tasks-started

Conversation

@eagletmt

Copy link
Copy Markdown
Member

Retry the hako oneshot command up to 10 times when it fails with NoTasksStarted, which can happen on ECS Managed Instances, instead of failing the job immediately. Apply the same retry to both start_execution and start_retry.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves resiliency of the Hako executor by retrying hako oneshot when it fails with NoTasksStarted (observed on ECS Managed Instances), instead of failing the job immediately. The retry behavior is applied consistently to both initial executions and retries.

Changes:

  • Add NoTasksStarted detection and retry loop (up to 10 attempts) to start_execution and start_retry.
  • Introduce no_tasks_started? helper to identify the NoTasksStarted failure from Hako output.
  • Add RSpec coverage for success-after-retries and give-up-after-max-retries behavior for both execution and retry flows.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
lib/barbeque/executor/hako.rb Implements NoTasksStarted detection and retry logic for both execution paths.
spec/barbeque/executor/hako_spec.rb Adds specs validating the new retry behavior for start_execution and start_retry.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/barbeque/executor/hako.rb Outdated
Comment on lines +40 to +42
max_no_tasks_started_retries = 10
max_no_tasks_started_retries.times do |i|
stdout, stderr, status = Bundler.with_unbundled_env { Open3.capture3(@hako_env, *cmd, chdir: @hako_dir) }
Comment thread lib/barbeque/executor/hako.rb Outdated
Comment on lines +70 to +72
max_no_tasks_started_retries = 10
max_no_tasks_started_retries.times do |i|
stdout, stderr, status = Bundler.with_unbundled_env { Open3.capture3(@hako_env, *cmd, chdir: @hako_dir) }
Retry the hako oneshot command up to 10 times when it fails with
NoTasksStarted, which can happen on ECS Managed Instances, instead of
failing the job immediately. Apply the same retry to both
start_execution and start_retry.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@eagletmt
eagletmt force-pushed the retry-if-no-tasks-started branch from 3c342c6 to c0ec9ee Compare June 17, 2026 08:47
Comment thread lib/barbeque/executor/hako.rb Outdated
Barbeque::SlackNotifier.notify_job_execution(job_execution)
job_execution.retry_if_possible!

max_no_tasks_started_retries = 10

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: How about using a constant?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🆗 11d90b6

@eagletmt
eagletmt merged commit aa9acfc into cookpad:master Jun 18, 2026
1 check passed
@eagletmt
eagletmt deleted the retry-if-no-tasks-started branch June 18, 2026 04:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants