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

@@ -92,26 +92,26 @@ class User(BaseModel):
92
92
 
93
93
  class JsonImage(BaseModel):
94
94
  ref: str
95
- user: Optional[str]
96
- token: Optional[str]
95
+ user: Optional[str] = None
96
+ token: Optional[str] = None
97
97
 
98
98
 
99
99
  class UserApp(BaseModel):
100
100
  appId: Alias.Id
101
- inputId: Optional[Alias.Id]
101
+ inputId: Optional[Alias.Id] = None
102
102
  processorId: Alias.Id
103
- outputId: Optional[Alias.Id]
104
- cfg: Optional[Alias.Json]
103
+ outputId: Optional[Alias.Id] = None
104
+ cfg: Optional[Alias.Json] = None
105
105
  image: JsonImage
106
106
  platform: str
107
- platformSettings: Optional[str]
108
- collectionsFrom: Optional[Dict[str, str]]
109
- extraCollectionsFrom: Optional[Dict[str, str]]
107
+ platformSettings: Optional[str] = None
108
+ collectionsFrom: Optional[Dict[str, str]] = None
109
+ extraCollectionsFrom: Optional[Dict[str, str]] = None
110
110
 
111
111
 
112
112
  class UserTask(BaseModel):
113
113
  taskId: Alias.Id
114
- appId: Optional[Alias.Id]
114
+ appId: Optional[Alias.Id] = None
115
115
  appsDepends: List[Alias.Id]
116
116
  tasksDepends: List[Alias.Id]
117
117
  synthetic: bool
@@ -335,14 +335,14 @@ class AppLog(BaseModel):
335
335
 
336
336
 
337
337
  class AppLogs(BaseModel):
338
- operationId: str
338
+ operationId: Alias.Id
339
339
  dagLogs: str
340
340
  data: Dict[str, AppLog]
341
341
  error: Optional[str] = None
342
342
 
343
343
 
344
344
  class LogsTask(BaseModel):
345
- operationId: str
345
+ operationId: Alias.Id
346
346
  appId: Optional[str] = None
347
347
  taskId: Optional[str] = None
348
348
  runId: Optional[str] = None
@@ -394,3 +394,30 @@ class AppFunctionsInfo(BaseModel):
394
394
  inits: Dict[str, InitInfo] = dict()
395
395
  logs: Optional[str] = None
396
396
  instanceInfo: Optional[str] = None # json with info about instance
397
+
398
+
399
+ class TaskInfo(BaseModel):
400
+ taskId: str
401
+ apps: Dict[str, UserApp]
402
+ tasks: Dict[str, UserTask]
403
+ cfg: str
404
+ login: str
405
+
406
+
407
+ class AdminRunInfo(BaseModel):
408
+ operationId: Alias.Id
409
+ taskInfo: TaskInfo
410
+ cfgId: str
411
+
412
+
413
+ class AdminRunsInfo(BaseModel):
414
+ data: List[AdminRunInfo]
415
+
416
+
417
+ class OperationOrNone(BaseModel):
418
+ operationId: Optional[Alias.Id] = None
419
+
420
+
421
+ class AdminStopOperation(BaseModel):
422
+ operationId: Optional[Alias.Id]
423
+ withLogs: bool
@@ -0,0 +1 @@
1
+ from .utils import * # noqa: F403
@@ -0,0 +1,55 @@
1
+ import malevich_coretools.funcs.funcs as f
2
+ from malevich_coretools.abstract import * # noqa: F403
3
+
4
+
5
+ def admin_get_runs(
6
+ *,
7
+ auth: Optional[AUTH] = None,
8
+ conn_url: Optional[str] = None,
9
+ ) -> AdminRunsInfo:
10
+ """return info about all runs"""
11
+ return f.get_admin_runs(auth=auth, conn_url=conn_url)
12
+
13
+
14
+ def admin_get_run_info(
15
+ id: Alias.Id,
16
+ *,
17
+ auth: Optional[AUTH] = None,
18
+ conn_url: Optional[str] = None,
19
+ ) -> Alias.Info:
20
+ """return run info by operation \"id\""""
21
+ data = OperationOrNone(id)
22
+ return f.get_admin_runs_info(data, auth=auth, conn_url=conn_url)
23
+
24
+
25
+ def admin_get_runs_info(
26
+ *,
27
+ auth: Optional[AUTH] = None,
28
+ conn_url: Optional[str] = None,
29
+ ) -> Alias.Json:
30
+ """return json: dm id -> info about its runs"""
31
+ data = OperationOrNone()
32
+ return f.get_admin_runs_info(data, auth=auth, conn_url=conn_url)
33
+
34
+
35
+ def admin_delete_run(
36
+ id: Alias.Id,
37
+ withLogs: bool = False,
38
+ *,
39
+ auth: Optional[AUTH] = None,
40
+ conn_url: Optional[str] = None,
41
+ ) -> Alias.Json:
42
+ """delete run by operation \"id\""""
43
+ data = AdminStopOperation(operationId=id, withLogs=withLogs)
44
+ return f.delete_admin_runs(data, auth=auth, conn_url=conn_url)
45
+
46
+
47
+ def admin_delete_runs(
48
+ withLogs: bool = False,
49
+ *,
50
+ auth: Optional[AUTH] = None,
51
+ conn_url: Optional[str] = None,
52
+ ) -> Alias.Json:
53
+ """delete all runs"""
54
+ data = AdminStopOperation(operationId=None, withLogs=withLogs)
55
+ return f.delete_admin_runs(data, auth=auth, conn_url=conn_url)
@@ -414,6 +414,20 @@ def get_run_mainTaskCfg(id: str, *args, **kwargs) -> MainTaskCfg:
414
414
  def get_run_operationsIds(task_id: str, cfg_id: Optional[str]=None, *args, **kwargs) -> ResultIds:
