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

add support for arbritary remote storages #24

Merged
merged 4 commits into from
Nov 28, 2017
Merged

Conversation

kayibal
Copy link

@kayibal kayibal commented Nov 16, 2017

Mainly to support gcsfs

@codecov
Copy link

codecov bot commented Nov 16, 2017

Codecov Report

Merging #24 into master will decrease coverage by 0.35%.
The diff coverage is 88.88%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #24      +/-   ##
==========================================
- Coverage   83.01%   82.66%   -0.36%     
==========================================
  Files           6        6              
  Lines         689      721      +32     
==========================================
+ Hits          572      596      +24     
- Misses        117      125       +8
Impacted Files Coverage Δ
sparsity/sparse_frame.py 85.33% <88.88%> (-0.11%) ⬇️
sparsity/dask/io.py 79.41% <0%> (-1.67%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 060d09f...a3cebc8. Read the comment docs.

sparsity/io.py Outdated
}

try:
import s3fs

Choose a reason for hiding this comment

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

There's already s3fs import above. Wrapping this one in try doesn't seem to make sense.

Copy link
Author

Choose a reason for hiding this comment

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

true I'll remove the one above

Choose a reason for hiding this comment

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

Forgot about this one? :P

sparsity/io.py Outdated
if not filename.startswith('s3://'):

protocol = urlparse(filename).scheme or 'file'
if protocol == 'file':
fp = open(filename, 'wb')

Choose a reason for hiding this comment

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

Do we leave the file open here? O.o

sparsity/io.py Outdated
def _save_remote(buffer, filename, block_size=None, storage_options=None):
if storage_options is None:
storage_options = {}
protocol = urlparse(filename).scheme or 'file'

Choose a reason for hiding this comment

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

scheme shouldn't be 'file' here. I think leaving this as an option is misleading.

Copy link
Author

Choose a reason for hiding this comment

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

that's correct

sparsity/io.py Outdated
if storage_options is None:
storage_options = {}
protocol = urlparse(filename).scheme or 'file'
open_f = FILE_SYSTEMS[protocol](**storage_options).open
fp = open_f(filename, 'rb')

loader = np.load(fp)

Choose a reason for hiding this comment

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

Same here - we're not closing the file.

Copy link
Author

Choose a reason for hiding this comment

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

Hm I think numpy closes it will check if that's true for sure though

Choose a reason for hiding this comment

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

Numpy documentation doesn't say that they close the file.

@kayibal
Copy link
Author

kayibal commented Nov 28, 2017

@michcio1234 Ok to merge?

@kayibal kayibal closed this Nov 28, 2017
@kayibal
Copy link
Author

kayibal commented Nov 28, 2017

Argh closed this accidentally

@kayibal kayibal reopened this Nov 28, 2017
@kayibal kayibal merged commit e61fa5f into master Nov 28, 2017
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.

None yet

2 participants