malevich-coretools 0.3.65__tar.gz → 0.3.67__tar.gz

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.

Potentially problematic release.


This version of malevich-coretools might be problematic. Click here for more details.

Files changed (38) hide show
  1. {malevich_coretools-0.3.65/malevich_coretools.egg-info → malevich_coretools-0.3.67}/PKG-INFO +1 -1
  2. malevich_coretools-0.3.67/VERSION +1 -0
  3. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/malevich_coretools/abstract/abstract.py +1 -0
  4. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/malevich_coretools/abstract/pipeline.py +15 -7
  5. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/malevich_coretools/funcs/funcs.py +18 -14
  6. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/malevich_coretools/secondary/const.py +1 -1
  7. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/malevich_coretools/utils.py +41 -7
  8. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67/malevich_coretools.egg-info}/PKG-INFO +1 -1
  9. malevich_coretools-0.3.65/VERSION +0 -1
  10. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/LICENSE +0 -0
  11. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/MANIFEST.in +0 -0
  12. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/README.md +0 -0
  13. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/malevich_coretools/__init__.py +0 -0
  14. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/malevich_coretools/abstract/__init__.py +0 -0
  15. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/malevich_coretools/abstract/operations.py +0 -0
  16. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/malevich_coretools/abstract/statuses.py +0 -0
  17. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/malevich_coretools/admin/__init__.py +0 -0
  18. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/malevich_coretools/admin/utils.py +0 -0
  19. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/malevich_coretools/batch/__init__.py +0 -0
  20. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/malevich_coretools/batch/utils.py +0 -0
  21. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/malevich_coretools/funcs/__init__.py +0 -0
  22. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/malevich_coretools/funcs/checks.py +0 -0
  23. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/malevich_coretools/funcs/helpers.py +0 -0
  24. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/malevich_coretools/secondary/__init__.py +0 -0
  25. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/malevich_coretools/secondary/config.py +0 -0
  26. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/malevich_coretools/secondary/helpers.py +0 -0
  27. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/malevich_coretools/secondary/kafka_utils.py +0 -0
  28. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/malevich_coretools/tools/__init__.py +0 -0
  29. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/malevich_coretools/tools/abstract.py +0 -0
  30. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/malevich_coretools/tools/vast.py +0 -0
  31. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/malevich_coretools.egg-info/SOURCES.txt +0 -0
  32. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/malevich_coretools.egg-info/dependency_links.txt +0 -0
  33. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/malevich_coretools.egg-info/requires.txt +0 -0
  34. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/malevich_coretools.egg-info/top_level.txt +0 -0
  35. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/pyproject.toml +0 -0
  36. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/requirements.txt +0 -0
  37. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/setup.cfg +0 -0
  38. {malevich_coretools-0.3.65 → malevich_coretools-0.3.67}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: malevich-coretools
3
- Version: 0.3.65
3
+ Version: 0.3.67
4
4
  Author: Andrew Pogrebnoj
5
5
  Author-email: andrew@onjulius.co
6
6
  License-File: LICENSE
@@ -0,0 +1 @@
1
+ 0.3.67
@@ -400,6 +400,7 @@ class PipelineRunInfo(BaseModel):
400
400
 
401
401
  class AppLogs(BaseModel):
402
402
  operationId: Alias.Id
403
+ runId: Optional[Alias.Id] = None
403
404
  dagLogs: str = ""
404
405
  data: Dict[str, AppLog] = {}
405
406
  error: Optional[str] = None
@@ -27,6 +27,14 @@ from malevich_coretools.abstract.operations import (
27
27
  )
28
28
 
29
29
 
30
+ def _validation_common(arg: 'BaseArgument', other_k = 0) -> None:
31
+ k = (arg.id is not None) + (arg.collectionName is not None) + (arg.collectionId is not None) + other_k
32
+ if k == 0:
33
+ raise ValueError("argument construction requires exactly one parameter, got none")
34
+ if k > 1:
35
+ raise ValueError("argument construction requires exactly one parameter, multiple provided")
36
+
37
+
30
38
  class PullCollectionPolicy(IntEnum):
31
39
  INIT = 0
32
40
  IF_NOT_EXIST = 1
@@ -43,7 +51,7 @@ class BaseArgument(BaseModel):
43
51
  collectionId: Optional[str] = None # hardcode collection with id (or obj path)
44
52
 
45
53
  def validation(self) -> None:
46
- assert (self.id is not None) + (self.collectionName is not None) + (self.collectionId is not None) == 1, "one way of constructing the argument must be chosen"
54
+ _validation_common(self)
47
55
 
48
56
 
49
57
  class Argument(BaseArgument):
@@ -52,11 +60,11 @@ class Argument(BaseArgument):
52
60
 