415
415
  return model_from_json(send_to_core_get(TEMP_RUN_OPERATIONS_IDS(task_id, cfg_id), *args, **kwargs), ResultIds)
416
416
 
417
+ # AdminController
418
+
419
+
420
+ def get_admin_runs(*args, **kwargs) -> AdminRunsInfo:
421
+ return model_from_json(send_to_core_get(ADMIN_RUNS, *args, **kwargs), AdminRunsInfo)
422
+
423
+
424
+ def get_admin_runs_info(data: OperationOrNone, *args, **kwargs) -> Union[Alias.Json, Alias.Info]:
425
+ return send_to_core_modify(ADMIN_RUNS_INFO, data, *args, **kwargs)
426
+
427
+
428
+ def delete_admin_runs(data: AdminStopOperation, *args, **kwargs) -> Alias.Json:
429
+ return send_to_core_modify(ADMIN_RUNS, data, is_post=False, *args, **kwargs)
430
+
417
431
  # ManagerController
418
432
 
419
433
 
@@ -13,9 +13,9 @@ WAIT_RESULT_TIMEOUT = 60 * 60 # hour
13
13
  AIOHTTP_TIMEOUT = aiohttp.ClientTimeout(total=60 * 10) # 10 min
14
14
  AIOHTTP_TIMEOUT_MINI = aiohttp.ClientTimeout(total=60 * 5) # 5 min
15
15
  POSSIBLE_APPS_PLATFORMS = {"base", "vast"}
16
- SCHEME_PATTERN = r"\w+"
17
- # endpoints
16
+ SCHEME_PATTERN = r"[a-zA-Z_]\w+"
18
17
 
18
+ # endpoints
19
19
  def with_wait(url, wait) -> str:
20
20
  return url if wait is None else f"{url}?wait={bool_to_str(wait)}" # always first
21
21
 
@@ -117,6 +117,11 @@ TEMP_RUN_ACTIVE_RUNS = f"{TEMP_RUN_MAIN}/activeRuns"
117
117
  TEMP_RUN_MAIN_TASK_CFG = lambda operationId: f"{TEMP_RUN_MAIN}/mainTaskCfg/{operationId}"
118
118
  TEMP_RUN_OPERATIONS_IDS = lambda taskId, cfgId: f"{TEMP_RUN_MAIN}/operationsIds/{taskId}" if cfgId is None else f"{TEMP_RUN_MAIN}/operationsIds/{taskId}/{cfgId}"
119
119
 
120
+ ## AdminController
121
+ ADMIN_MAIN = f"{API_VERSION}/admin"
122
+ ADMIN_RUNS = f"{ADMIN_MAIN}/runs"
123
+ ADMIN_RUNS_INFO = f"{ADMIN_MAIN}/runs/info"
124
+
120
125
  ## ManagerController
121
126
  MANAGER_MAIN = f"{API_VERSION}/manager"
122
127
  MANAGER_LOGS = f"{MANAGER_MAIN}/logs"
