graphscope-flex 0.27.0__5-py2.py3-none-any.whl → 0.28.0__5-py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,9 +17,11 @@ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
17
17
  from typing import Any, Dict, List, Optional, Tuple, Union
18
18
  from typing_extensions import Annotated
19
19
 
20
- from pydantic import StrictStr
20
+ from pydantic import StrictBool, StrictStr
21
+ from typing import Optional
21
22
  from graphscope.flex.rest.models.create_dataloading_job_response import CreateDataloadingJobResponse
22
23
  from graphscope.flex.rest.models.dataloading_job_config import DataloadingJobConfig
24
+ from graphscope.flex.rest.models.dataloading_mr_job_config import DataloadingMRJobConfig
23
25
  from graphscope.flex.rest.models.job_status import JobStatus
24
26
 
25
27
  from graphscope.flex.rest.api_client import ApiClient, RequestSerialized
@@ -44,6 +46,7 @@ class JobApi:
44
46
  def delete_job_by_id(
45
47
  self,
46
48
  job_id: StrictStr,
49
+ delete_scheduler: Optional[StrictBool] = None,
47
50
  _request_timeout: Union[
48
51
  None,
49
52
  Annotated[StrictFloat, Field(gt=0)],
@@ -63,6 +66,8 @@ class JobApi:
63
66
 
64
67
  :param job_id: (required)
65
68
  :type job_id: str
69
+ :param delete_scheduler:
70
+ :type delete_scheduler: bool
66
71
  :param _request_timeout: timeout setting for this request. If one
67
72
  number provided, it will be total request
68
73
  timeout. It can also be a pair (tuple) of
@@ -87,6 +92,7 @@ class JobApi:
87
92
 
88
93
  _param = self._delete_job_by_id_serialize(
89
94
  job_id=job_id,
95
+ delete_scheduler=delete_scheduler,
90
96
  _request_auth=_request_auth,
91
97
  _content_type=_content_type,
92
98
  _headers=_headers,
@@ -112,6 +118,7 @@ class JobApi:
112
118
  def delete_job_by_id_with_http_info(
113
119
  self,
114
120
  job_id: StrictStr,
121
+ delete_scheduler: Optional[StrictBool] = None,
115
122
  _request_timeout: Union[
116
123
  None,
117
124
  Annotated[StrictFloat, Field(gt=0)],
@@ -131,6 +138,8 @@ class JobApi:
131
138
 
132
139
  :param job_id: (required)
133
140
  :type job_id: str
141
+ :param delete_scheduler:
142
+ :type delete_scheduler: bool
134
143
  :param _request_timeout: timeout setting for this request. If one
135
144
  number provided, it will be total request
136
145
  timeout. It can also be a pair (tuple) of
@@ -155,6 +164,7 @@ class JobApi:
155
164
 
156
165
  _param = self._delete_job_by_id_serialize(
157
166
  job_id=job_id,
167
+ delete_scheduler=delete_scheduler,
158
168
  _request_auth=_request_auth,
159
169
  _content_type=_content_type,
160
170
  _headers=_headers,
@@ -180,6 +190,7 @@ class JobApi:
180
190
  def delete_job_by_id_without_preload_content(
181
191
  self,
182
192
  job_id: StrictStr,
193
+ delete_scheduler: Optional[StrictBool] = None,
183
194
  _request_timeout: Union[
184
195
  None,
185
196
  Annotated[StrictFloat, Field(gt=0)],
@@ -199,6 +210,8 @@ class JobApi:
199
210
 
200
211
  :param job_id: (required)
201
212
  :type job_id: str
213
+ :param delete_scheduler:
214
+ :type delete_scheduler: bool
202
215
  :param _request_timeout: timeout setting for this request. If one
203
216
  number provided, it will be total request
204
217
  timeout. It can also be a pair (tuple) of
@@ -223,6 +236,7 @@ class JobApi:
223
236
 
224
237
  _param = self._delete_job_by_id_serialize(
225
238
  job_id=job_id,
239
+ delete_scheduler=delete_scheduler,
226
240
  _request_auth=_request_auth,
227
241
  _content_type=_content_type,
228
242
  _headers=_headers,
@@ -243,6 +257,7 @@ class JobApi:
243
257
  def _delete_job_by_id_serialize(
244
258
  self,
245
259
  job_id,
260
+ delete_scheduler,
246
261
  _request_auth,
247
262
  _content_type,
248
263
  _headers,
@@ -265,6 +280,10 @@ class JobApi:
265
280
  if job_id is not None:
266
281
  _path_params['job_id'] = job_id
267
282
  # process the query parameters
283
+ if delete_scheduler is not None:
284
+
285
+ _query_params.append(('delete_scheduler', delete_scheduler))
286
+
268
287
  # process the header parameters
269
288
  # process the form parameters
270
289
  # process the body parameter
@@ -304,6 +323,7 @@ class JobApi:
304
323
  def get_dataloading_job_config(
305
324
  self,
306
325
  graph_id: StrictStr,
326
+ dataloading_job_config: DataloadingJobConfig,
307
327
  _request_timeout: Union[
308
328
  None,
309
329
  Annotated[StrictFloat, Field(gt=0)],
@@ -316,13 +336,15 @@ class JobApi:
316
336
  _content_type: Optional[StrictStr] = None,
317
337
  _headers: Optional[Dict[StrictStr, Any]] = None,
318
338
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
319
- ) -> DataloadingJobConfig:
339
+ ) -> DataloadingMRJobConfig:
320
340
  """get_dataloading_job_config
321
341
 
322
- Get the data loading configuration
342
+ Post to get the data loading configuration for MapReduce Task
323
343
 
324
344
  :param graph_id: (required)
325
345
  :type graph_id: str
346
+ :param dataloading_job_config: (required)
347
+ :type dataloading_job_config: DataloadingJobConfig
326
348
  :param _request_timeout: timeout setting for this request. If one
327
349
  number provided, it will be total request
328
350
  timeout. It can also be a pair (tuple) of
@@ -347,6 +369,7 @@ class JobApi:
347
369
 
348
370
  _param = self._get_dataloading_job_config_serialize(
349
371
  graph_id=graph_id,
372
+ dataloading_job_config=dataloading_job_config,
350
373
  _request_auth=_request_auth,
351
374
  _content_type=_content_type,
352
375
  _headers=_headers,
@@ -354,7 +377,7 @@ class JobApi:
354
377
  )
355
378
 
356
379
  _response_types_map: Dict[str, Optional[str]] = {
357
- '200': "DataloadingJobConfig",
380
+ '200': "DataloadingMRJobConfig",
358
381
  '500': "Error",
359
382
  }
360
383
  response_data = self.api_client.call_api(
@@ -372,6 +395,7 @@ class JobApi:
372
395
  def get_dataloading_job_config_with_http_info(
373
396
  self,
374
397
  graph_id: StrictStr,
398
+ dataloading_job_config: DataloadingJobConfig,
375
399
  _request_timeout: Union[
376
400
  None,
377
401
  Annotated[StrictFloat, Field(gt=0)],
@@ -384,13 +408,15 @@ class JobApi:
384
408
  _content_type: Optional[StrictStr] = None,
385
409
  _headers: Optional[Dict[StrictStr, Any]] = None,
386
410
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
387
- ) -> ApiResponse[DataloadingJobConfig]:
411
+ ) -> ApiResponse[DataloadingMRJobConfig]:
388
412
  """get_dataloading_job_config
389
413
 
390
- Get the data loading configuration
414
+ Post to get the data loading configuration for MapReduce Task
391
415
 
392
416
  :param graph_id: (required)
393
417
  :type graph_id: str
418
+ :param dataloading_job_config: (required)
419
+ :type dataloading_job_config: DataloadingJobConfig
394
420
  :param _request_timeout: timeout setting for this request. If one
395
421
  number provided, it will be total request
396
422
  timeout. It can also be a pair (tuple) of
@@ -415,6 +441,7 @@ class JobApi:
415
441
 
416
442
  _param = self._get_dataloading_job_config_serialize(
417
443
  graph_id=graph_id,
444
+ dataloading_job_config=dataloading_job_config,
418
445
  _request_auth=_request_auth,
419
446
  _content_type=_content_type,
420
447
  _headers=_headers,
@@ -422,7 +449,7 @@ class JobApi:
422
449
  )
423
450
 
424
451
  _response_types_map: Dict[str, Optional[str]] = {
425
- '200': "DataloadingJobConfig",
452
+ '200': "DataloadingMRJobConfig",
426
453
  '500': "Error",
427
454
  }
428
455
  response_data = self.api_client.call_api(
@@ -440,6 +467,7 @@ class JobApi:
440
467
  def get_dataloading_job_config_without_preload_content(
441
468
  self,
442
469
  graph_id: StrictStr,
470
+ dataloading_job_config: DataloadingJobConfig,
443
471
  _request_timeout: Union[
444
472
  None,
445
473
  Annotated[StrictFloat, Field(gt=0)],
@@ -455,10 +483,12 @@ class JobApi:
455
483
  ) -> RESTResponseType:
456
484
  """get_dataloading_job_config
457
485
 
458
- Get the data loading configuration
486
+ Post to get the data loading configuration for MapReduce Task
459
487
 
460
488
  :param graph_id: (required)
461
489
  :type graph_id: str
490
+ :param dataloading_job_config: (required)
491
+ :type dataloading_job_config: DataloadingJobConfig
462
492
  :param _request_timeout: timeout setting for this request. If one
463
493
  number provided, it will be total request
464
494
  timeout. It can also be a pair (tuple) of
@@ -483,6 +513,7 @@ class JobApi:
483
513
 
484
514
  _param = self._get_dataloading_job_config_serialize(
485
515
  graph_id=graph_id,
516
+ dataloading_job_config=dataloading_job_config,
486
517
  _request_auth=_request_auth,
487
518
  _content_type=_content_type,
488
519
  _headers=_headers,
@@ -490,7 +521,7 @@ class JobApi:
490
521
  )
491
522
 
492
523
  _response_types_map: Dict[str, Optional[str]] = {
493
- '200': "DataloadingJobConfig",
524
+ '200': "DataloadingMRJobConfig",
494
525
  '500': "Error",
495
526
  }
496
527
  response_data = self.api_client.call_api(
@@ -503,6 +534,7 @@ class JobApi:
503
534
  def _get_dataloading_job_config_serialize(
504
535
  self,
505
536
  graph_id,
537
+ dataloading_job_config,
506
538
  _request_auth,
507
539
  _content_type,
508
540
  _headers,
@@ -528,6 +560,8 @@ class JobApi:
528
560
  # process the header parameters
529
561
  # process the form parameters
530
562
  # process the body parameter
563
+ if dataloading_job_config is not None:
564
+ _body_params = dataloading_job_config
531
565
 
532
566
 
533
567
  # set the HTTP header `Accept`
@@ -537,13 +571,26 @@ class JobApi:
537
571
  ]
538
572
  )
539
573
 
574
+ # set the HTTP header `Content-Type`
575
+ if _content_type:
576
+ _header_params['Content-Type'] = _content_type
577
+ else:
578
+ _default_content_type = (
579
+ self.api_client.select_header_content_type(
580
+ [
581
+ 'application/json'
582
+ ]
583
+ )
584
+ )
585
+ if _default_content_type is not None:
586
+ _header_params['Content-Type'] = _default_content_type
540
587
 
541
588
  # authentication setting
542
589
  _auth_settings: List[str] = [
543
590
  ]
544
591
 
545
592
  return self.api_client.param_serialize(
546
- method='GET',
593
+ method='POST',
547
594
  resource_path='/api/v1/graph/{graph_id}/dataloading/config',
548
595
  path_params=_path_params,
549
596
  query_params=_query_params,
@@ -39,6 +39,7 @@ from graphscope.flex.rest.models.dataloading_job_config_edges_inner import Datal
39
39
  from graphscope.flex.rest.models.dataloading_job_config_loading_config import DataloadingJobConfigLoadingConfig
40
40
  from graphscope.flex.rest.models.dataloading_job_config_loading_config_format import DataloadingJobConfigLoadingConfigFormat
41
41
  from graphscope.flex.rest.models.dataloading_job_config_vertices_inner import DataloadingJobConfigVerticesInner
42
+ from graphscope.flex.rest.models.dataloading_mr_job_config import DataloadingMRJobConfig
42
43
  from graphscope.flex.rest.models.edge_mapping import EdgeMapping
43
44
  from graphscope.flex.rest.models.edge_mapping_type_triplet import EdgeMappingTypeTriplet
44
45
  from graphscope.flex.rest.models.error import Error
@@ -49,17 +50,21 @@ from graphscope.flex.rest.models.get_alert_rule_response import GetAlertRuleResp
49
50
  from graphscope.flex.rest.models.get_edge_type import GetEdgeType
50
51
  from graphscope.flex.rest.models.get_graph_response import GetGraphResponse
51
52
  from graphscope.flex.rest.models.get_graph_schema_response import GetGraphSchemaResponse
53
+ from graphscope.flex.rest.models.get_pod_log_response import GetPodLogResponse
52
54
  from graphscope.flex.rest.models.get_property_meta import GetPropertyMeta
55
+ from graphscope.flex.rest.models.get_resource_usage_response import GetResourceUsageResponse
56
+ from graphscope.flex.rest.models.get_storage_usage_response import GetStorageUsageResponse
53
57
  from graphscope.flex.rest.models.get_stored_proc_response import GetStoredProcResponse
54
58
  from graphscope.flex.rest.models.get_vertex_type import GetVertexType
55
59
  from graphscope.flex.rest.models.job_status import JobStatus
56
60
  from graphscope.flex.rest.models.long_text import LongText
57
61
  from graphscope.flex.rest.models.node_status import NodeStatus
58
62
  from graphscope.flex.rest.models.parameter import Parameter
63
+ from graphscope.flex.rest.models.pod_status import PodStatus
59
64
  from graphscope.flex.rest.models.primitive_type import PrimitiveType
65
+ from graphscope.flex.rest.models.resource_usage import ResourceUsage
60
66
  from graphscope.flex.rest.models.running_deployment_info import RunningDeploymentInfo
61
67
  from graphscope.flex.rest.models.running_deployment_status import RunningDeploymentStatus
62
- from graphscope.flex.rest.models.running_deployment_status_nodes_inner import RunningDeploymentStatusNodesInner
63
68
  from graphscope.flex.rest.models.schema_mapping import SchemaMapping
64
69
  from graphscope.flex.rest.models.service_status import ServiceStatus
65
70
  from graphscope.flex.rest.models.service_status_sdk_endpoints import ServiceStatusSdkEndpoints
@@ -30,13 +30,16 @@ class BaseEdgeTypeVertexTypePairRelationsInner(BaseModel):
30
30
  """ # noqa: E501
31
31
  source_vertex: StrictStr
32
32
  destination_vertex: StrictStr
33
- relation: StrictStr
33
+ relation: Optional[StrictStr] = None
34
34
  x_csr_params: Optional[BaseEdgeTypeVertexTypePairRelationsInnerXCsrParams] = None
35
35
  __properties: ClassVar[List[str]] = ["source_vertex", "destination_vertex", "relation", "x_csr_params"]
36
36
 
37
37
  @field_validator('relation')
38
38
  def relation_validate_enum(cls, value):
39
39
  """Validates the enum"""
40
+ if value is None:
41
+ return value
42
+
40
43
  if value not in set(['MANY_TO_MANY', 'ONE_TO_MANY', 'MANY_TO_ONE', 'ONE_TO_ONE']):
41
44
  raise ValueError("must be one of enum values ('MANY_TO_MANY', 'ONE_TO_MANY', 'MANY_TO_ONE', 'ONE_TO_ONE')")
42
45
  return value
@@ -33,7 +33,7 @@ class CreateEdgeType(BaseModel):
33
33
  vertex_type_pair_relations: List[BaseEdgeTypeVertexTypePairRelationsInner]
34
34
  directed: Optional[StrictBool] = None
35
35
  primary_keys: Optional[List[StrictStr]] = None
36
- properties: List[CreatePropertyMeta]
36
+ properties: Optional[List[CreatePropertyMeta]] = None
37
37
  description: Optional[StrictStr] = None
38
38
  __properties: ClassVar[List[str]] = ["type_name", "vertex_type_pair_relations", "directed", "primary_keys", "properties", "description"]
39
39
 
@@ -0,0 +1,88 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ GraphScope FLEX HTTP SERVICE API
5
+
6
+ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice)
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: graphscope@alibaba-inc.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, StrictStr
22
+ from typing import Any, ClassVar, Dict, List
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class DataloadingMRJobConfig(BaseModel):
27
+ """
28
+ DataloadingMRJobConfig
29
+ """ # noqa: E501
30
+ config: StrictStr
31
+ __properties: ClassVar[List[str]] = ["config"]
32
+
33
+ model_config = {
34
+ "populate_by_name": True,
35
+ "validate_assignment": True,
36
+ "protected_namespaces": (),
37
+ }
38
+
39
+
40
+ def to_str(self) -> str:
41
+ """Returns the string representation of the model using alias"""
42
+ return pprint.pformat(self.model_dump(by_alias=True))
43
+
44
+ def to_json(self) -> str:
45
+ """Returns the JSON representation of the model using alias"""
46
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
+ return json.dumps(self.to_dict())
48
+
49
+ @classmethod
50
+ def from_json(cls, json_str: str) -> Optional[Self]:
51
+ """Create an instance of DataloadingMRJobConfig from a JSON string"""
52
+ return cls.from_dict(json.loads(json_str))
53
+
54
+ def to_dict(self) -> Dict[str, Any]:
55
+ """Return the dictionary representation of the model using alias.
56
+
57
+ This has the following differences from calling pydantic's
58
+ `self.model_dump(by_alias=True)`:
59
+
60
+ * `None` is only added to the output dict for nullable fields that
61
+ were set at model initialization. Other fields with value `None`
62
+ are ignored.
63
+ """
64
+ excluded_fields: Set[str] = set([
65
+ ])
66
+
67
+ _dict = self.model_dump(
68
+ by_alias=True,
69
+ exclude=excluded_fields,
70
+ exclude_none=True,
71
+ )
72
+ return _dict
73
+
74
+ @classmethod
75
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
76
+ """Create an instance of DataloadingMRJobConfig from a dict"""
77
+ if obj is None:
78
+ return None
79
+
80
+ if not isinstance(obj, dict):
81
+ return cls.model_validate(obj)
82
+
83
+ _obj = cls.model_validate({
84
+ "config": obj.get("config")
85
+ })
86
+ return _obj
87
+
88
+
@@ -31,8 +31,8 @@ class EdgeMapping(BaseModel):
31
31
  """ # noqa: E501
32
32
  type_triplet: EdgeMappingTypeTriplet
33
33
  inputs: List[StrictStr]
34
- source_vertex_mappings: List[ColumnMapping]
35
- destination_vertex_mappings: List[ColumnMapping]
34
+ source_vertex_mappings: Optional[List[ColumnMapping]] = None
35
+ destination_vertex_mappings: Optional[List[ColumnMapping]] = None
36
36
  column_mappings: Optional[List[ColumnMapping]] = None
37
37
  __properties: ClassVar[List[str]] = ["type_triplet", "inputs", "source_vertex_mappings", "destination_vertex_mappings", "column_mappings"]
38
38
 
@@ -33,7 +33,7 @@ class GetEdgeType(BaseModel):
33
33
  vertex_type_pair_relations: List[BaseEdgeTypeVertexTypePairRelationsInner]
34
34
  directed: Optional[StrictBool] = None
35
35
  primary_keys: Optional[List[StrictStr]] = None
36
- type_id: StrictInt
36
+ type_id: Optional[StrictInt] = None
37
37
  properties: Optional[List[GetPropertyMeta]] = None
38
38
  description: Optional[StrictStr] = None
39
39
  __properties: ClassVar[List[str]] = ["type_name", "vertex_type_pair_relations", "directed", "primary_keys", "type_id", "properties", "description"]
@@ -0,0 +1,88 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ GraphScope FLEX HTTP SERVICE API
5
+
6
+ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice)
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: graphscope@alibaba-inc.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel
22
+ from typing import Any, ClassVar, Dict, List
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class GetPodLogResponse(BaseModel):
27
+ """
28
+ GetPodLogResponse
29
+ """ # noqa: E501
30
+ log: Dict[str, Any]
31
+ __properties: ClassVar[List[str]] = ["log"]
32
+
33
+ model_config = {
34
+ "populate_by_name": True,
35
+ "validate_assignment": True,
36
+ "protected_namespaces": (),
37
+ }
38
+
39
+
40
+ def to_str(self) -> str:
41
+ """Returns the string representation of the model using alias"""
42
+ return pprint.pformat(self.model_dump(by_alias=True))
43
+
44
+ def to_json(self) -> str:
45
+ """Returns the JSON representation of the model using alias"""
46
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
+ return json.dumps(self.to_dict())
48
+
49
+ @classmethod
50
+ def from_json(cls, json_str: str) -> Optional[Self]:
51
+ """Create an instance of GetPodLogResponse from a JSON string"""
52
+ return cls.from_dict(json.loads(json_str))
53
+
54
+ def to_dict(self) -> Dict[str, Any]:
55
+ """Return the dictionary representation of the model using alias.
56
+
57
+ This has the following differences from calling pydantic's
58
+ `self.model_dump(by_alias=True)`:
59
+
60
+ * `None` is only added to the output dict for nullable fields that
61
+ were set at model initialization. Other fields with value `None`
62
+ are ignored.
63
+ """
64
+ excluded_fields: Set[str] = set([
65
+ ])
66
+
67
+ _dict = self.model_dump(
68
+ by_alias=True,
69
+ exclude=excluded_fields,
70
+ exclude_none=True,
71
+ )
72
+ return _dict
73
+
74
+ @classmethod
75
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
76
+ """Create an instance of GetPodLogResponse from a dict"""
77
+ if obj is None:
78
+ return None
79
+
80
+ if not isinstance(obj, dict):
81
+ return cls.model_validate(obj)
82
+
83
+ _obj = cls.model_validate({
84
+ "log": obj.get("log")
85
+ })
86
+ return _obj
87
+
88
+
@@ -0,0 +1,105 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ GraphScope FLEX HTTP SERVICE API
5
+
6
+ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice)
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: graphscope@alibaba-inc.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel
22
+ from typing import Any, ClassVar, Dict, List
23
+ from graphscope.flex.rest.models.resource_usage import ResourceUsage
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class GetResourceUsageResponse(BaseModel):
28
+ """
29
+ GetResourceUsageResponse
30
+ """ # noqa: E501
31
+ cpu_usage: List[ResourceUsage]
32
+ memory_usage: List[ResourceUsage]
33
+ __properties: ClassVar[List[str]] = ["cpu_usage", "memory_usage"]
34
+
35
+ model_config = {
36
+ "populate_by_name": True,
37
+ "validate_assignment": True,
38
+ "protected_namespaces": (),
39
+ }
40
+
41
+
42
+ def to_str(self) -> str:
43
+ """Returns the string representation of the model using alias"""
44
+ return pprint.pformat(self.model_dump(by_alias=True))
45
+
46
+ def to_json(self) -> str:
47
+ """Returns the JSON representation of the model using alias"""
48
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49
+ return json.dumps(self.to_dict())
50
+
51
+ @classmethod
52
+ def from_json(cls, json_str: str) -> Optional[Self]:
53
+ """Create an instance of GetResourceUsageResponse from a JSON string"""
54
+ return cls.from_dict(json.loads(json_str))
55
+
56
+ def to_dict(self) -> Dict[str, Any]:
57
+ """Return the dictionary representation of the model using alias.
58
+
59
+ This has the following differences from calling pydantic's
60
+ `self.model_dump(by_alias=True)`:
61
+
62
+ * `None` is only added to the output dict for nullable fields that
63
+ were set at model initialization. Other fields with value `None`
64
+ are ignored.
65
+ """
66
+ excluded_fields: Set[str] = set([
67
+ ])
68
+
69
+ _dict = self.model_dump(
70
+ by_alias=True,
71
+ exclude=excluded_fields,
72
+ exclude_none=True,
73
+ )
74
+ # override the default output from pydantic by calling `to_dict()` of each item in cpu_usage (list)
75
+ _items = []
76
+ if self.cpu_usage:
77
+ for _item in self.cpu_usage:
78
+ if _item:
79
+ _items.append(_item.to_dict())
80
+ _dict['cpu_usage'] = _items
81
+ # override the default output from pydantic by calling `to_dict()` of each item in memory_usage (list)
82
+ _items = []
83
+ if self.memory_usage:
84
+ for _item in self.memory_usage:
85
+ if _item:
86
+ _items.append(_item.to_dict())
87
+ _dict['memory_usage'] = _items
88
+ return _dict
89
+
90
+ @classmethod
91
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
92
+ """Create an instance of GetResourceUsageResponse from a dict"""
93
+ if obj is None:
94
+ return None
95
+
96
+ if not isinstance(obj, dict):
97
+ return cls.model_validate(obj)
98
+
99
+ _obj = cls.model_validate({
100
+ "cpu_usage": [ResourceUsage.from_dict(_item) for _item in obj["cpu_usage"]] if obj.get("cpu_usage") is not None else None,
101
+ "memory_usage": [ResourceUsage.from_dict(_item) for _item in obj["memory_usage"]] if obj.get("memory_usage") is not None else None
102
+ })
103
+ return _obj
104
+
105
+