53
61
  def validation(self) -> None:
54
62
  if self.group is not None:
55
- assert self.id is None and self.collectionName is None and self.collectionId is None, "one way of constructing the argument must be chosen"
63
+ _validation_common(self, 1)
56
64
  for subarg in self.group:
57
65
  subarg.validation()
58
66
  else:
59
- assert (self.id is not None) + (self.collectionName is not None) + (self.collectionId is not None) == 1, "one way of constructing the argument must be chosen"
67
+ _validation_common(self)
60
68
 
61
69
 
62
70
  class AlternativeArgument(BaseArgument):
@@ -65,19 +73,19 @@ class AlternativeArgument(BaseArgument):
65
73
 
66
74
  def validation(self) -> None:
67
75
  if self.group is not None:
68
- assert self.id is None and self.collectionName is None and self.collectionId is None, "one way of constructing the argument must be chosen"
76
+ _validation_common(self, 1)
69
77
  for subarg in self.group:
70
78
  subarg.validation()
71
79
  elif self.alternative is not None:
72
80
  for alt_arg in self.alternative:
73
81
  if alt_arg.group is not None:
74
- assert alt_arg.id is None and alt_arg.collectionName is None and alt_arg.collectionId is None, "one way of constructing the argument must be chosen"
82
+ _validation_common(self, 1)
75
83
  for subarg in alt_arg.group:
76
84
  subarg.validation()
77
85
  else:
78
- assert (self.id is not None) + (self.collectionName is not None) + (self.collectionId is not None) == 1, "one way of constructing the argument must be chosen"
86
+ _validation_common(self)
79
87
  else:
80
- assert (self.id is not None) + (self.collectionName is not None) + (self.collectionId is not None) == 1, "one way of constructing the argument must be chosen"
88
+ _validation_common(self)
81
89
 
82
90
 
83
91
  class AppEntity(BaseModel):