@@ -797,6 +797,7 @@ def create_app(
797
797
  extra_collections_from: Optional[Dict[str, str]] = None,
798
798
  wait: bool = True,
799
799
  *,
800
+ use_system_auth: bool = True,
800
801
  auth: Optional[AUTH] = None,
801
802
  conn_url: Optional[str] = None,
802
803
  ) -> Alias.Id:
@@ -808,8 +809,8 @@ def create_app(
808
809
  platform in POSSIBLE_APPS_PLATFORMS
809
810
  ), f"wrong platform: {platform}, possible platforms: {POSSIBLE_APPS_PLATFORMS}"
810
811
  app_cfg_json = None if app_cfg is None else to_json(app_cfg)
811
- image_user = image_auth[0] if image_auth is not None else Config.USERNAME
812
- image_token = image_auth[1] if image_auth is not None else Config.TOKEN
812
+ image_user = image_auth[0] if image_auth is not None else Config.USERNAME if use_system_auth else None
813
+ image_token = image_auth[1] if image_auth is not None else Config.TOKEN if use_system_auth else None
813
814
  if Config.WITH_WARNINGS and (image_user is None or image_token is None):
814
815
  Config.logger.warning("image_auth not set")
815
816
  if image_ref is None:
@@ -847,6 +848,7 @@ def update_app(
847
848
  extra_collections_from: Optional[Dict[str, str]] = None,
848
849
  wait: bool = True,
849
850
  *,
851
+ use_system_auth: bool = True,
850
852
  auth: Optional[AUTH] = None,
851
853
  conn_url: Optional[str] = None,
852
854
  ) -> Alias.Info:
@@ -857,8 +859,8 @@ def update_app(
857
859
  platform in POSSIBLE_APPS_PLATFORMS
858
860
  ), f"wrong platform: {platform}, possible platforms: {POSSIBLE_APPS_PLATFORMS}"
859
861
  app_cfg_json = None if app_cfg is None else to_json(app_cfg)
860
- image_user = image_auth[0] if image_auth is not None else Config.USERNAME
861
- image_token = image_auth[1] if image_auth is not None else Config.TOKEN
862
+ image_user = image_auth[0] if image_auth is not None else Config.USERNAME if use_system_auth else None
863
+ image_token = image_auth[1] if image_auth is not None else Config.TOKEN if use_system_auth else None
862
864
  if Config.WITH_WARNINGS and (image_user is None or image_token is None):
863
865
  Config.logger.warning("image_auth not set")
864
866
  if image_ref is None:
@@ -1274,12 +1276,13 @@ def get_image_info(
1274
1276
  image_auth: Optional[AUTH] = None,
1275
1277
  parse: bool = False,
1276
1278
  *,
1279
+ use_system_auth: bool = False,
1277
1280
  auth: Optional[AUTH] = None,
1278
1281
  conn_url: Optional[str] = None,
1279
1282
  ) -> Union[Alias.Json, AppFunctionsInfo]:
1280
1283
  """return json with functions image info"""
1281
- image_user = image_auth[0] if image_auth is not None else Config.USERNAME
1282
- image_token = image_auth[1] if image_auth is not None else Config.TOKEN
1284
+ image_user = image_auth[0] if image_auth is not None else Config.USERNAME if use_system_auth else None
1285
+ image_token = image_auth[1] if image_auth is not None else Config.TOKEN if use_system_auth else None
1283
1286
  if Config.WITH_WARNINGS and (image_user is None or image_token is None):
1284
1287
  Config.logger.warning("image_auth not set")
1285
1288
  json_image = JsonImage(ref=image_ref, user=image_user, token=image_token)
@@ -1589,7 +1592,7 @@ def task_stop_all(
1589
1592
  auth: Optional[AUTH] = None,
1590
1593
  conn_url: Optional[str] = None,
1591
1594
  ) -> Alias.Json:
1592
- """stop task by \"operation_id\" """
1595
+ """stop all tasks"""
1593
1596
  task = StopOperationMany(withLogs=with_logs, infoUrl=info_url)
