Skip to content

Conversation

johanneskoester
Copy link
Contributor

@johanneskoester johanneskoester commented Sep 10, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Improved log retrieval for failed Kubernetes jobs by also fetching logs from the previous container instance after pod restarts.
    • Ensures logs remain available even if a pod has restarted, reducing missing or empty logs in failure reports.
    • Enhances reliability and consistency of failure diagnostics without altering user-facing workflows or configurations.

Copy link
Contributor

coderabbitai bot commented Sep 10, 2025

📝 Walkthrough

Walkthrough

Adds previous=True to the Kubernetes read_namespaced_pod_log call used when fetching logs for failed jobs, enabling retrieval of logs from a pod’s previous container instance after restarts. No other logic, signatures, or control flow paths were changed.

Changes

Cohort / File(s) Summary
Kubernetes log retrieval
snakemake_executor_plugin_kubernetes/__init__.py
Modify log fetch for failed jobs to pass previous=True to read_namespaced_pod_log, allowing access to logs from the prior container instance on restart.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant S as Snakemake Executor
  participant K as Kubernetes API
  participant P as Pod

  rect rgba(230,245,255,0.6)
    S->>K: read_namespaced_pod_log(pod, namespace) for running/success
    K-->>S: Current container logs
  end

  alt Pod failed / restarted
    note over S,K: Changed: request previous container logs
    S->>K: read_namespaced_pod_log(pod, namespace, previous=true)
    K-->>S: Previous container logs
  else Not failed
    S->>K: read_namespaced_pod_log(pod, namespace, previous=false/default)
    K-->>S: Current container logs
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks (2 passed, 1 warning)

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title “fix: enable retrieving logs from terminated containers” directly reflects the pull request’s core change of adding support for fetching logs from previously terminated container instances, doing so in a concise and focused manner without extraneous details.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2cb2a7e and ff8a468.

📒 Files selected for processing (1)
  • snakemake_executor_plugin_kubernetes/__init__.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py

⚙️ CodeRabbit configuration file

**/*.py: Do not try to improve formatting.
Do not suggest type annotations for functions that are defined inside of functions or methods.
Do not suggest type annotation of the self argument of methods.
Do not suggest type annotation of the cls argument of classmethods.
Do not suggest return type annotation if a function or method does not contain a return statement.

Files:

  • snakemake_executor_plugin_kubernetes/__init__.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: testing
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/get-previous-logs-from-term-containers

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@johanneskoester johanneskoester merged commit 98ae2ae into main Sep 10, 2025
6 checks passed
@johanneskoester johanneskoester deleted the fix/get-previous-logs-from-term-containers branch September 10, 2025 09:09
johanneskoester pushed a commit that referenced this pull request Sep 10, 2025
🤖 I have created a release *beep* *boop*
---


##
[0.5.1](v0.5.0...v0.5.1)
(2025-09-10)


### Bug Fixes

* enable retrieving logs from terminated containers
([#57](#57))
([98ae2ae](98ae2ae))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

1 participant