-
Notifications
You must be signed in to change notification settings - Fork 301
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
Add functionality for .flyteignore file #2479
Conversation
Signed-off-by: Daniel Sola <[email protected]>
flytekit/tools/ignore.py
Outdated
flyteignore = os.path.join(self.root, ".flyteignore") | ||
if os.path.isfile(flyteignore): | ||
with open(flyteignore, "r") as f: | ||
patterns = [l.strip() for l in f.readlines() if l.strip() and not l.startswith("#")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we may end up removing the dependency in the future, but while we have it, why not just use the PatternMatcher object that the dockerignore object uses?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha just pushed that! since my test was actually failing
This looks good to merge, and this is not the first request we've heard about having a separate flyteignore file, but a couple things
|
Congrats on merging your first pull request! 🎉 |
* Add functionality for .flyteignore file Signed-off-by: Daniel Sola <[email protected]> * copy docker ignore for flyteignore --------- Signed-off-by: Daniel Sola <[email protected]> Signed-off-by: bugra.gedik <[email protected]>
* Add functionality for .flyteignore file Signed-off-by: Daniel Sola <[email protected]> * copy docker ignore for flyteignore --------- Signed-off-by: Daniel Sola <[email protected]> Signed-off-by: Jan Fiedler <[email protected]>
Tracking issue
Linear Ticket: https://linear.app/unionai/issue/COR-1133/add-flyteignore-functionality-to-pyflyte-register
Why are the changes needed?
Sometimes users have files they want to ignore in the registration process that do not suit a dockerignore or gitignore.
What changes were proposed in this pull request?
Add a FlyteIgnore class that looks for a
.flyteignore
class in the root directory and ignores any files in it when computing a hash.How was this patch tested?
lp.py is
and wf.py is
Then I create a random file like this:
echo "This is the original file." > ~/path/to/repo/original.txt
and the symlink in the directory I showed you like this:
ln -s ~/repos/wine-classification/original.txt ~/path/to/repo/register_example/original_link.txt
Then I move the original file like this:
mv ~/path/to/repo/original.txt ~/path/to/repo/original-moved.txt
and then run
pyflyte register lp.py
With this I get an error
Failed with Unknown Exception <class 'FileNotFoundError'> Reason: [Errno 2] No such file or directory: '/path/to/repo/register_example/original_link.txt'
Then I add
*.txt
to a.flyteignore
and I no longer get a failure.Check all the applicable boxes
Related PRs
Original PR for gitignore and dockerignore: #899
Docs link