未验证 提交 0ecfe3bf 编写于 作者: 走神的阿圆's avatar 走神的阿圆 提交者: GitHub

Add `--model` for BOS file system. (#731)

上级 eb26548f
...@@ -227,8 +227,9 @@ class BosFileSystem(object): ...@@ -227,8 +227,9 @@ class BosFileSystem(object):
return exists(filename) return exists(filename)
def read_file(self, filename, binary=True): def read_file(self, filename, binary=True):
print('BosFileSystem not support --model yet.') bucket_name, object_key = BosFileSystem._get_object_info(filename)
return result = self.bos_client.get_object_as_string(bucket_name, object_key)
return result
@staticmethod @staticmethod
def _get_object_info(path): def _get_object_info(path):
...@@ -555,7 +556,10 @@ class BFile(object): ...@@ -555,7 +556,10 @@ class BFile(object):
def close(self): def close(self):
if isinstance(self.fs, BosFileSystem): if isinstance(self.fs, BosFileSystem):
self.fs.append(self._filename, b'', self.binary_mode, force=True) try:
self.fs.append(self._filename, b'', self.binary_mode, force=True)
except:
pass
self.flush() self.flush()
if self.write_temp is not None: if self.write_temp is not None:
self.write_temp.close() self.write_temp.close()
......
...@@ -13,4 +13,4 @@ ...@@ -13,4 +13,4 @@
# limitations under the License. # limitations under the License.
# ======================================================================= # =======================================================================
vdl_version = '2.0.0-beta.8' vdl_version = '2.0.0-beta.9'
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册