-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Add --exclude-from-upload and --exclude-from-download options
Excluding files from upload is very handy for ad-hoc skipping of large ancillary files or previous output files in the build directory that the user wants to ignore for the remote build on AWS Batch (i.e. to start it "fresh"). Existing workarounds for the lack of an exclusion mechanism include git worktrees to obtain a clean state and moving files or directories temporarily out of the build directory. A future improvement would be adding support to also specify these patterns via a file, which can then be checked in to a build repo and shared by all users. As a broader improvement, I'd like to design away this issue by separating out the workflow-as-program (rules, code, etc.) from the workflow-as-state (config, inputs, outputs, etc.). This comes out of several other goals, but would apply to this "excluded files" need too. For example, instead of relying on the implicit state combined with the code like now in a single build directory, we'd instead explicitly pass an empty starting state separate from the workflow program. This change includes a small bug fix for --download to allow _only_ negated patterns. Resolves: <#219>
- Loading branch information
Showing
7 changed files
with
185 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from nextstrain.cli import make_parser | ||
|
||
|
||
def pytest_build_download_options(): | ||
parser = make_parser() | ||
|
||
opts = parser.parse_args(["build", "."]) | ||
assert opts.download is True | ||
|
||
opts = parser.parse_args(["build", "--no-download", "."]) | ||
assert opts.download is False | ||
|
||
opts = parser.parse_args(["build", "--download", "x", "."]) | ||
assert opts.download == ["x"] | ||
|
||
opts = parser.parse_args(["build", "--download", "x", "--download", "y", "."]) | ||
assert opts.download == ["x", "y"] | ||
|
||
opts = parser.parse_args(["build", "--exclude-from-download", "z", "."]) | ||
assert opts.download == ["!z"] | ||
|
||
opts = parser.parse_args(["build", "--exclude-from-download", "z", "--exclude-from-download", "a", "."]) | ||
assert opts.download == ["!z", "!a"] | ||
|
||
opts = parser.parse_args(["build", "--download", "y", "--exclude-from-download", "z", "."]) | ||
assert opts.download == ["y", "!z"] | ||
|
||
opts = parser.parse_args(["build", "--download", "y", "--download", "!z", "."]) | ||
assert opts.download == ["y", "!z"] |