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

make storage directory in Docker storage configurable (fixes #2861) #2865

Merged
merged 5 commits into from
Jun 26, 2020
Merged

make storage directory in Docker storage configurable (fixes #2861) #2865

merged 5 commits into from
Jun 26, 2020

Conversation

jameslamb
Copy link

@jameslamb jameslamb commented Jun 25, 2020

  • adds new tests (if appropriate)
  • add a changelog entry in the changes/ directory (if appropriate)
  • updates docstrings for any new functions or function arguments, including docs/outline.toml for API reference docs (if appropriate)

What does this PR change?

This PR implements my proposal from #2861 to allow users to configure the location inside Docker storage where flows and other files are stored.

This PR sets that location to /opt/prefect (the previous hard-coded value) by default, so it should not break any existing code.

Why is this PR important?

See the discussion in #2861 . This argument gives users finer control over the images produced by Docker storage, and is useful when working with images that have a non-root USER set which doesn't have permission to write to /opt.

@codecov
Copy link

codecov bot commented Jun 25, 2020

Codecov Report

Merging #2865 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Copy link

@jcrist jcrist left a comment

Choose a reason for hiding this comment

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

Thanks @jameslamb, overall this looks good to me. Just a few small cleanups and I'll be happy to merge.

src/prefect/environments/storage/docker.py Outdated Show resolved Hide resolved
@@ -515,6 +527,32 @@ def test_create_dockerfile_with_weird_flow_name():
)


def test_create_dockerfile_with_weird_flow_name_custom_prefect_dir():
with tempfile.TemporaryDirectory() as tempdir_outside:
Copy link

Choose a reason for hiding this comment

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

Instead of using tempfile.TemporaryDirectory, I recommend using pytest's tmpdir fixture: https://docs.pytest.org/en/stable/tmpdir.html

(I know tempfile.TemporaryDirectory() is used elsewhere already, we're slowly migrating towards making better use of fixtures as tests are updated)

Copy link
Author

Choose a reason for hiding this comment

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

oh sure, I can do that. I just copied this from another test and added in the prefect_directory kwarg.

Copy link
Author

Choose a reason for hiding this comment

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

Ok I just changed the two tests in this PR that were using tempfile.TemporaryDirectory() to tmpdir.

Thanks for showing me that! I think I'll start using it in other projects.

Copy link

@jcrist jcrist left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @jameslamb!

@jcrist jcrist merged commit bda761f into PrefectHQ:master Jun 26, 2020
@jameslamb jameslamb deleted the feat/docker-directory branch September 15, 2020 20:15
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.

2 participants