_data_cache.py 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. import typing
  17. from ._base import BaseEntity
  18. from fate_arch.common import DTable
  19. class DataCache(BaseEntity):
  20. def __init__(self, name: str, key: str = None, data: typing.Dict[str, DTable] = None, meta: dict = None, job_id: str = None, component_name: str = None, task_id: str = None, task_version: int = None):
  21. self._name: str = name
  22. self._key: str = key
  23. self._data: typing.Dict[str, DTable] = data if data else {}
  24. self._meta: dict = meta
  25. self._job_id = job_id
  26. self._component_name = component_name
  27. self._task_id: str = task_id
  28. self._task_version: int = task_version
  29. @property
  30. def name(self):
  31. return self._name
  32. @property
  33. def key(self):
  34. return self._key
  35. @key.setter
  36. def key(self, key: str):
  37. self._key = key
  38. @property
  39. def data(self):
  40. return self._data
  41. @property
  42. def meta(self):
  43. return self._meta
  44. @property
  45. def job_id(self):
  46. return self._job_id
  47. @job_id.setter
  48. def job_id(self, job_id: str):
  49. self._job_id = job_id
  50. @property
  51. def component_name(self):
  52. return self._component_name
  53. @component_name.setter
  54. def component_name(self, component_name: str):
  55. self._component_name = component_name
  56. @property
  57. def task_id(self):
  58. return self._task_id
  59. @task_id.setter
  60. def task_id(self, task_id: str):
  61. self._task_id = task_id
  62. @property
  63. def task_version(self):
  64. return self._task_version
  65. @task_version.setter
  66. def task_version(self, task_version: int):
  67. self._task_version = task_version