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

[WIP] add assemble_subset #410

Closed
wants to merge 3 commits into from

Conversation

minrk
Copy link
Member

@minrk minrk commented Sep 18, 2018

Marked WIP for discussion. I though I opened this ages ago, but apparently forgot.

This improves the use of build caching by separating 'assemble' into two steps:

  1. assemble the environment, using only the files required to do so (e.g. environment.yml)
  2. stage the rest of the repo afterward

This enables re-using the build cache from one build to the next, greatly expediting rebuilds in cases where the environment spec doesn't change.

Changes:

  • get_assemble_files() returns list of files needed for assembly
  • if buildpack.assemble_with_subset is set, only load assemble_files
    prior to running assembly scripts. Load the rest of the repo afterward

conda opts in to this, but currently I think this works for everything except requirements.txt. And requirements.txt could as well, as long as we peek in the contents to look for local -e . references.

- get_assemble_files() returns list of files needed for assembly
- if buildpack.assemble_with_subset is set, only load assemble_files
  prior to running assembly scripts. Load the rest of the repo afterward

conda opts in to this, but currently I think this works
for everything *except* requirements.txt
R and Docker can't assemble from the subset because they can refer to local files. Julia can, though.
allows assemble_from_subset when requirements.txt doesn't contain any local references
@betatim
Copy link
Member

betatim commented Sep 18, 2018

Can a environment.yml with a pip section contain local references?

What do you think of a build pack being able to have assemble files that are run before copying over the repo and after? This way a build pack could support this but lets it opt out sometimes? Too complex/convoluted?

@@ -93,10 +93,15 @@
{{sd}}
{% endfor %}

# Copy and chown stuff. This doubles the size of the repo, because
# you can't actually copy as USER, only as root! Thanks, Docker!
# FIXME: use COPY --chown with docker 17.09 to avoid copy+chown in two steps
Copy link
Member

Choose a reason for hiding this comment

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

Move this to above L105

@@ -12,6 +12,10 @@ class JuliaBuildPack(CondaBuildPack):
See https://github.com/JuliaPy/PyCall.jl/issues/410

"""

# REQUIRE can't refer to local files, can it?
assemble_from_subset = True
Copy link
Member

Choose a reason for hiding this comment

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

Worth checking with #393 and the new way of specifying dependencies in Julia.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch! I think it will affect Julia with the project stuff.

@minrk
Copy link
Member Author

minrk commented Sep 20, 2018

What do you think of a build pack being able to have assemble files that are run before copying over the repo and after? This way a build pack could support this but lets it opt out sometimes? Too complex/convoluted?

You can see an example of this in PythonBuildPack, where assemble_from_subset is a property, set after a check for local references in requirements.txt.

@minrk
Copy link
Member Author

minrk commented Jul 16, 2019

Closing in favor of #743

@minrk minrk closed this Jul 16, 2019
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