malevich-coretools 0.3.45__py3-none-any.whl → 0.3.47__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.

Potentially problematic release.


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

@@ -154,9 +154,16 @@ class TaskPolicy(BaseModel):
154
154
 
155
155
 
156
156
  class Schedule(BaseModel):
157
- delay: int # seconds
158
- startAfter: int = 0 # seconds
159
- count: Optional[int] = None # iters
157
+ delay: Optional[int] = None # seconds
158
+ startAfter: Optional[int] = None # seconds
159
+ count: Optional[int] = None # iters
160
+ cron: Optional[str] = None
161
+
162
+ def validate(self) -> None:
163
+ if self.cron is None:
164
+ assert self.delay is not None, "cron or delay should set"
165
+ else:
166
+ assert self.delay is None and self.startAfter is None and self.count is None, "should set cron or other"
160
167
 
161
168
 
162
169
  class Schedules(BaseModel):
@@ -189,11 +196,13 @@ class MainTask(BaseModel):
189
196
  profileMode: Optional[str] = None
190
197
  withLogs: bool = False # use only in prepare
191
198
  saveFails: bool = True
199
+ scaleCount: int = 1
192
200
  scaleInfo: List[ScaleInfo]
193
201
  component: TaskComponent
194
202
  policy: TaskPolicy
195
203
  schedule: Optional[Schedule] = None
196
204
  restrictions: Optional[Restrictions] = Restrictions()
205
+ tags: Optional[Dict[str, str]] = None
197
206
 
198
207
 
199
208
  class MainPipeline(BaseModel):
@@ -218,6 +227,8 @@ class MainPipeline(BaseModel):
218
227
  run: bool = True
219
228
  synthetic: bool = False
220
229
  saveFails: bool = True
230
+ scaleCount: int = 1
231
+ tags: Optional[Dict[str, str]] = None
221
232
 
222
233
 
223
234
  class RunTask(Operation):
@@ -319,6 +330,10 @@ class ResultUserCfg(BaseModel):
319
330
  id: Alias.Id
320
331
 
321
332
 
333
+ class ResultTags(BaseModel):
334
+ idToTags: Dict[str, Optional[Dict[str, str]]]
335
+
336
+
322
337
  # TODO add smth from Cfg
323
338
  class AppSettings(BaseModel):
324
339
  taskId: Optional[Alias.Id] = None
@@ -420,6 +435,7 @@ class FunctionInfo(BaseModel):
420
435
  arguments: List[Tuple[str, Optional[str]]]
421
436
  finishMsg: Optional[str] = None
422
437
  doc: Optional[str] = None
438
+ tags: Optional[Dict[str, str]] = None
423
439
 
424
440
 
425
441
  class InputFunctionInfo(FunctionInfo):
@@ -448,6 +464,7 @@ class InitInfo(BaseModel):
448
464
  prepare: bool
449
465
  argname: Optional[str] = None
450
466
  doc: Optional[str] = None
467
+ tags: Optional[Dict[str, str]] = None
451
468
 
452
469
 
453
470
  class AppFunctionsInfo(BaseModel):
@@ -649,3 +666,8 @@ class MCPTool(MCPToolSimple):
649
666
  class MCPToolCall(BaseModel):
650
667
  name: str
651
668
  arguments: Dict[str, Any]
669
+
670
+
671
+ class RunsFilter(BaseModel):
672
+ data: Optional[Dict[str, str]] = None
673
+ withTags: bool = False
@@ -1056,6 +1056,14 @@ async def get_run_activeRuns_async(*args, **kwargs) -> ResultIds:
1056
1056
  return model_from_json(await send_to_core_get_async(TEMP_RUN_ACTIVE_RUNS, *args, **kwargs), ResultIds)
1057
1057
 
1058
1058
 
1059
+ def post_run_activeRuns(data: RunsFilter, *args, **kwargs) -> Union[ResultIds, ResultTags]:
1060
+ return model_from_json(send_to_core_modify(TEMP_RUN_ACTIVE_RUNS, data, *args, **kwargs), ResultTags if data.withTags else ResultIds)
1061
+
1062
+
1063
+ async def post_run_activeRuns_async(data: RunsFilter, *args, **kwargs) -> Union[ResultIds, ResultTags]:
1064
+ return model_from_json(await send_to_core_modify_async(TEMP_RUN_ACTIVE_RUNS, data, *args, **kwargs), ResultTags if data.withTags else ResultIds)
1065
+
1066
+
1059
1067
  def get_run_mainTaskCfg(id: str, *args, **kwargs) -> MainTaskCfg:
