cottoncandy icon indicating copy to clipboard operation
cottoncandy copied to clipboard

syntax for quick access to other buckets

Open anwarnunez opened this issue 8 years ago • 1 comments

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?

anwarnunez avatar Jun 16 '16 18:06 anwarnunez

Yes, that looks totally reasonable.

alexhuth avatar Jun 16 '16 18:06 alexhuth