1594
1597
  return f.post_manager_task_stop_all(
1595
1598
  task, with_show=with_show, wait=wait, auth=auth, conn_url=conn_url
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: malevich-coretools
3
- Version: 0.2.4
3
+ Version: 0.2.6
4
4
  Author: Andrew Pogrebnoj
5
5
  Author-email: andrew@onjulius.co
6
6
  License-File: LICENSE
@@ -1,18 +1,20 @@
1
1
  malevich_coretools/__init__.py,sha256=88IRvwNti4YOMJc6RaVRutwurJzP23g30D-rgo04Fgc,82
2
- malevich_coretools/utils.py,sha256=l26R7blks1KK2T3iX6C0PxKZnCDHFeNL3v-LXayoacs,57677
2
+ malevich_coretools/utils.py,sha256=MTtfRbGHfNcNPOcF1Y55VMtiWsti1ZsMNUGs33b-VV4,57938
3
3
  malevich_coretools/abstract/__init__.py,sha256=ZWtP4gFLpNVFXzlMKXEK4iMnUqqMg07pL8yKGSJd6QI,38
4
- malevich_coretools/abstract/abstract.py,sha256=coe2Lmp9totwEfnQh_l1oEcSa6p7bdVCXdS7O4Gx94A,8221
4
+ malevich_coretools/abstract/abstract.py,sha256=xqZwJ3CjC9IXNcXTrSSNj8J5JJ68IAtnfLcChZLZq8U,8760
5
+ malevich_coretools/admin/__init__.py,sha256=zdIcHs3T_NZ8HYWts-O7OpBEWHIu779QDZMGF5HRCLg,35
6
+ malevich_coretools/admin/utils.py,sha256=P1RmYfc_n6plBayfOhVuwVV33vMxw1yuS11NmKD4Hto,1507
5
7
  malevich_coretools/funcs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- malevich_coretools/funcs/funcs.py,sha256=ltgFnCeye1Mc0ErMwDqHX7qOTuJYVCY9QScWiGbPDkg,27291
8
+ malevich_coretools/funcs/funcs.py,sha256=dUmEfZtMeFHZLBdqXr4Oz_2NPD8svvc_0tk752UnofY,27789
7
9
  malevich_coretools/funcs/helpers.py,sha256=Y8v6uyawYl2_G0XmhmiVLqGIUzvxnkpKF0ODA9vrB3Y,1276
8
10
  malevich_coretools/secondary/__init__.py,sha256=048HqvG36_1WdDVZK_RuECmaf14Iq2fviUysG1inlaE,78
9
11
  malevich_coretools/secondary/config.py,sha256=b7RysQTkPKib8FEhfm3uU7TPvz8vgWLlqakvZN5NFs4,391
10
- malevich_coretools/secondary/const.py,sha256=OrGAD3jItg0d8Zi-Xvqc_dobNASPxYBgfWgVRbSO8ls,7547
12
+ malevich_coretools/secondary/const.py,sha256=b-0WYo13MtoQSzacKWiIJKF6rukBo-5UylrkT9Np14k,7690
11
13
  malevich_coretools/secondary/helpers.py,sha256=yQiaG_Q_5sw04RFpZccoSryPBuoA25BpSmvzSyQtwK0,2937
12
14
  malevich_coretools/tools/__init__.py,sha256=jDxlCa5Dr6Y43qlI7JwsRAlBkKmFeTHTEnjNUvu-0iw,46
13
15
  malevich_coretools/tools/vast.py,sha256=u1cnfylSgq3nYfonXbTy1zwor3OPkhD3vRf2OnqlMZY,12504
14
- malevich_coretools-0.2.4.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
15
- malevich_coretools-0.2.4.dist-info/METADATA,sha256=8JefiMdIJutbYmkKzPHDhuKYEhlEKQEA3ga_uGg1iB8,236
16
- malevich_coretools-0.2.4.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
17
- malevich_coretools-0.2.4.dist-info/top_level.txt,sha256=wDX3s1Tso0otBPNrFRfXqyNpm48W4Bp5v6JfbITO2Z8,19
18
- malevich_coretools-0.2.4.dist-info/RECORD,,
16
+ malevich_coretools-0.2.6.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
17
+ malevich_coretools-0.2.6.dist-info/METADATA,sha256=tR9pQOmmVBK_A_IWoMa2j0XQ6h0UhQk5dKVwyWlSdWA,236
18
+ malevich_coretools-0.2.6.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
19
+ malevich_coretools-0.2.6.dist-info/top_level.txt,sha256=wDX3s1Tso0otBPNrFRfXqyNpm48W4Bp5v6JfbITO2Z8,19
20
+ malevich_coretools-0.2.6.dist-info/RECORD,,