1060
1068
  return model_from_json(send_to_core_get(TEMP_RUN_MAIN_TASK_CFG(id), *args, **kwargs), MainTaskCfg)
1061
1069
 
@@ -2846,20 +2846,30 @@ def get_run_condition(
2846
2846
 
2847
2847
 
2848
2848
  def get_run_active_runs(
2849
+ tags: Optional[Dict[str, str]] = None,
2850
+ with_tags: bool = False,
2849
2851
  *,
2850
2852
  auth: Optional[AUTH] = None,
2851
2853
  conn_url: Optional[str] = None,
2852
2854
  batcher: Optional[Batcher] = None,
2853
2855
  is_async: bool = False,
2854
- ) -> ResultIds:
2855
- """return list running operationIds"""
2856
+ ) -> Union[ResultIds, ResultTags]:
2857
+ """return list running operationIds, filter by tags if set, return id -> tags if with_tags"""
2856
2858
  if batcher is None:
2857
2859
  batcher = Config.BATCHER
2858
- if batcher is not None:
2859
- return batcher.add("getActiveRuns", result_model=ResultIds)
2860
- if is_async:
2861
- return f.get_run_activeRuns_async(auth=auth, conn_url=conn_url)
2862
- return f.get_run_activeRuns(auth=auth, conn_url=conn_url)
2860
+ if tags is not None or with_tags:
2861
+ data = RunsFilter(data=tags, withTags=with_tags)
2862
+ if batcher is not None:
2863
+ return batcher.add("postActiveRuns", data=data, result_model=ResultTags if with_tags else ResultIds)
2864
+ if is_async:
2865
+ return f.post_run_activeRuns_async(data, auth=auth, conn_url=conn_url)
2866
+ return f.post_run_activeRuns(data, auth=auth, conn_url=conn_url)
2867
+ else:
2868
+ if batcher is not None:
2869
+ return batcher.add("getActiveRuns", result_model=ResultIds)
2870
+ if is_async:
2871
+ return f.get_run_activeRuns_async(auth=auth, conn_url=conn_url)
2872
+ return f.get_run_activeRuns(auth=auth, conn_url=conn_url)
2863
2873
 
2864
2874
 
