Closed Nicoretti closed 1 year ago
Hi @exa-eswar,
I assume the problem is an "miss use" of the API, uploading in memory live object is not supported at the moment. I think what you actually want to do is the following:
import io
from exasol.bucketfs import (
Service,
MappedBucket,
)
URL = "http://localhost:2581"
CREDENTAILS = {"default": {"username": "w", "password": "BBiSzwGaD6X7zLcjfpcP0OdGA317JABg"}}
bucketfs = Service(URL, CREDENTAILS)
bucket = MappedBucket(bucketfs["default"])
filename = 'dummy_linear_regression_model.sav'
with open(filename, 'rb') as data:
# Upload bytes
bucket["dummy/dummy_linear_regression_model.sav"] = data
looking forward to get your feedback on this.
I think, what we might want is something like the following
import pickle
from sklearn.linear_model import LinearRegression
model = LinearRegression()
...
URL = "http://localhost:2581"
CREDENTAILS = {"default": {"username": "w", "password": "BBiSzwGaD6X7zLcjfpcP0OdGA317JABg"}}
bucketfs = Service(URL, CREDENTAILS)
bucket = MappedBucket(bucketfs["default"])
bucket["dummy/dummy_linear_regression_model.sav"] = object_to_stream(model)
loaded_model = object_from_stream(bucket["dummy/dummy_linear_regression_model.sav"])
@tkilias good point, but that rather is a feature
than a bug ;).
Giving it some more thought ,I am not 100% sure if this functionality should be part of bucketfs library.
I think this is rather a functionality of this specific client code, pickling is a very specific use case.
@Nicoretti , Thanks for feedback and fix. I can confirm that this is working well.
@Nicoretti yeah, it is a feature and probably not directly related to buckets, but something which we probably need, but maybe not as part of this repo, but one on top of it.
thx @exa-eswar for the feedback
Summary
Uploading a pickled ... model to
BucketFS
fails with an exception.Reproducing the Issue
Product ML file
Pickled model
Failing code
Expected Behavior
Uploading model is successful.
Actual Behavior
Uploading model fails with exception
Root Cause (optional)
unknown
Screenshots
Reported by: @exa-eswar