@@ -124,12 +124,18 @@ async def get_collections_groupName_async(name: str, operation_id: str, run_id:
124
124
  return model_from_json(await send_to_core_get_async(COLLECTIONS_GROUP_NAME(name, operation_id, run_id), *args, **kwargs), ResultCollections)
125
125
 
126
126
 
127
- def get_collections_id(id: str, offset: int, limit: int, *args, **kwargs) -> ResultCollection:
128
- return model_from_json(send_to_core_get(COLLECTIONS_ID(id, offset, limit), *args, **kwargs), ResultCollection)
127
+ def get_collections_id(id: str, offset: int, limit: int, raw: bool, *args, **kwargs) -> Union[ResultCollection, Alias.Json]:
128
+ res = send_to_core_get(COLLECTIONS_ID(id, offset, limit, raw), *args, is_text=raw, **kwargs)
129
+ if not raw:
130
+ res = model_from_json(res, ResultCollection)
131
+ return res
129
132
 
130
133
 
131
- async def get_collections_id_async(id: str, offset: int, limit: int, *args, **kwargs) -> ResultCollection:
132
- return model_from_json(await send_to_core_get_async(COLLECTIONS_ID(id, offset, limit), *args, **kwargs), ResultCollection)
134
+ async def get_collections_id_async(id: str, offset: int, limit: int, raw: bool, *args, **kwargs) -> Union[ResultCollection, Alias.Json]:
135
+ res = await send_to_core_get_async(COLLECTIONS_ID(id, offset, limit, raw), *args, is_text=raw, **kwargs)
136
+ if not raw:
137
+ res = model_from_json(res, ResultCollection)
138
+ return res
133
139
 
134
140
 
135
141
  def post_collections(data: DocsCollection, wait: bool, *args, **kwargs) -> Alias.Id:
@@ -1280,26 +1286,24 @@ async def post_manager_task_async(data: MainTask, with_show: bool, long: bool, l
1280
1286
  return AppLogs.model_validate_json(res)
1281
1287
 
1282
1288
 
1283
- def post_manager_task_run(data: RunTask, with_show: bool, long: bool, long_timeout: int, wait: bool, auth: Optional[AUTH], conn_url: Optional[str]=None, *args, **kwargs) -> Optional[Union[Alias.Id, AppLogs]]:
1289
+ def post_manager_task_run(data: RunTask, with_show: bool, long: bool, long_timeout: int, wait: bool, auth: Optional[AUTH], conn_url: Optional[str]=None, *args, **kwargs) -> Union[Alias.Id, AppLogs]:
1284
1290
  check_profile_mode(data.profileMode)
1285
1291
  res = send_to_core_modify(MANAGER_TASK_RUN(wait and not long), data, with_show=with_show, show_func=show_logs_func, auth=auth, conn_url=conn_url, *args, **kwargs)
1286
1292
  if wait and long:
1287
1293
  res = asyncio.run(__get_result(res, timeout=long_timeout, auth=auth))
1288
- if data.withLogs or data.schedule is not None:
1289
- if not wait:
1290
- return res
1291
- return AppLogs.model_validate_json(res)
1294
+ if not wait:
1295
+ return res
1296
+ return AppLogs.model_validate_json(res)
1292
1297
 
1293
1298
 
1294
- async def post_manager_task_run_async(data: RunTask, with_show: bool, long: bool, long_timeout: int, wait: bool, auth: Optional[AUTH], conn_url: Optional[str]=None, *args, **kwargs) -> Optional[Union[Alias.Id, AppLogs]]:
1299
+ async def post_manager_task_run_async(data: RunTask, with_show: bool, long: bool, long_timeout: int, wait: bool, auth: Optional[AUTH], conn_url: Optional[str]=None, *args, **kwargs) -> Union[Alias.Id, AppLogs]:
1295
1300
  check_profile_mode(data.profileMode)
1296
1301
  res = await send_to_core_modify_async(MANAGER_TASK_RUN(wait and not long), data, with_show=with_show, show_func=show_logs_func, auth=auth, conn_url=conn_url, *args, **kwargs)
1297
1302
  if wait and long:
1298
1303
  res = await __get_result(res, timeout=long_timeout, auth=auth)
1299
- if data.withLogs or data.schedule is not None:
1300
- if not wait:
1301
- return res
1302
- return AppLogs.model_validate_json(res)
1304
+ if not wait:
1305
+ return res
1306
+ return AppLogs.model_validate_json(res)
1303
1307
 
1304
1308
 
1305
1309
  def post_manager_pipeline(data: MainPipeline, with_show: bool, long: bool, long_timeout: int, return_response: bool, wait: bool, auth: Optional[AUTH], conn_url: Optional[str]=None, *args, **kwargs) -> Union[Alias.Id, AppLogs]:
@@ -50,7 +50,7 @@ COLLECTIONS_IDS_NAME = lambda name, operation_id, run_id: with_key_values(f"{COL
50
50
  COLLECTIONS_NAME = lambda name, operation_id, run_id, offset, limit: with_key_values(f"{COLLECTIONS_MAIN}/name/{urllib.parse.quote(str(name), safe='')}", {"operationId": operation_id, "runId": run_id, "offset": offset, "limit": limit})
51
51
  COLLECTIONS_IDS_GROUP_NAME = lambda name, operation_id, run_id: with_key_values(f"{COLLECTIONS_MAIN}/ids/groupName/{urllib.parse.quote(str(name), safe='')}", {"operationId": operation_id, "runId": run_id})
52
52
  COLLECTIONS_GROUP_NAME = lambda name, operation_id, run_id: with_key_values(f"{COLLECTIONS_MAIN}/groupName/{urllib.parse.quote(str(name), safe='')}", {"operationId": operation_id, "runId": run_id})
53
- COLLECTIONS_ID = lambda id, offset, limit: with_key_values(f"{COLLECTIONS_MAIN}/{urllib.parse.quote(str(id), safe='')}", {"offset": offset, "limit": limit})
53
+ COLLECTIONS_ID = lambda id, offset, limit, raw: with_key_values(f"{COLLECTIONS_MAIN}/{urllib.parse.quote(str(id), safe='')}", {"offset": offset, "limit": limit, "raw": raw})
54
54
  COLLECTIONS_ID_MODIFY = lambda id, wait: with_wait(f"{COLLECTIONS_MAIN}/{urllib.parse.quote(str(id), safe='')}", wait)
55
55
  COLLECTIONS_ID_S3 = lambda id, wait: with_wait(f"{COLLECTIONS_MAIN}/s3/{urllib.parse.quote(str(id), safe='')}", wait)
56
56
  COLLECTIONS_ID_ADD = lambda id, wait: with_wait(f"{COLLECTIONS_MAIN}/{urllib.parse.quote(str(id), safe='')}/add", wait)
@@ -609,6 +609,7 @@ def get_collection(
609
609
  auth: Optional[AUTH] = None,
610
610
  conn_url: Optional[str] = None,
611
611
  batcher: Optional[Batcher] = None,
612
+ raw: Literal[False] = False,
612
613
  is_async: Literal[False] = False,
613
614
  ) -> ResultCollection:
614
615
  pass
@@ -623,11 +624,13 @@ def get_collection(
623
624
  auth: Optional[AUTH] = None,
624
625
  conn_url: Optional[str] = None,
625
626
  batcher: Optional[Batcher] = None,
627
+ raw: Literal[False] = False,
626
628
  is_async: Literal[True],
627
629
  ) -> Coroutine[Any, Any, ResultCollection]:
628
630
  pass
629
631
 
630
632
 
633
+ @overload
631
634
  def get_collection(
632
635
  id: str,
633
636
  offset: int = 0,
@@ -636,16 +639,47 @@ def get_collection(
636
639
  auth: Optional[AUTH] = None,
637
640
  conn_url: Optional[str] = None,
638
641
  batcher: Optional[Batcher] = None,
642
+ raw: Literal[True],
643
+ is_async: Literal[False] = False,
644
+ ) -> Alias.Json:
645
+ pass
646
+
647
+
648
+ @overload
649
+ def get_collection(
650
+ id: str,
651
+ offset: int = 0,
652
+ limit: int = -1,
653
+ *,
654
+ auth: Optional[AUTH] = None,
655
+ conn_url: Optional[str] = None,
656
+ batcher: Optional[Batcher] = None,
657
+ raw: Literal[True],
658
+ is_async: Literal[True],
659
+ ) -> Coroutine[Any, Any, Alias.Json]:
660
+ pass
661
+
662
+
663
+ def get_collection(
664
+ id: str,
665
+ offset: int = 0,
666
+ limit: int = -1,
667
+ *,
668
+ auth: Optional[AUTH] = None,
669
+ conn_url: Optional[str] = None,
670
+ batcher: Optional[Batcher] = None,
671
+ raw: bool = False,
639
672
  is_async: bool = False,
640
- ) -> Union[ResultCollection, Coroutine[Any, Any, ResultCollection]]:
673
+ ) -> Union[ResultCollection, Alias.Json, Coroutine[Any, Any, ResultCollection], Coroutine[Any, Any, Alias.Json]]:
641
674
  """return collection by `id`, pagination: unlimited - `limit` < 0"""
642
675
  if batcher is None:
643
676
  batcher = Config.BATCHER
644
677
  if batcher is not None:
645
- return batcher.add("getCollectionById", vars={"id": id, "offset": offset, "limit": limit}, result_model=ResultCollection)
678
+ result_model = None if raw else ResultCollection
679
+ return batcher.add("getCollectionById", vars={"id": id, "offset": offset, "limit": limit, "raw": raw}, result_model=result_model)
646
680
  if is_async:
647
- return f.get_collections_id_async(id, offset, limit, auth=auth, conn_url=conn_url)
648
- return f.get_collections_id(id, offset, limit, auth=auth, conn_url=conn_url)
681
+ return f.get_collections_id_async(id, offset, limit, raw, auth=auth, conn_url=conn_url)
682
+ return f.get_collections_id(id, offset, limit, raw, auth=auth, conn_url=conn_url)
649
683
 
650
684
 
651
685
  @overload
@@ -7161,7 +7195,7 @@ def task_run(
7161
7195
  conn_url: Optional[str] = None,
7162
7196
  batcher: Optional[Batcher] = None,
7163
7197
  is_async: Literal[False] = False,
7164
- ) -> Optional[Union[Alias.Id, AppLogs]]:
7198
+ ) -> Union[Alias.Id, AppLogs]:
7165
7199
  pass
7166
7200
 
7167
7201
 
@@ -7186,7 +7220,7 @@ def task_run(
7186
7220
  conn_url: Optional[str] = None,
7187
7221
  batcher: Optional[Batcher] = None,
7188
7222
  is_async: Literal[True],
7189
- ) -> Coroutine[Any, Any, Optional[Union[Alias.Id, AppLogs]]]:
7223
+ ) -> Coroutine[Any, Any, Union[Alias.Id, AppLogs]]:
7190
7224
  pass
7191
7225
 
7192
7226
 
@@ -7210,7 +7244,7 @@ def task_run(
7210
7244
  conn_url: Optional[str] = None,
7211
7245
  batcher: Optional[Batcher] = None,
7212
7246
  is_async: bool = False,
7213
- ) -> Union[Optional[Union[Alias.Id, AppLogs]], Coroutine[Any, Any, Optional[Union[Alias.Id, AppLogs]]]]:
7247
+ ) -> Union[Union[Alias.Id, AppLogs], Coroutine[Any, Any, Union[Alias.Id, AppLogs]]]:
7214
7248
  """run prepared task by `operation_id` with `cfg_id` and other overridden parameters
7215
7249
 
7216
7250
  Args:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: malevich-coretools
3
- Version: 0.3.65
3
+ Version: 0.3.67
4
4
  Author: Andrew Pogrebnoj
5
5
  Author-email: andrew@onjulius.co
6
6
  License-File: LICENSE
@@ -1 +0,0 @@
1
- 0.3.65