Skip to content

fix: use ignore_patterns when local source code is provided in tuning job - #6580

Open
toddstep wants to merge 3 commits into
aws:masterfrom
toddstep:fix_tuner_sourcedir_ignore
Open

toddstep wants to merge 3 commits into
aws:masterfrom
toddstep:fix_tuner_sourcedir_ignore

Conversation

@toddstep

Copy link
Copy Markdown
Contributor

Issue #, if available: N/A

Description of changes:
This fix addresses the issue described in #5511: HyperparameterTuner is not using the
supplied ignore_patterns argument when generating a tarfile from a local source directory.
As done in #5194, shutil.ignore_patterns() is used to identify files and subdirectories to
exclude.

Unit and integration tests are included.
There is overlap in what these tests check -- there may be a better way to organize them.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

The HyperparameterTuner class generates a sourcedir.tar.gz file if a
local source directory is provided via its model_trainer argument.
These unit and integration tests check whether the ignore_patterns list
is used when creating the tar file.
The unit test code is based on https://stackoverflow.com/a/59166245 .
The HyperparameterTuner class generates a sourcedir.tar.gz file if a
local source directory is provided via its model_trainer argument.
This fix uses shutil.ignore_patterns at each subdirectory to exclude
files and subdirectories from being added to the tarfile.  This
resembles the logic done within
ModelTrainer.create_input_data_channel().

This branch is waiting to be deployed

1 waiting deployment
manual-approval — d4082ec2 Waiting Nov 13, 2026 by toddstep via wait-for-approval #863
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.

1 participant