Init assets of the algorithm. Args: algo (str): Represent specific algo inside resource. context (str): Type of context that hold the calculation results. It will get from gar if param is None. Defaults to None. gar (bytes or BytesIO, optional
(self, algo=None, context=None, gar=None, cmake_extra_options=None)
| 167 | ] |
| 168 | |
| 169 | def __init__(self, algo=None, context=None, gar=None, cmake_extra_options=None): |
| 170 | """Init assets of the algorithm. |
| 171 | |
| 172 | Args: |
| 173 | algo (str): Represent specific algo inside resource. |
| 174 | context (str): Type of context that hold the calculation results. |
| 175 | It will get from gar if param is None. Defaults to None. |
| 176 | gar (bytes or BytesIO, optional): The bytes that encodes the application's source code. |
| 177 | Defaults to None. |
| 178 | """ |
| 179 | self._algo = algo |
| 180 | self._context_type = context |
| 181 | if isinstance(self._algo, str) and ( |
| 182 | "giraph:" in self._algo or "java_pie:" in self._algo |
| 183 | ): |
| 184 | self._type = "java_pie" |
| 185 | else: |
| 186 | self._type = "cpp_pie" # default is builtin app with `built_in` type |
| 187 | self._meta = {} |
| 188 | |
| 189 | # used for gar resource |
| 190 | if gar is not None and isinstance(gar, (BytesIO, bytes)): |
| 191 | self._gar = gar if isinstance(gar, bytes) else gar.getvalue() |
| 192 | self._extract_meta_info() |
| 193 | else: |
| 194 | # built_in apps has no gar resource. |
| 195 | self._gar = None |
| 196 | |
| 197 | self._cmake_extra_options = cmake_extra_options |
| 198 | |
| 199 | if self._context_type not in self._support_context_type: |
| 200 | raise InvalidArgumentError( |
| 201 | "Unsupport context type: {0}".format(self._context_type) |
| 202 | ) |
| 203 | |
| 204 | self._op = create_app(self) |
| 205 | |
| 206 | def __repr__(self) -> str: |
| 207 | return f"graphscope.framework.app.AppAssets <type: {self._type}, algo: {self._algo}, context: {self._context_type}>" |
nothing calls this directly
no test coverage detected