File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -203,18 +203,25 @@ def upload_and_copy_score_resources(model, files):
203
203
)
204
204
)
205
205
elif isViya35 and isH2OModel and not isBinaryModel :
206
- cls .pyFile .write (
207
- """\n
206
+ try :
207
+ cls .pyFile .write (
208
+ """\n
208
209
with gzip.open('/models/resources/viya/{modelID}/{modelFileName}', 'r') as fileIn, open('/models/resources/viya/{
209
210
modelID}/{modelZipFileName}', 'wb') as fileOut:
210
211
shutil.copyfileobj(fileIn, fileOut)
211
212
os.chmod('/models/resources/viya/{modelID}/{modelZipFileName}', 0o777)
212
213
_thisModelFit = h2o.import_mojo('/models/resources/viya/{modelID}/{modelZipFileName}')""" .format (
213
- modelID = modelID ,
214
- modelFileName = modelFileName ,
215
- modelZipFileName = modelFileName [:- 4 ] + "zip" ,
214
+ modelID = modelID ,
215
+ modelFileName = modelFileName ,
216
+ modelZipFileName = modelFileName [:- 4 ] + "zip" ,
217
+ )
218
+ )
219
+ except AttributeError :
220
+ raise ValueError (
221
+ "The following is not a valid model to register in this format. "
222
+ + "Please verify that the appropriate arguments have been provided "
223
+ + "to the import model function."
216
224
)
217
- )
218
225
elif isViya35 and not isH2OModel :
219
226
cls .pyFile .write (
220
227
"""\n
You can’t perform that action at this time.
0 commit comments