2865
2875
  def get_run_main_task_cfg(
@@ -3161,6 +3171,7 @@ def task_full(
3161
3171
  policy: TaskPolicy = None,
3162
3172
  schedule: Optional[Schedule] = None,
3163
3173
  restrictions: Optional[Restrictions] = None,
3174
+ tags: Optional[Dict[str, str]] = None,
3164
3175
  wait: bool = True,
3165
3176
  *,
3166
3177
  auth: Optional[AUTH] = None,
@@ -3188,6 +3199,8 @@ def task_full(
3188
3199
  restrictions: (Optional[Restrictions]): permissions to handle deployment
3189
3200
  wait (bool): is it worth waiting for the result or immediately return `operation_id`
3190
3201
  auth (Optional[AUTH]): redefined auth if not None"""
3202
+ if schedule is not None:
3203
+ schedule.validate()
3191
3204
  if batcher is None:
3192
3205
  batcher = Config.BATCHER
3193
3206
  if scaleInfo is None:
@@ -3217,6 +3230,7 @@ def task_full(
3217
3230
  policy=policy,
3218
3231
  schedule=schedule,
3219
3232
  restrictions=restrictions,
3233
+ tags=tags,
3220
3234
  )
3221
3235
  if batcher is not None:
3222
3236
  return batcher.add("sendTask", data=data, result_model=AppLogs)
@@ -3263,6 +3277,7 @@ def task_prepare(
3263
3277
  component: TaskComponent = None,
3264
3278
  policy: TaskPolicy = None,
3265
3279
  restrictions: Optional[Restrictions] = None,
3280
+ tags: Optional[Dict[str, str]] = None,
3266
3281
  wait: bool = True,
3267
3282
  *,
3268
3283
  auth: Optional[AUTH] = None,
@@ -3332,6 +3347,7 @@ def task_prepare(
3332
3347
  component=component,
3333
3348
  policy=policy,
3334
3349
  restrictions=restrictions,
3350
+ tags=tags,
3335
3351
  )
3336
3352
  if batcher is not None:
3337
3353
  return batcher.add("sendTask", data=data, result_model=AppLogs)
@@ -3393,6 +3409,8 @@ def task_run(
3393
3409
  schedule: (Optional[Schedule]): schedule task runs settings - return scheduleId instead of operationId
3394
3410
  wait (bool): is it worth waiting for the result or immediately return `operation_id`
3395
3411
  auth (Optional[AUTH]): redefined auth if not None"""
3412
+ if schedule is not None:
3413
+ schedule.validate()
3396
3414
  if batcher is None:
3397
3415
  batcher = Config.BATCHER
3398
3416
  if run_id is None:
@@ -3447,6 +3465,7 @@ def pipeline_full(
3447
3465
  restrictions: Optional[Restrictions] = None,
3448
3466
  scaleInfo: List[ScaleInfo] = None,
3449
3467
  save_fails: bool = True,
3468
+ tags: Optional[Dict[str, str]] = None,
3450
3469
  with_show: bool = True,
3451
3470
  long: bool = False,
3452
3471
  long_timeout: Optional[int] = WAIT_RESULT_TIMEOUT,
@@ -3458,6 +3477,8 @@ def pipeline_full(
3458
3477
  batcher: Optional[Batcher] = None,
3459
3478
  is_async: bool = False,
3460
3479
  ) -> Union[Alias.Id, AppLogs]:
3480
+ if schedule is not None:
3481
+ schedule.validate()
3461
3482
  if batcher is None:
3462
3483
  batcher = Config.BATCHER
3463
3484
  if scaleInfo is None:
@@ -3489,6 +3510,8 @@ def pipeline_full(
3489
3510
  kafkaModeUrl=None,
3490
3511
  run=True,
3491
3512
  saveFails=save_fails,
3513
+ scaleCount=1,
3514
+ tags=tags,
3492
3515
  )
3493
3516
  if batcher is not None:
3494
3517
  return batcher.add("sendPipeline", data=data, result_model=AppLogs)
@@ -3535,6 +3558,8 @@ def pipeline_prepare(
3535
3558
  kafka_mode_url_response: Optional[str] = None,
3536
3559
  synthetic: bool = False,
3537
3560
  save_fails: bool = True,
3561
+ scale_count: int = 1,
3562
+ tags: Optional[Dict[str, str]] = None,
3538
3563
  with_show: bool = True,
3539
3564
  long: bool = False,
3540
3565
  long_timeout: Optional[int] = WAIT_RESULT_TIMEOUT,
@@ -3577,6 +3602,8 @@ def pipeline_prepare(
3577
3602
  run=False,
3578
3603
  synthetic=synthetic,
3579
3604
  saveFails=save_fails,
3605
+ scaleCount=scale_count,
3606
+ tags=tags,
3580
3607
  )
3581
3608
  if batcher is not None:
3582
3609
  return batcher.add("sendPipeline", data=data, result_model=AppLogs)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: malevich-coretools
3
- Version: 0.3.45
3
+ Version: 0.3.47
4
4
  Author: Andrew Pogrebnoj
5
5
  Author-email: andrew@onjulius.co
6
6
  License-File: LICENSE
@@ -1,7 +1,7 @@
1
1
  malevich_coretools/__init__.py,sha256=DJtPESxkCZD2SbTZTrR_x0TKDQ4MJpmBqGw5YpKYidM,134
2
- malevich_coretools/utils.py,sha256=OlwY4ivtozu6JoXateYrnJ6bMX9JTEBdnNC8JXdsXEo,150106
2
+ malevich_coretools/utils.py,sha256=frBqEnAbY6iUmYOsvbT_RQnczI6Vd-TRaODuNv2o9RA,151198
3
3
  malevich_coretools/abstract/__init__.py,sha256=6vQ08c8HPYyT_pPkKlc-EwQKE8xG3HTEo2p_GiI5rik,142
4
- malevich_coretools/abstract/abstract.py,sha256=4WtqG1PaZSztnbwWYScCSzwk7gL57AJfQ_WCWIUGpho,15684
4
+ malevich_coretools/abstract/abstract.py,sha256=EtA80K_mk-PkK8oBmP7VpsR1YRDdAb382tMiSlyjZTc,16388
5
5
  malevich_coretools/abstract/operations.py,sha256=cWlo2xzW-rzkTInzpDjBYeL68KfLYqSpZJRzCQ4OzjA,3070
6
6
  malevich_coretools/abstract/pipeline.py,sha256=HwhYp5G9yaZYaeDypChfpNd2W-kmJQfM9I54uek0B9k,7914
7
7
  malevich_coretools/abstract/statuses.py,sha256=9ISSw_evsylBshLXoU44TCoFOrZm4bXIxyAFFDqdUWc,333
@@ -11,7 +11,7 @@ malevich_coretools/batch/__init__.py,sha256=taxyZl8YOZd2EBd3leN6slzMkejUtjQ64Na3
11
11
  malevich_coretools/batch/utils.py,sha256=FRmCYU-zr-RjgT1Mo3CUNcB2mW1t_gKCJazcMx6aIW4,7719
12
12
  malevich_coretools/funcs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  malevich_coretools/funcs/checks.py,sha256=Q5pRtRevQrGv_-SMbn2GgYnulhclDLBXdRtbw2QOYKU,223
14
- malevich_coretools/funcs/funcs.py,sha256=Ht9WChcF8vQaKU0FeQFdX0VjdYTEnau7zYTK2pJnMzM,82252
14
+ malevich_coretools/funcs/funcs.py,sha256=DLellIap5bGejIKsIHIPJE6hlSdee_s8mKmpiO7yZ0I,82738
15
15
  malevich_coretools/funcs/helpers.py,sha256=hKLES296_hrINOIGLJuRi1XvI-vLccmQKL0Y_32iffU,11411
16
16
  malevich_coretools/secondary/__init__.py,sha256=048HqvG36_1WdDVZK_RuECmaf14Iq2fviUysG1inlaE,78
17
17
  malevich_coretools/secondary/config.py,sha256=hRlSJuPQnhKyt1wmOAJX_XmcliaO0fPGbW94AE_Mazs,463
@@ -21,8 +21,8 @@ malevich_coretools/secondary/kafka_utils.py,sha256=SIUnBFyfwsquN6MAUrEkKCw-1l797
21
21
  malevich_coretools/tools/__init__.py,sha256=jDxlCa5Dr6Y43qlI7JwsRAlBkKmFeTHTEnjNUvu-0iw,46
22
22
  malevich_coretools/tools/abstract.py,sha256=B1RW1FeNHrQ6r1k-cQZ4k4noCRXkIGt-JUwVoXEDkAg,4466
23
23
  malevich_coretools/tools/vast.py,sha256=63tvy70qQV9vnK0eWytlgjBGSnfA7l3kSIDgACBbMMs,12893
24
- malevich_coretools-0.3.45.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
25
- malevich_coretools-0.3.45.dist-info/METADATA,sha256=0USgUH9IwYJaf6M52tW6vey7-_m8Iu4xDqQ5V_PhjV4,347
26
- malevich_coretools-0.3.45.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
27
- malevich_coretools-0.3.45.dist-info/top_level.txt,sha256=wDX3s1Tso0otBPNrFRfXqyNpm48W4Bp5v6JfbITO2Z8,19
28
- malevich_coretools-0.3.45.dist-info/RECORD,,
24
+ malevich_coretools-0.3.47.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
25
+ malevich_coretools-0.3.47.dist-info/METADATA,sha256=P-bhnS-PLZtBopMVlAlJFcD5ODFVHSmqPxjtezRCFAI,347
26
+ malevich_coretools-0.3.47.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
27
+ malevich_coretools-0.3.47.dist-info/top_level.txt,sha256=wDX3s1Tso0otBPNrFRfXqyNpm48W4Bp5v6JfbITO2Z8,19
28
+ malevich_coretools-0.3.47.dist-info/RECORD,,