Skip to content

Conversation

peytonrunyan
Copy link
Contributor

@peytonrunyan peytonrunyan commented Nov 29, 2022

This PR adds the kill method for Docker containers as part of #7666

Copy link
Contributor

@bunchesofdonald bunchesofdonald left a comment

Choose a reason for hiding this comment

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

Lookin' good!

@zanieb zanieb force-pushed the feature/flow-run-cancellation branch 4 times, most recently from e3caa3f to d5e6209 Compare November 30, 2022 19:59
"""Generates a docker infrastructure_pid string in the form of
`<docker_host_base_url>:<container_id>`.
"""
docker_client = self._get_client()
Copy link
Contributor

Choose a reason for hiding this comment

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

Is getting a new client cheap? Perhaps we should be passing a client in here.

Copy link
Contributor Author

@peytonrunyan peytonrunyan Dec 1, 2022

Choose a reason for hiding this comment

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

Yeah, I thought about it a bit yesterday, but it's a bit awkward. It's unclear when it makes the most sense to instantiate a client for sharing.

run does not instantiate a client, but calls _create_and_start_container and _watch_container_safe

_create_and_start_container instantiates a client (either from a registry or the regular client), passes it to
_build_container_settings
_should_pull_image
_pull_image
_create_container
and then closes it.

_watch_container_safe instantiates a client and passes it to _watch_container and then closes it.

preview instantiates and then closes

I thought about setting a property for self.client and then instantiating it if it's None or closed, but there's not an obvious way to check for whether or not the connection is closed without hitting what would probably be a law of demeter violation.

What I definitely should do if nothing else is not call the function twice inside of run.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zanieb zanieb marked this pull request as ready for review December 1, 2022 03:09
@zanieb zanieb merged commit a300885 into feature/flow-run-cancellation Dec 1, 2022
@zanieb zanieb deleted the kill-docker branch December 1, 2022 16:51
zanieb pushed a commit that referenced this pull request Dec 1, 2022
zanieb pushed a commit that referenced this pull request Dec 1, 2022
github-actions bot pushed a commit that referenced this pull request Dec 1, 2022
github-actions bot pushed a commit to ddelange/prefect that referenced this pull request Dec 15, 2022
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.

3 participants