Fix valid model URL might be overridden by an invalid one in case the upload failed

This commit is contained in:
allegroai 2024-08-22 01:26:01 +03:00
parent a9819416fd
commit 0086785372

View File

@ -378,10 +378,13 @@ class Model(IdObjectBase, AsyncManagerMixin, _StorageUriMixin):
if uploaded_uri is None: if uploaded_uri is None:
return return
# If not successful, mark model as failed_uploading # If not successful, mark model as failed_uploading,
# but dont override valid urls
if uploaded_uri is False: if uploaded_uri is False:
uploaded_uri = "{}/failed_uploading".format( uploaded_uri = (
self._upload_storage_uri self.data.uri
if self.data.uri != "{}/uploading_file".format(self._upload_storage_uri or "file://")
else "{}/failed_uploading".format(self._upload_storage_uri or "file://")
) )
Model._local_model_to_id_uri[str(model_file)] = ( Model._local_model_to_id_uri[str(model_file)] = (