Skip to content

fix: preserve Docker runner exit status#13402

Open
Zakharden wants to merge 1 commit into
kubeflow:masterfrom
Zakharden:fix-docker-runner-exit-status
Open

fix: preserve Docker runner exit status#13402
Zakharden wants to merge 1 commit into
kubeflow:masterfrom
Zakharden:fix-docker-runner-exit-status

Conversation

@Zakharden
Copy link
Copy Markdown

Description of your changes

Fixes the local Docker runner path so container failures are propagated back to callers.

The previous implementation used auto_remove=True and then inspected the container after run(). When Docker removed the container before inspection, docker.errors.NotFound was treated as success and the local task returned 0, even if the container process failed.

This change keeps the container available until its status is read, returns the Docker StatusCode, and removes the container in a cleanup block. The tests cover the regression and the cleanup behavior.

Fixes #13332

How has this code been tested?

  • python3 -m py_compile sdk/python/kfp/local/docker_task_handler.py sdk/python/kfp/local/docker_task_handler_test.py

I could not run the unit test module locally because this environment is missing test/runtime dependencies:

  • python3 -m pytest ... failed because pytest is not installed
  • PYTHONPATH=sdk/python python3 -m unittest ... failed because docstring_parser is not installed

Checklist

  • The title for your pull request (PR) should follow our title requirements. If the PR fully addresses an existing Github issue, please include "Fixes allow output artifact store configuration (vs hard coded) #1234" in the PR body to automatically close the issue when the PR is merged.
  • Tests have been added / updated.
  • Code compiles locally.

Copilot AI review requested due to automatic review settings May 18, 2026 14:27
@google-oss-prow google-oss-prow Bot requested a review from droctothorpe May 18, 2026 14:27
@google-oss-prow
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign chensun for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow
Copy link
Copy Markdown

Hi @Zakharden. Thanks for your PR.

I'm waiting for a kubeflow member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Signed-off-by: Zakhar Dvurechensky <72825626+Zakharden@users.noreply.github.com>
@Zakharden Zakharden force-pushed the fix-docker-runner-exit-status branch from 87ec70e to e08eeda Compare May 18, 2026 14:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Fixes a bug where the local Docker runner returned a success exit code (0) even when the container process failed, because auto_remove=True could cause inspection to fail with NotFound.

Changes:

  • Switch auto_remove from True to False so the container persists until its exit status is read.
  • Move container removal into a finally block via container.remove(force=True).
  • Update existing tests for the new auto_remove value and add a regression test verifying the exit code is propagated and cleanup occurs.

Reviewed changes

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

File Description
sdk/python/kfp/local/docker_task_handler.py Disables auto-remove, reads StatusCode, and removes container in a finally block.
sdk/python/kfp/local/docker_task_handler_test.py Updates auto_remove expectations and adds a regression test for exit status propagation and removal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants