Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runner.aws_batch: Gracefully handle errors when fetching logs for completed jobs #406

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ development source code and as such may not be routinely kept up to date.

# __NEXT__

## Bug fixes

* It is no longer a fatal error if the logs for a completed AWS Batch job
cannot be fetched for some reason. `nextstrain build` will warn about the
error but continue on with printing the job status (e.g. success or reason
for failure) and, if applicable, downloading job results.
([#406](https://github.com/nextstrain/cli/pull/406))


# 8.5.3 (3 September 2024)

Expand Down
8 changes: 6 additions & 2 deletions nextstrain/cli/runner/aws_batch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
Default for ``--aws-batch-memory``.
"""

import botocore.exceptions
import os
import shlex
from datetime import datetime
Expand Down Expand Up @@ -404,8 +405,11 @@ def interrupt_signaled(sig, frame):
# The watcher never started, so we probably missed the
# transition to running. Display the whole log now!
if opts.logs:
for entry in job.log_entries():
print_job_log(entry)
try:
for entry in job.log_entries():
print_job_log(entry)
except botocore.exceptions.ClientError as error:
warn(f"Unable to fetch job logs: {error}")

print_stage(
"Job %s after %0.1f minutes" % (job.status, job.elapsed_time / 60),
Expand Down
Loading