_session.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #
  2. # Copyright 2019 The FATE Authors. All Rights Reserved.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. #
  16. from fate_arch.storage import StorageSessionBase, StorageEngine
  17. from fate_arch.abc import AddressABC
  18. from fate_arch.common.address import PathAddress
  19. class StorageSession(StorageSessionBase):
  20. def __init__(self, session_id, options=None):
  21. super(StorageSession, self).__init__(session_id=session_id, engine=StorageEngine.PATH)
  22. def table(self, address: AddressABC, name, namespace, partitions, store_type=None, options=None, **kwargs):
  23. if isinstance(address, PathAddress):
  24. from fate_arch.storage.path._table import StorageTable
  25. return StorageTable(address=address, name=name, namespace=namespace,
  26. partitions=partitions, store_type=store_type, options=options)
  27. raise NotImplementedError(f"address type {type(address)} not supported with hdfs storage")
  28. def cleanup(self, name, namespace):
  29. pass
  30. def stop(self):
  31. pass
  32. def kill(self):
  33. pass