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

syntax for quick access to other buckets #8

Open
anwarnunez opened this issue Jun 16, 2016 · 1 comment
Open

syntax for quick access to other buckets #8

anwarnunez opened this issue Jun 16, 2016 · 1 comment

Comments

@anwarnunez
Copy link
Contributor

Sometimes we need to access data from other buckets and save our results to other buckets.
As it stands, the cc.interface instance has a set_bucket method for this, but it's very cumbersome:

>>> import cottoncandy as cc
>>> cci = cc.get_interface('my_data_bucket')
>>> arr = cci.download_raw_array('path/to/my/array')
>>> result = np.log(arr + 1)
>>> cci.set_bucket('my_results_bucket')
>>> cci.upload_raw_array('path/to/my/results/array', result)
>>> cci.set_bucket('my_data_bucket') 

Instead, a little ~ syntax might be useful

>>> import cottoncandy as cc
>>> cci = cc.get_interface('my_data_bucket')
>>> arr = cci.download_raw_array('path/to/my/array')
>>> result = np.log(arr + 1)
>>> cci.upload_raw_array('~my_results_bucket/path/to/my/results/array', result)
>>> print cci.bucket_name # default bucket is still the same
my_data_bucket

sound good?

@alexhuth
Copy link
Contributor

Yes, that looks totally reasonable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants