MCPcopy Create free account
hub / github.com/alibaba/GraphScope / __init__

Method __init__

python/graphscope/analytical/app/java_app.py:153–214  ·  view source on GitHub ↗

Init JavaApp with the full path of your `jar` file and the fully-qualified name of your app class. Args: full_jar_path (str): The path where the jar file exists. java_app_class (str): the fully-qualified name of your app class.

(self, full_jar_path: str, java_app_class: str)

Source from the content-addressed store, hash-verified

151 """
152
153 def __init__(self, full_jar_path: str, java_app_class: str):
154 """Init JavaApp with the full path of your `jar` file and the fully-qualified name of your
155 app class.
156
157 Args:
158 full_jar_path (str): The path where the jar file exists.
159 java_app_class (str): the fully-qualified name of your app class.
160 """
161 self._java_app_class = java_app_class
162 self._full_jar_path = full_jar_path
163 self._jar_name = Path(self._full_jar_path).name
164 gar = self._pack_jar(self._full_jar_path)
165 gs_config = {
166 "app": [
167 {
168 "algo": "java_app",
169 "type": "java_pie",
170 "java_jar_path": self._full_jar_path,
171 "java_app_class": self.java_app_class,
172 }
173 ]
174 }
175 # extract java app type with help of java class.
176 self._java_app_type, self._frag_param_str, _java_ctx_type = _parse_user_app(
177 java_app_class, full_jar_path
178 )
179 # For four different java type, we use two different driver class
180 if self._java_app_type not in POSSIBLE_APP_TYPES:
181 raise RuntimeError("Unexpected app type: {}".format(self._java_app_type))
182 if self._java_app_type.find("property") != -1:
183 gs_config["app"][0]["compatible_graph"] = ["vineyard::ArrowFragment"]
184 else:
185 gs_config["app"][0]["compatible_graph"] = ["gs::ArrowProjectedFragment"]
186
187 gs_config["app"][0]["context_type"] = _java_ctx_type
188 if self._java_app_type == "default_property":
189 gs_config["app"][0][
190 "driver_header"
191 ] = "apps/java_pie/java_pie_property_default_app.h"
192 gs_config["app"][0]["class_name"] = "gs::JavaPIEPropertyDefaultApp"
193 elif self._java_app_type == "parallel_property":
194 gs_config["app"][0][
195 "driver_header"
196 ] = "apps/java_pie/java_pie_property_parallel_app.h"
197 gs_config["app"][0]["class_name"] = "gs::JavaPIEPropertyParallelAppOE"
198 elif self._java_app_type == "default_simple":
199 gs_config["app"][0][
200 "driver_header"
201 ] = "apps/java_pie/java_pie_projected_default_app.h"
202 gs_config["app"][0]["class_name"] = "gs::JavaPIEProjectedDefaultApp"
203 elif self._java_app_type == "parallel_simple":
204 gs_config["app"][0][
205 "driver_header"
206 ] = "apps/java_pie/java_pie_projected_parallel_app.h"
207 gs_config["app"][0]["class_name"] = "gs::JavaPIEProjectedParallelAppOE"
208 else:
209 raise Exception(
210 "Unrecognizable java app type: {}".format(self._java_app_type)

Callers

nothing calls this directly

Calls 8

_pack_jarMethod · 0.95
_parse_user_appFunction · 0.85
findMethod · 0.80
appendMethod · 0.65
dumpMethod · 0.65
PathClass · 0.50
formatMethod · 0.45
read_bytesMethod · 0.45

Tested by

no test coverage detected