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

Containerized contoller cleanup when raised exception #2210

Merged
merged 1 commit into from
Jun 22, 2023

Conversation

bkopilov
Copy link
Contributor

Current code depends on _is_running for cleanup fixture. In case this param is False , remove function skipp cleanup

Moving the _is_running to the top of the run function to trigger deletion .

@openshift-ci openshift-ci bot requested review from omertuc and osherdp June 22, 2023 10:26
Current code depends on _is_running for cleanup fixture.
In case this param is False , remove function skipp cleanup

Moving the _is_running to the top of the run function to trigger
deletion .
@openshift-ci openshift-ci bot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 22, 2023
@openshift-ci
Copy link

openshift-ci bot commented Jun 22, 2023

Hi @bkopilov. Thanks for your PR.

I'm waiting for a openshift 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.

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.

@bkopilov
Copy link
Contributor Author

@eliorerz , @adriengentil , @lalon4

@adriengentil
Copy link
Contributor

instead of maintaining a boolean, can't we just ask podman if the container is running?

@bkopilov
Copy link
Contributor Author

bkopilov commented Jun 22, 2023

podman if the container is running?

Yes we can but there is another problem that we should address on self._on_container_start(**kwargs)
In this code user is free to override on create and cleanup ... so you may get into issue that controller is "down" but user allocates resources (podman-remote command) on _on_container_start

@adriengentil
Copy link
Contributor

we could define is_running as a property, and the user would have to override it as well

Copy link
Contributor

@adriengentil adriengentil left a comment

Choose a reason for hiding this comment

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

approving to solve the issue, we could think at something better later

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 22, 2023
@openshift-ci
Copy link

openshift-ci bot commented Jun 22, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: adriengentil, bkopilov

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

The pull request process is described here

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 22, 2023
@openshift-merge-robot openshift-merge-robot merged commit 8310bc2 into openshift:master Jun 22, 2023
@bkopilov
Copy link
Contributor Author

bkopilov commented Jun 22, 2023

we could define is_running as a property, and the user would have to override it as well

Yes , also no need boolean at all ... we just need to verify on run if the container already up and on remove we always run delete...

maybe decorate the function that test if running before .... something like:

def is_running_container(func):

    def inner(self, **kwargs):
        if container_is_running:
            return func(self, **kwargs)
        return None
    return inner

class Test:
    @is_running_container
    def run(self, **kwargs):
        print(f"run {kwargs}")
```I did not try it but the idea is that we wont call to run if container is already running
if you agree i will work on it.

adriengentil pushed a commit to adriengentil/assisted-test-infra that referenced this pull request Jun 27, 2023
Current code depends on _is_running for cleanup fixture.
In case this param is False , remove function skipp cleanup

Moving the _is_running to the top of the run function to trigger
deletion .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants