Skip to content

fix: local data source relative path includes the first directory #702

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

Merged
merged 6 commits into from
Apr 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/sagemaker/local/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def get_data_source_instance(data_source, sagemaker_session):
"""
parsed_uri = urlparse(data_source)
if parsed_uri.scheme == 'file':
return LocalFileDataSource(parsed_uri.path)
return LocalFileDataSource(parsed_uri.netloc + parsed_uri.path)
elif parsed_uri.scheme == 's3':
return S3DataSource(parsed_uri.netloc, parsed_uri.path, sagemaker_session)

Expand Down
4 changes: 4 additions & 0 deletions tests/unit/test_local_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ def test_get_data_source_instance_with_file(LocalFileDataSource, sagemaker_local
LocalFileDataSource.assert_called_with('/my/file')
assert data_source is not None

data_source = sagemaker.local.data.get_data_source_instance('file://relative/path', sagemaker_local_session)
LocalFileDataSource.assert_called_with('relative/path')
assert data_source is not None


@patch('sagemaker.local.data.S3DataSource')
def test_get_data_source_instance_with_s3(S3DataSource, sagemaker_local_session):
Expand Down