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

@@ -505,6 +505,7 @@ class RunSettings(BaseModel):
505
505
  class Endpoint(BaseModel):
506
506
  hash: Optional[Alias.Id] = None
507
507
  taskId: Optional[Alias.Id] = None
508
+ pipelineId: Optional[Alias.Id] = None # should set taskId or pipelineId
508
509
  cfgId: Optional[Alias.Id] = None
509
510
  sla: Optional[str] = None
510
511
  active: Optional[bool] = None
@@ -604,3 +605,14 @@ class LimitsScope(BaseModel): # for superuser/admin
604
605
  assetsLimit: Optional[int] = None
605
606
  allowCommonGpu: Optional[bool] = None
606
607
  gpuDiskMax: Optional[int] = None
608
+
609
+
610
+ class UserAnalytics(BaseModel):
611
+ name: str
612
+ data: Dict[str, Any]
613
+ timestamp: Optional[str] = None
614
+ id: Optional[str] = None
615
+
616
+
617
+ class UserAnalyticsBatch(BaseModel):
618
+ data: List[UserAnalytics]
@@ -92,6 +92,10 @@ def post_collections_data(data: DocsDataCollection, wait: bool=True, *args, **kw
92
92
  return send_to_core_modify(COLLECTIONS_DATA(wait), data, *args, **kwargs)
93
93
 
94
94
 
95
+ def post_collections_data_id(id: str, data: DocsDataCollection, wait: bool=True, *args, **kwargs) -> Alias.Id:
96
+ return send_to_core_modify(COLLECTIONS_DATA_ID(id, wait), data, *args, **kwargs)
97
+
98
+
95
99
  def post_collections_id_add(id: str, data: DocsCollectionChange, wait: bool, *args, **kwargs) -> Alias.Info:
96
100
  return send_to_core_modify(COLLECTIONS_ID_ADD(id, wait), data, *args, **kwargs)
97
101
 
@@ -386,6 +390,10 @@ def get_userApps_mapIds(*args, **kwargs) -> ResultOwnAndSharedIdsMap:
386
390
  return model_from_json(send_to_core_get(USER_APPS_MAP_IDS, *args, **kwargs), ResultOwnAndSharedIdsMap)
387
391
 
388
392
 
393
+ def get_userApps_mapId(id, *args, **kwargs) -> Alias.Id:
394
+ return send_to_core_get(USER_APPS_MAP_ID(id), is_text=True, *args, **kwargs)
395
+
396
+
389
397
  def get_userApps_id(id: str, *args, **kwargs) -> UserApp:
390
398
  return model_from_json(send_to_core_get(USER_APPS_ID(id, None), *args, **kwargs), UserApp)
391
399
 
@@ -424,6 +432,10 @@ def get_userTasks_mapIds(*args, **kwargs) -> ResultIdsMap:
424
432
  return model_from_json(send_to_core_get(USER_TASKS_MAP_IDS, *args, **kwargs), ResultIdsMap)
425
433
 
426
434
 
435
+ def get_userTasks_mapId(id: str, *args, **kwargs) -> Alias.Id:
436
+ return send_to_core_get(USER_TASKS_MAP_ID(id), is_text=True, *args, **kwargs)
437
+
438
+
427
439
  def get_userTasks_id(id: str, *args, **kwargs) -> UserTask:
428
440
  return model_from_json(send_to_core_get(USER_TASKS_ID(id, None), *args, **kwargs), UserTask)
429
441
 
@@ -462,6 +474,10 @@ def get_userPipelines_mapIds(*args, **kwargs) -> ResultIdsMap:
462
474
  return model_from_json(send_to_core_get(USER_PIPELINES_MAP_IDS, *args, **kwargs), ResultIdsMap)
463
475
 
464
476
 
477
+ def get_userPipelines_mapId(id: str, *args, **kwargs) -> Alias.Id:
478
+ return send_to_core_get(USER_PIPELINES_MAP_ID(id), is_text=True, *args, **kwargs)
479
+
480
+
465
481
  def get_userPipelines_id(id: str, *args, **kwargs) -> Pipeline:
466
482
  return model_from_json(send_to_core_get(USER_PIPELINES_ID(id, None), *args, **kwargs), Pipeline)
467
483
 
@@ -500,6 +516,10 @@ def get_userCfgs_mapIds(*args, **kwargs) -> ResultIdsMap:
500
516
  return model_from_json(send_to_core_get(USER_CFGS_MAP_IDS, *args, **kwargs), ResultIdsMap)
501
517
 
502
518
 
519
+ def get_userCfgs_mapId(id: str, *args, **kwargs) -> Alias.Id:
520
+ return send_to_core_get(USER_CFGS_MAP_ID(id), is_text=True, *args, **kwargs)
521
+
522
+
503
523
  def get_userCfgs_id(id: str, *args, **kwargs) -> ResultUserCfg:
504
524
  return model_from_json(send_to_core_get(USER_CFGS_ID(id, None), *args, **kwargs), ResultUserCfg)
505
525
 
@@ -716,6 +736,26 @@ def post_handler_url(url: Optional[str], wait: bool, *args, **kwargs) -> Alias.I
716
736
  return send_to_core_modify(HANDLER_URL(url, wait), *args, **kwargs)
717
737
 
718
738
 
739
+ def get_analytics(*args, **kwargs) -> UserAnalyticsBatch:
740
+ return model_from_json(send_to_core_get(ANALYTICS(None), *args, **kwargs), UserAnalyticsBatch)
741
+
742
+
743
+ def get_analytics_by_id(id: str, *args, **kwargs) -> UserAnalytics:
744
+ return model_from_json(send_to_core_get(ANALYTICS_ID(id, None), *args, **kwargs), UserAnalytics)
745
+
746
+
747
+ def get_analytics_by_name(name: str, *args, **kwargs) -> UserAnalyticsBatch:
748
+ return model_from_json(send_to_core_get(ANALYTICS_NAME(name, None), *args, **kwargs), UserAnalyticsBatch)
749
+
750
+
751
+ def post_analytics(data: UserAnalytics, wait: bool, *args, **kwargs) -> Alias.Id:
752
+ return send_to_core_modify(ANALYTICS(wait), data, *args, **kwargs)
753
+
754
+
755
+ def post_analytics_many(data: UserAnalyticsBatch, wait: bool, *args, **kwargs) -> ResultIds:
756
+ return model_from_json(send_to_core_modify(ANALYTICS_MANY(wait), data, *args, **kwargs), ResultIds)
757
+
758
+
719
759
  async def kafka_send(data: KafkaMsg, *args, **kwargs) -> Union[Alias.Info, KafkaMsg]:
720
760
  result = await send_to_core_post_async(KAFKA_SEND, data, *args, **kwargs)
721
761
  try:
@@ -21,10 +21,13 @@ from malevich_coretools.abstract.abstract import (
21
21
  )
22
22
  from malevich_coretools.batch import Batcher
23
23
  from malevich_coretools.funcs.checks import check_profile_mode
24
- from malevich_coretools.funcs.funcs import post_collections_data
24
+ from malevich_coretools.funcs.funcs import (
25
+ post_collections_data,
26
+ post_collections_data_id,
27
+ )
25
28
  from malevich_coretools.secondary import Config, to_json
26
29
 
27
- __all__ = ["create_collection_from_file_df", "raw_collection_from_df", "raw_collection_from_file", "create_collection_from_df", "create_app_settings", "create_user_config", "create_task_component", "create_task_policy", "create_restrictions", "create_run_settings", "create_endpoint_override", "create_cfg_struct"]
30
+ __all__ = ["create_collection_from_file_df", "update_collection_from_file_df", "raw_collection_from_df", "raw_collection_from_file", "create_collection_from_df", "update_collection_from_df", "create_app_settings", "create_user_config", "create_task_component", "create_task_policy", "create_restrictions", "create_run_settings", "create_endpoint_override", "create_cfg_struct"]
28
31
 
29
32
 
30
33
  def create_collection_from_file_df(
@@ -43,6 +46,23 @@ def create_collection_from_file_df(
43
46
  return create_collection_from_df(data, name=file, metadata=metadata, *args, **kwargs)
44
47
 
45
48
 
49
+ def update_collection_from_file_df(
50
+ id: str,
51
+ file: str,
52
+ name: Optional[str],
53
+ metadata: Optional[Union[Dict[str, Any], str]],
54
+ *args,
55
+ **kwargs
56
+ ) -> Alias.Id:
57
+ try:
58
+ data = pd.read_csv(file)
59
+ except pd.errors.EmptyDataError:
60
+ data = pd.DataFrame()
61
+ if name is None:
62
+ name = file
63
+ return update_collection_from_df(id, data, name=file, metadata=metadata, *args, **kwargs)
64
+
65
+
46
66
  def raw_collection_from_df(
47
67
  data: pd.DataFrame,
48
68
  name: Optional[str],
@@ -89,6 +109,23 @@ def create_collection_from_df(
89
109
  return post_collections_data(data, *args, **kwargs)
90
110
 
91
111
 
112
+ def update_collection_from_df(
113
+ id: str,
114
+ data: pd.DataFrame,
115
+ name: Optional[str],
116
+ metadata: Optional[Union[Dict[str, Any], str]],
117
+ batcher: Optional[Batcher] = None,
118
+ *args,
119
+ **kwargs
120
+ ) -> Alias.Id:
121
+ if batcher is None:
122
+ batcher = Config.BATCHER
123
+ data = raw_collection_from_df(data, name, metadata)
124
+ if batcher is not None:
125
+ return batcher.add("postCollectionByDocsAndId", data=data, vars={"id": id})
126
+ return post_collections_data_id(id, data, *args, **kwargs)
127
+
128
+
92
129
  def create_app_settings(
93
130
  app_id: str,
94
131
  task_id: Optional[str] = None,
@@ -55,6 +55,7 @@ COLLECTIONS_ID_ADD = lambda id, wait: with_wait(f"{COLLECTIONS_MAIN}/{urllib.par
55
55
  COLLECTIONS_ID_COPY = lambda id, full_copy, wait: with_key_values(f"{COLLECTIONS_MAIN}/{urllib.parse.quote(str(id), safe='')}/copy", {"wait": None if wait is None else bool_to_str(wait), "fullCopy": None if full_copy is None else bool_to_str(full_copy)})
56
56
  COLLECTIONS_ID_DEL = lambda id, wait: with_wait(f"{COLLECTIONS_MAIN}/{urllib.parse.quote(str(id), safe='')}/del", wait)
57
57
  COLLECTIONS_DATA = lambda wait: with_wait(f"{COLLECTIONS_MAIN}/data", wait)
58
+ COLLECTIONS_DATA_ID = lambda id, wait: with_wait(f"{COLLECTIONS_MAIN}/data/{urllib.parse.quote(str(id), safe='')}", wait)
58
59
  COLLECTIONS_APPLY_SCHEME = lambda id, wait: with_wait(f"{COLLECTIONS_MAIN}/{urllib.parse.quote(str(id), safe='')}/applyScheme", wait)
59
60
  COLLECTIONS_FIX_SCHEME = lambda id, wait: with_wait(f"{COLLECTIONS_MAIN}/{urllib.parse.quote(str(id), safe='')}/fixScheme", wait)
60
61
  COLLECTIONS_UNFIX_SCHEME = lambda id, wait: with_wait(f"{COLLECTIONS_MAIN}/{urllib.parse.quote(str(id), safe='')}/unfixScheme", wait)
@@ -115,6 +116,7 @@ USER_APPS_MAIN = f"{API_VERSION}/userApps"
115
116
  USER_APPS = lambda wait: with_wait(f"{USER_APPS_MAIN}/", wait)
116
117
  USER_APPS_REAL_IDS = f"{USER_APPS_MAIN}/realIds"
117
118
  USER_APPS_MAP_IDS = f"{USER_APPS_MAIN}/mapIds"
119
+ USER_APPS_MAP_ID = lambda id: f"{USER_APPS_MAIN}/mapIds/{urllib.parse.quote(str(id), safe='')}"
118
120
  USER_APPS_ID = lambda id, wait: with_wait(f"{USER_APPS_MAIN}/{urllib.parse.quote(str(id), safe='')}", wait)
119
121
  USER_APPS_REAL_ID = lambda id: f"{USER_APPS_MAIN}/realIds/{urllib.parse.quote(str(id), safe='')}"
120
122
 
@@ -123,6 +125,7 @@ USER_TASKS_MAIN = f"{API_VERSION}/userTasks"
123
125
  USER_TASKS = lambda wait: with_wait(f"{USER_TASKS_MAIN}/", wait)
124
126
  USER_TASKS_REAL_IDS = f"{USER_TASKS_MAIN}/realIds"
125
127
  USER_TASKS_MAP_IDS = f"{USER_TASKS_MAIN}/mapIds"
128
+ USER_TASKS_MAP_ID = lambda id: f"{USER_TASKS_MAIN}/mapIds/{urllib.parse.quote(str(id), safe='')}"
126
129
  USER_TASKS_ID = lambda id, wait: with_wait(f"{USER_TASKS_MAIN}/{urllib.parse.quote(str(id), safe='')}", wait)
127
130
  USER_TASKS_REAL_ID = lambda id: f"{USER_TASKS_MAIN}/realIds/{urllib.parse.quote(str(id), safe='')}"
128
131
 
@@ -131,6 +134,7 @@ USER_PIPELINES_MAIN = f"{API_VERSION}/userPipelines"
131
134
  USER_PIPELINES = lambda wait: with_wait(f"{USER_PIPELINES_MAIN}/", wait)
132
135
  USER_PIPELINES_REAL_IDS = f"{USER_PIPELINES_MAIN}/realIds"
133
136
  USER_PIPELINES_MAP_IDS = f"{USER_PIPELINES_MAIN}/mapIds"
137
+ USER_PIPELINES_MAP_ID = lambda id: f"{USER_PIPELINES_MAIN}/mapIds/{urllib.parse.quote(str(id), safe='')}"
134
138
  USER_PIPELINES_ID = lambda id, wait: with_wait(f"{USER_PIPELINES_MAIN}/{urllib.parse.quote(str(id), safe='')}", wait)
135
139
  USER_PIPELINES_REAL_ID = lambda id: f"{USER_PIPELINES_MAIN}/realIds/{urllib.parse.quote(str(id), safe='')}"
136
140
 
@@ -139,6 +143,7 @@ USER_CFGS_MAIN = f"{API_VERSION}/userCfgs"
139
143
  USER_CFGS = lambda wait: with_wait(f"{USER_CFGS_MAIN}/", wait)
140
144
  USER_CFGS_REAL_IDS = f"{USER_CFGS_MAIN}/realIds"
141
145
  USER_CFGS_MAP_IDS = f"{USER_CFGS_MAIN}/mapIds"
146
+ USER_CFGS_MAP_ID = lambda id: f"{USER_CFGS_MAIN}/mapIds/{urllib.parse.quote(str(id), safe='')}"
142
147
  USER_CFGS_ID = lambda id, wait: with_wait(f"{USER_CFGS_MAIN}/{urllib.parse.quote(str(id), safe='')}", wait)
143
148
  USER_CFGS_REAL_ID = lambda id: f"{USER_CFGS_MAIN}/realIds/{urllib.parse.quote(str(id), safe='')}"
144
149
 
@@ -192,6 +197,13 @@ LIMITS_USER = lambda wait: with_wait(f"{LIMITS_MAIN}/user", wait)
192
197
  HANDLER_URL_MAIN = f"{API_VERSION}/handlerUrls"
193
198
  HANDLER_URL = lambda url, wait: with_key_values(f"{HANDLER_URL_MAIN}/", {"url": url, "wait": bool_to_str(wait)})
194
199
 
200
+ ## AnalyticsController
201
+ ANALYTICS_MAIN = f"{API_VERSION}/analytics"
202
+ ANALYTICS = lambda wait: with_wait(f"{ANALYTICS_MAIN}/", wait)
203
+ ANALYTICS_MANY = lambda wait: with_wait(f"{ANALYTICS_MAIN}/many", wait)
204
+ ANALYTICS_ID = lambda id, wait: with_wait(f"{ANALYTICS_MAIN}/{id}", wait)
205
+ ANALYTICS_NAME = lambda name, wait: with_wait(f"{ANALYTICS_MAIN}/name/{name}", wait)
206
+
195
207
  ### Kafka
196
208
  KAFKA_SEND = f"{MANAGER_MAIN}/kafkaMsg"
197
209
 
@@ -456,6 +456,32 @@ def create_collection_by_docs(
456
456
  )
457
457
 
458
458
 
459
+ def update_collection_by_docs(
460
+ id: str,
461
+ docs: List[Alias.Json],
462
+ name: Optional[str] = None,
463
+ metadata: Optional[str] = None,
464
+ wait: bool = True,
465
+ *,
466
+ auth: Optional[AUTH] = None,
467
+ conn_url: Optional[str] = None,
468
+ batcher: Optional[Batcher] = None,
469
+ ) -> Alias.Id:
470
+ """update collection by `id` with `docs`, return `id` """
471
+ if batcher is None:
472
+ batcher = Config.BATCHER
473
+ data = DocsDataCollection(data=docs, name=name, metadata=metadata)
474
+ if batcher is not None:
475
+ return batcher.add("postCollectionByDocsAndId", data=data, vars={"id": id})
476
+ return f.post_collections_data_id(
477
+ id,
478
+ data,
479
+ wait=wait,
480
+ auth=auth,
481
+ conn_url=conn_url,
482
+ )
483
+
484
+
459
485
  def add_to_collection(
460
486
  id: str,
461
487
  ids: List[str],
@@ -870,6 +896,7 @@ def run_endpoint(
870
896
 
871
897
  def create_endpoint(
872
898
  task_id: Optional[str] = None,
899
+ pipeline_id: Optional[str] = None,
873
900
  cfg_id: Optional[str] = None,
874
901
  sla: Optional[str] = None,
875
902
  active: Optional[bool] = None,
@@ -885,9 +912,10 @@ def create_endpoint(
885
912
  batcher: Optional[Batcher] = None,
886
913
  ) -> Alias.Id:
887
914
  """create endpoint, return hash, url - api/v1/endpoints/run/{hash}. fields may not be initialized - this will only cause an error at startup"""
915
+ assert task_id is None or pipeline_id is None, "endpoint should be defined in one way"
888
916
  if batcher is None:
889
917
  batcher = Config.BATCHER
890
- data = Endpoint(taskId=task_id, cfgId=cfg_id, sla=sla, active=active, prepare=prepare, runSettings=run_settings,
918
+ data = Endpoint(taskId=task_id, pipelineId=pipeline_id, cfgId=cfg_id, sla=sla, active=active, prepare=prepare, runSettings=run_settings,
891
919
  enableNotAuthorized=enable_not_auth, expectedCollectionsWithSchemes=expected_colls_with_schemes, description=description)
892
920
  if batcher is not None:
893
921
  return batcher.add("postEndpointCreate", data=data)
@@ -897,6 +925,7 @@ def create_endpoint(
897
925
  def update_endpoint(
898
926
  hash: str,
899
927
  task_id: Optional[str] = None,
928
+ pipeline_id: Optional[str] = None,
900
929
  cfg_id: Optional[str] = None,
901
930
  sla: Optional[str] = None,
902
931
  active: Optional[bool] = None,
@@ -912,9 +941,10 @@ def update_endpoint(
912
941
  batcher: Optional[Batcher] = None,
913
942
  ) -> Alias.Id:
914
943
  """update endpoint, return hash, url - api/v1/endpoints/run/{hash}. update field if it is not None"""
944
+ assert task_id is None or pipeline_id is None, "endpoint should be defined in one way"
915
945
  if batcher is None:
916
946
  batcher = Config.BATCHER
917
- data = Endpoint(hash=hash, taskId=task_id, cfgId=cfg_id, sla=sla, active=active, prepare=prepare, runSettings=run_settings,
947
+ data = Endpoint(hash=hash, taskId=task_id, pipelineId=pipeline_id, cfgId=cfg_id, sla=sla, active=active, prepare=prepare, runSettings=run_settings,
918
948
  enableNotAuthorized=enable_not_auth, expectedCollectionsWithSchemes=expected_colls_with_schemes, description=description)
919
949
  if batcher is not None:
920
950
  return batcher.add("postEndpointUpdate", data=data)
@@ -1542,6 +1572,21 @@ def get_apps_map(
1542
1572
  return f.get_userApps_mapIds(auth=auth, conn_url=conn_url)
1543
1573
 
1544
1574
 
1575
+ def get_app_map(
1576
+ id: str,
1577
+ *,
1578
+ auth: Optional[AUTH] = None,
1579
+ conn_url: Optional[str] = None,
1580
+ batcher: Optional[Batcher] = None,
1581
+ ) -> Alias.Id:
1582
+ """return real id by app id for current user"""
1583
+ if batcher is None:
1584
+ batcher = Config.BATCHER
1585
+ if batcher is not None:
1586
+ return batcher.add("getAppsMapIdsById", vars={"id": id})
1587
+ return f.get_userApps_mapId(id, auth=auth, conn_url=conn_url)
1588
+
1589
+
1545
1590
  def get_app(
1546
1591
  id: str,
1547
1592
  *,
@@ -1754,6 +1799,21 @@ def get_tasks_map(
1754
1799
  return f.get_userTasks_mapIds(auth=auth, conn_url=conn_url)
1755
1800
 
1756
1801
 
1802
+ def get_task_map(
1803
+ id: str,
1804
+ *,
1805
+ auth: Optional[AUTH] = None,
1806
+ conn_url: Optional[str] = None,
1807
+ batcher: Optional[Batcher] = None,
1808
+ ) -> Alias.Id:
1809
+ """return real id by task id for current user"""
1810
+ if batcher is None:
1811
+ batcher = Config.BATCHER
1812
+ if batcher is not None:
1813
+ return batcher.add("getTasksMapIdsById", vars={"id": id})
1814
+ return f.get_userTasks_mapId(id, auth=auth, conn_url=conn_url)
1815
+
1816
+
1757
1817
  def get_task(
1758
1818
  id: str,
1759
1819
  *,
@@ -1925,6 +1985,21 @@ def get_pipelines_map(
1925
1985
  return f.get_userPipelines_mapIds(auth=auth, conn_url=conn_url)
1926
1986
 
1927
1987
 
1988
+ def get_pipeline_map(
1989
+ id: str,
1990
+ *,
1991
+ auth: Optional[AUTH] = None,
1992
+ conn_url: Optional[str] = None,
1993
+ batcher: Optional[Batcher] = None,
1994
+ ) -> Alias.Id:
1995
+ """return real id by pipeline id for current user"""
1996
+ if batcher is None:
1997
+ batcher = Config.BATCHER
1998
+ if batcher is not None:
1999
+ return batcher.add("getPipelinesMapIdsById", vars={"id": id})
2000
+ return f.get_userPipelines_mapId(id, auth=auth, conn_url=conn_url)
2001
+
2002
+
1928
2003
  def get_pipeline(
1929
2004
  id: str,
1930
2005
  *,
@@ -2098,6 +2173,22 @@ def get_cfgs_map(
2098
2173
  return f.get_userCfgs_mapIds(auth=auth, conn_url=conn_url)
2099
2174
 
2100
2175
 
2176
+
2177
+ def get_cfg_map(
2178
+ id: str,
2179
+ *,
2180
+ auth: Optional[AUTH] = None,
2181
+ conn_url: Optional[str] = None,
2182
+ batcher: Optional[Batcher] = None,
2183
+ ) -> Alias.Id:
2184
+ """return real id by cfg id for current user"""
2185
+ if batcher is None:
2186
+ batcher = Config.BATCHER
2187
+ if batcher is not None:
2188
+ return batcher.add("getCfgsMapIdsById", vars={"id": id})
2189
+ return f.get_userCfgs_mapId(id, auth=auth, conn_url=conn_url)
2190
+
2191
+
2101
2192
  def get_cfg(
2102
2193
  id: str,
2103
2194
  *,
@@ -3211,6 +3302,115 @@ def update_user_handler_url(
3211
3302
  )
3212
3303
 
3213
3304
 
3305
+ # Analytics
3306
+
3307
+
3308
+ def get_analytics(
3309
+ *,
3310
+ auth: Optional[AUTH] = None,
3311
+ conn_url: Optional[str] = None,
3312
+ batcher: Optional[Batcher] = None,
3313
+ ) -> UserAnalyticsBatch:
3314
+ """return all analytics for current user """
3315
+ if batcher is None:
3316
+ batcher = Config.BATCHER
3317
+ if batcher is not None:
3318
+ return batcher.add("getAnalytics", result_model=UserAnalyticsBatch)
3319
+ return f.get_analytics(auth=auth, conn_url=conn_url)
3320
+
3321
+
3322
+ def get_analytics_by_id(
3323
+ id: str,
3324
+ *,
3325
+ auth: Optional[AUTH] = None,
3326
+ conn_url: Optional[str] = None,
3327
+ batcher: Optional[Batcher] = None,
3328
+ ) -> UserAnalytics:
3329
+ """return analytics by `id` """
3330
+ if batcher is None:
3331
+ batcher = Config.BATCHER
3332
+ if batcher is not None:
3333
+ return batcher.add("getAnalyticsById", vars={"id": id}, result_model=UserAnalytics)
3334
+ return f.get_analytics_by_id(id, auth=auth, conn_url=conn_url)
3335
+
3336
+
3337
+ def get_analytics_by_name(
3338
+ name: str,
3339
+ *,
3340
+ auth: Optional[AUTH] = None,
3341
+ conn_url: Optional[str] = None,
3342
+ batcher: Optional[Batcher] = None,
3343
+ ) -> UserAnalyticsBatch:
3344
+ """return analytics by `name` """
3345
+ if batcher is None:
3346
+ batcher = Config.BATCHER
3347
+ if batcher is not None:
3348
+ return batcher.add("getAnalyticsByName", vars={"name": name}, result_model=UserAnalyticsBatch)
3349
+ return f.get_analytics_by_name(name, auth=auth, conn_url=conn_url)
3350
+
3351
+
3352
+ def create_analytics(
3353
+ data: Dict[str, Any],
3354
+ name: str,
3355
+ timestamp: Optional[str] = None,
3356
+ wait: bool = True,
3357
+ *,
3358
+ auth: Optional[AUTH] = None,
3359
+ conn_url: Optional[str] = None,
3360
+ batcher: Optional[Batcher] = None,
3361
+ ) -> Alias.Id:
3362
+ """save analytics with `data`, `name` and `timestamp`, return `id` """
3363
+ if batcher is None:
3364
+ batcher = Config.BATCHER
3365
+ data = UserAnalytics(name=name, data=data, timestamp=timestamp)
3366
+ if batcher is not None:
3367
+ return batcher.add("postAnalytics", data=data)
3368
+ return f.post_analytics(
3369
+ data, wait=wait, auth=auth, conn_url=conn_url
3370
+ )
3371
+
3372
+
3373
+ def update_analytics(
3374
+ id: str,
3375
+ data: Dict[str, Any],
3376
+ name: str,
3377
+ timestamp: Optional[str] = None,
3378
+ wait: bool = True,
3379
+ *,
3380
+ auth: Optional[AUTH] = None,
3381
+ conn_url: Optional[str] = None,
3382
+ batcher: Optional[Batcher] = None,
3383
+ ) -> Alias.Id:
3384
+ """update analytics by `id` with `data`, `name` and `timestamp`, return `id` """
3385
+ if batcher is None:
3386
+ batcher = Config.BATCHER
3387
+ data = UserAnalytics(name=name, data=data, timestamp=timestamp, id=id)
3388
+ if batcher is not None:
3389
+ return batcher.add("postAnalytics", data=data)
3390
+ return f.post_analytics(
3391
+ data, wait=wait, auth=auth, conn_url=conn_url
3392
+ )
3393
+
3394
+
3395
+ def update_analytics_many(
3396
+ data: List[UserAnalytics],
3397
+ wait: bool = True,
3398
+ *,
3399
+ auth: Optional[AUTH] = None,
3400
+ conn_url: Optional[str] = None,
3401
+ batcher: Optional[Batcher] = None,
3402
+ ) -> ResultIds:
3403
+ """update analytics by list of UserAnalytics, return ResultIds """
3404
+ if batcher is None:
3405
+ batcher = Config.BATCHER
3406
+ data = UserAnalyticsBatch(data=data)
3407
+ if batcher is not None:
3408
+ return batcher.add("postAnalyticsMany", data=data, result_model=ResultIds)
3409
+ return f.post_analytics_many(
3410
+ data, wait=wait, auth=auth, conn_url=conn_url
3411
+ )
3412
+
3413
+
3214
3414
  # kafka
3215
3415
 
3216
3416
 
@@ -3271,6 +3471,23 @@ def create_collection_from_file(
3271
3471
  )
3272
3472
 
3273
3473
 
3474
+ def update_collection_from_file(
3475
+ id: str,
3476
+ filename: str,
3477
+ name: Optional[str] = None,
3478
+ metadata: Optional[Union[Dict[str, Any], str]] = None,
3479
+ *,
3480
+ auth: Optional[AUTH] = None,
3481
+ conn_url: Optional[str] = None,
3482
+ batcher: Optional[Batcher] = None,
3483
+ ) -> Alias.Id:
3484
+ """create collection\n
3485
+ return collection id"""
3486
+ return fh.update_collection_from_file_df(
3487
+ id, filename, name, metadata, auth=auth, conn_url=conn_url, batcher=batcher
3488
+ )
3489
+
3490
+
3274
3491
  def create_collection_from_df(
3275
3492
  data: pd.DataFrame,
3276
3493
  name: Optional[str] = None,
@@ -3287,6 +3504,23 @@ def create_collection_from_df(
3287
3504
  )
3288
3505
 
3289
3506
 
3507
+ def update_collection_from_df(
3508
+ id: str,
3509
+ data: pd.DataFrame,
3510
+ name: Optional[str] = None,
3511
+ metadata: Optional[Union[Dict[str, Any], str]] = None,
3512
+ *,
3513
+ auth: Optional[AUTH] = None,
3514
+ conn_url: Optional[str] = None,
3515
+ batcher: Optional[Batcher] = None,
3516
+ ) -> Alias.Id:
3517
+ """update collection by id\n
3518
+ return collection id"""
3519
+ return fh.update_collection_from_df(
3520
+ id, data, name, metadata, auth=auth, conn_url=conn_url, batcher=batcher
3521
+ )
3522
+
3523
+
3290
3524
  def get_collection_to_df(
3291
3525
  id: str,
3292
3526
  offset: int = 0,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: malevich-coretools
3
- Version: 0.3.30
3
+ Version: 0.3.32
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=yIFBlvBZe_HqcyTGeWtZdEIz9ABs41sCNPO7SFDH9Kk,107271
2
+ malevich_coretools/utils.py,sha256=6cNvgl4tePUkEETib3N9D6YwG-oU8bmIj8dSN_AhSUM,114265
3
3
  malevich_coretools/abstract/__init__.py,sha256=8AC5ZukRGkTtN-XP14DY5z2HrJqN5LLlnmcMqvWwtWU,76
4
- malevich_coretools/abstract/abstract.py,sha256=7Z6LfUqLwcwvOMmoqX4dxRKbVbYfA4D4mdi-rVGjJ7U,14585
4
+ malevich_coretools/abstract/abstract.py,sha256=19MCESiXNthMTfsXAZkJeu4ePdySkElKXHcLiEeZTZM,14870
5
5
  malevich_coretools/abstract/pipeline.py,sha256=nTdoIhEmpfDaNK19KCy588RbppMv3S0o6eV6W_t6_hM,4444
6
6
  malevich_coretools/abstract/statuses.py,sha256=9ISSw_evsylBshLXoU44TCoFOrZm4bXIxyAFFDqdUWc,333
7
7
  malevich_coretools/admin/__init__.py,sha256=zdIcHs3T_NZ8HYWts-O7OpBEWHIu779QDZMGF5HRCLg,35
@@ -10,18 +10,18 @@ malevich_coretools/batch/__init__.py,sha256=taxyZl8YOZd2EBd3leN6slzMkejUtjQ64Na3
10
10
  malevich_coretools/batch/utils.py,sha256=cqX34sfh85dCwLv7qprxatzhYxxj7LqZwjhlmk_3GXQ,7705
11
11
  malevich_coretools/funcs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  malevich_coretools/funcs/checks.py,sha256=Q5pRtRevQrGv_-SMbn2GgYnulhclDLBXdRtbw2QOYKU,223
13
- malevich_coretools/funcs/funcs.py,sha256=hKTRff1lfv_0ohHWpuX_QbPpxkDWlA9Cnf_eLCzhPdQ,36954
14
- malevich_coretools/funcs/helpers.py,sha256=-JU17yt19CS8IadZ0r5vN4hmXBrTjLUyRB07kBDhZL4,10003
13
+ malevich_coretools/funcs/funcs.py,sha256=Q-HiFrLSMZXVfr0HfAVNK0MAqmw5tOTOQtTvdpSg3Qc,38612
14
+ malevich_coretools/funcs/helpers.py,sha256=7_obLb35seAfxGH7rqe5FExuAUz7j63ByUn4Oxw5Xjk,11044
15
15
  malevich_coretools/secondary/__init__.py,sha256=048HqvG36_1WdDVZK_RuECmaf14Iq2fviUysG1inlaE,78
16
16
  malevich_coretools/secondary/config.py,sha256=hRlSJuPQnhKyt1wmOAJX_XmcliaO0fPGbW94AE_Mazs,463
17
- malevich_coretools/secondary/const.py,sha256=sP1LeJAXbVkMthnPINci5kfyGj-8IWSdmEB6HDyiBjs,12862
17
+ malevich_coretools/secondary/const.py,sha256=XPS-aBQPgmhvtWoy-ioIe3km1GaWlD4YJDHGxAyzKKk,13742
18
18
  malevich_coretools/secondary/helpers.py,sha256=t-W9g9t0O1EaAX8UOb1wxXFAMawbtDotDH47t0GdjG4,6142
19
19
  malevich_coretools/secondary/kafka_utils.py,sha256=SIUnBFyfwsquN6MAUrEkKCw-1l7979Znl7OTQSX2UKo,989
20
20
  malevich_coretools/tools/__init__.py,sha256=jDxlCa5Dr6Y43qlI7JwsRAlBkKmFeTHTEnjNUvu-0iw,46
21
21
  malevich_coretools/tools/abstract.py,sha256=B1RW1FeNHrQ6r1k-cQZ4k4noCRXkIGt-JUwVoXEDkAg,4466
22
22
  malevich_coretools/tools/vast.py,sha256=63tvy70qQV9vnK0eWytlgjBGSnfA7l3kSIDgACBbMMs,12893
23
- malevich_coretools-0.3.30.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
24
- malevich_coretools-0.3.30.dist-info/METADATA,sha256=3qUA4rMW18BpH_IcDl0-aPAxk8MlmNQ7xiF9IFhHhAw,265
25
- malevich_coretools-0.3.30.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
26
- malevich_coretools-0.3.30.dist-info/top_level.txt,sha256=wDX3s1Tso0otBPNrFRfXqyNpm48W4Bp5v6JfbITO2Z8,19
27
- malevich_coretools-0.3.30.dist-info/RECORD,,
23
+ malevich_coretools-0.3.32.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
24
+ malevich_coretools-0.3.32.dist-info/METADATA,sha256=NCx0Q3vYDBymPEKf_y_DEUUuhv1CVBo93istKP3vquQ,265
25
+ malevich_coretools-0.3.32.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
26
+ malevich_coretools-0.3.32.dist-info/top_level.txt,sha256=wDX3s1Tso0otBPNrFRfXqyNpm48W4Bp5v6JfbITO2Z8,19
27
+ malevich_coretools-0.3.32.dist-info/RECORD,,