malevich-coretools 0.2.9__tar.gz → 0.2.11__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.
- {malevich-coretools-0.2.9/malevich_coretools.egg-info → malevich-coretools-0.2.11}/PKG-INFO +1 -1
- malevich-coretools-0.2.11/VERSION +1 -0
- {malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/malevich_coretools/abstract/abstract.py +6 -1
- {malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/malevich_coretools/admin/utils.py +4 -4
- {malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/malevich_coretools/funcs/funcs.py +52 -3
- {malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/malevich_coretools/secondary/const.py +7 -0
- {malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/malevich_coretools/secondary/helpers.py +1 -1
- {malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/malevich_coretools/utils.py +54 -0
- {malevich-coretools-0.2.9 → malevich-coretools-0.2.11/malevich_coretools.egg-info}/PKG-INFO +1 -1
- malevich-coretools-0.2.9/VERSION +0 -1
- {malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/LICENSE +0 -0
- {malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/MANIFEST.in +0 -0
- {malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/README.md +0 -0
- {malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/malevich_coretools/__init__.py +0 -0
- {malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/malevich_coretools/abstract/__init__.py +0 -0
- {malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/malevich_coretools/admin/__init__.py +0 -0
- {malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/malevich_coretools/funcs/__init__.py +0 -0
- {malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/malevich_coretools/funcs/helpers.py +0 -0
- {malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/malevich_coretools/secondary/__init__.py +0 -0
- {malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/malevich_coretools/secondary/config.py +0 -0
- {malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/malevich_coretools/tools/__init__.py +0 -0
- {malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/malevich_coretools/tools/vast.py +0 -0
- {malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/malevich_coretools.egg-info/SOURCES.txt +0 -0
- {malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/malevich_coretools.egg-info/dependency_links.txt +0 -0
- {malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/malevich_coretools.egg-info/requires.txt +0 -0
- {malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/malevich_coretools.egg-info/top_level.txt +0 -0
- {malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/pyproject.toml +0 -0
- {malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/requirements.txt +0 -0
- {malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/setup.cfg +0 -0
- {malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/setup.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.2.11
|
{malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/malevich_coretools/abstract/abstract.py
RENAMED
|
@@ -211,6 +211,11 @@ class ResultIds(BaseModel):
|
|
|
211
211
|
ids: List[Alias.Id]
|
|
212
212
|
|
|
213
213
|
|
|
214
|
+
class FilesDirs(BaseModel):
|
|
215
|
+
files: List[str]
|
|
216
|
+
directories: List[str]
|
|
217
|
+
|
|
218
|
+
|
|
214
219
|
class ResultDoc(BaseModel):
|
|
215
220
|
data: Alias.Json
|
|
216
221
|
name: str
|
|
@@ -424,5 +429,5 @@ class OperationOrNone(BaseModel):
|
|
|
424
429
|
|
|
425
430
|
|
|
426
431
|
class AdminStopOperation(BaseModel):
|
|
427
|
-
operationId: Optional[Alias.Id]
|
|
432
|
+
operationId: Optional[Alias.Id] = None
|
|
428
433
|
withLogs: bool
|
|
@@ -17,8 +17,8 @@ def admin_get_run_info(
|
|
|
17
17
|
auth: Optional[AUTH] = None,
|
|
18
18
|
conn_url: Optional[str] = None,
|
|
19
19
|
) -> Alias.Info:
|
|
20
|
-
"""return run info by operation
|
|
21
|
-
data = OperationOrNone(id)
|
|
20
|
+
"""return run info by operation `id`"""
|
|
21
|
+
data = OperationOrNone(operationId=id)
|
|
22
22
|
return f.get_admin_runs_info(data, auth=auth, conn_url=conn_url)
|
|
23
23
|
|
|
24
24
|
|
|
@@ -39,7 +39,7 @@ def admin_delete_run(
|
|
|
39
39
|
auth: Optional[AUTH] = None,
|
|
40
40
|
conn_url: Optional[str] = None,
|
|
41
41
|
) -> Alias.Json:
|
|
42
|
-
"""delete run by operation
|
|
42
|
+
"""delete run by operation `id`"""
|
|
43
43
|
data = AdminStopOperation(operationId=id, withLogs=withLogs)
|
|
44
44
|
return f.delete_admin_runs(data, auth=auth, conn_url=conn_url)
|
|
45
45
|
|
|
@@ -51,5 +51,5 @@ def admin_delete_runs(
|
|
|
51
51
|
conn_url: Optional[str] = None,
|
|
52
52
|
) -> Alias.Json:
|
|
53
53
|
"""delete all runs"""
|
|
54
|
-
data = AdminStopOperation(
|
|
54
|
+
data = AdminStopOperation(withLogs=withLogs)
|
|
55
55
|
return f.delete_admin_runs(data, auth=auth, conn_url=conn_url)
|
|
@@ -121,6 +121,29 @@ def delete_collections_id_s3(key: str, wait: bool, *args, **kwargs) -> Alias.Inf
|
|
|
121
121
|
def delete_collections_id_del(id: str, data: DocsCollectionChange, wait: bool, *args, **kwargs) -> Alias.Info:
|
|
122
122
|
return send_to_core_modify(COLLECTIONS_ID_DEL(id, wait), data, *args, **kwargs, is_post=False)
|
|
123
123
|
|
|
124
|
+
# CollectionObjectsController
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def get_collection_objects(path: Optional[str], recursive: Optional[str], *args, **kwargs) -> FilesDirs:
|
|
128
|
+
return model_from_json(send_to_core_get(COLLECTION_OBJECTS_ALL_GET(path, recursive), *args, **kwargs), FilesDirs)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def get_collection_object(path: str, *args, **kwargs) -> bytes:
|
|
132
|
+
return send_to_core_get(COLLECTION_OBJECTS_PATH(path, None), is_text=None, *args, **kwargs)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def post_collections_object(path: str, data: bytes, wait: bool, *args, **kwargs) -> Alias.Info:
|
|
136
|
+
return send_to_core_modify_raw(COLLECTION_OBJECTS_PATH(path, wait), data, *args, **kwargs)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def delete_collection_objects(wait: bool, *args, **kwargs) -> Alias.Info:
|
|
140
|
+
return send_to_core_modify(COLLECTION_OBJECTS_ALL(wait), *args, **kwargs, is_post=False)
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def delete_collection_object(path: str, wait: bool, *args, **kwargs) -> Alias.Info:
|
|
144
|
+
return send_to_core_modify(COLLECTION_OBJECTS_PATH(path, wait), *args, **kwargs, is_post=False)
|
|
145
|
+
|
|
146
|
+
|
|
124
147
|
# SchemeController
|
|
125
148
|
|
|
126
149
|
|
|
@@ -599,7 +622,7 @@ def __check_response(path: str, response: Response, show_func: Optional[Callable
|
|
|
599
622
|
response.raise_for_status()
|
|
600
623
|
|
|
601
624
|
|
|
602
|
-
def send_to_core_get(path: str, with_auth=True, show_func: Optional[Callable]=None, is_text=False, auth: Optional[AUTH]=None, conn_url: Optional[str]=None) -> Optional[str]:
|
|
625
|
+
def send_to_core_get(path: str, with_auth=True, show_func: Optional[Callable]=None, is_text=False, auth: Optional[AUTH]=None, conn_url: Optional[str]=None) -> Optional[Union[str, bytes]]:
|
|
603
626
|
host = Config.HOST_PORT if conn_url is None else conn_url
|
|
604
627
|
assert host is not None, "host port not set"
|
|
605
628
|
if auth is None or not with_auth:
|
|
@@ -608,10 +631,12 @@ def send_to_core_get(path: str, with_auth=True, show_func: Optional[Callable]=No
|
|
|
608
631
|
__check_response(f"{host}{path}", response, show_func)
|
|
609
632
|
if response.status_code == HTTPStatus.NO_CONTENT:
|
|
610
633
|
return None
|
|
611
|
-
if is_text:
|
|
634
|
+
if is_text is True:
|
|
612
635
|
return response.text
|
|
613
|
-
|
|
636
|
+
elif is_text is False:
|
|
614
637
|
return response.json()
|
|
638
|
+
else:
|
|
639
|
+
return response.content
|
|
615
640
|
|
|
616
641
|
|
|
617
642
|
def send_to_core_modify(path: str, operation: Optional[Any] = None, with_auth: bool=True, with_show: Optional[bool]=None, show_func: Optional[Callable]=None, is_post: bool=True, auth: Optional[AUTH]=None, conn_url: Optional[str]=None) -> str: # noqa: ANN401
|
|
@@ -640,6 +665,30 @@ def send_to_core_modify(path: str, operation: Optional[Any] = None, with_auth: b
|
|
|
640
665
|
return result
|
|
641
666
|
|
|
642
667
|
|
|
668
|
+
def send_to_core_modify_raw(path: str, data: bytes, with_auth: bool=True, with_show: Optional[bool]=None, show_func: Optional[Callable]=None, is_post: bool=True, auth: Optional[AUTH]=None, conn_url: Optional[str]=None) -> str: # noqa: ANN401
|
|
669
|
+
"""modify: post by default, else - delete"""
|
|
670
|
+
host = Config.HOST_PORT if conn_url is None else conn_url
|
|
671
|
+
assert host is not None, "host port not set"
|
|
672
|
+
if auth is None:
|
|
673
|
+
auth = (Config.CORE_USERNAME, Config.CORE_PASSWORD)
|
|
674
|
+
if is_post:
|
|
675
|
+
response = requests.post(f"{host}{path}", data=data, headers=HEADERS_RAW, auth=auth if with_auth else None)
|
|
676
|
+
else: # delete
|
|
677
|
+
response = requests.delete(f"{host}{path}", data=data, headers=HEADERS_RAW, auth=auth if with_auth else None)
|
|
678
|
+
__check_response(f"{host}{path}", response, show_func=show_func)
|
|
679
|
+
if response.status_code == HTTPStatus.NO_CONTENT:
|
|
680
|
+
return ""
|
|
681
|
+
result = response.text
|
|
682
|
+
if with_show is None:
|
|
683
|
+
with_show = Config.VERBOSE
|
|
684
|
+
if with_show:
|
|
685
|
+
if show_func is None:
|
|
686
|
+
Config.logger.info(result)
|
|
687
|
+
else:
|
|
688
|
+
show_func(result)
|
|
689
|
+
return result
|
|
690
|
+
|
|
691
|
+
|
|
643
692
|
async def send_to_core_post_async(path: str, operation: Optional[str] = None, with_auth=True, with_show=True, show_func: Optional[Callable]=None, auth: Optional[AUTH]=None, conn_url: Optional[str]=None) -> str:
|
|
644
693
|
host = Config.HOST_PORT if conn_url is None else conn_url
|
|
645
694
|
assert host is not None, "host port not set"
|
{malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/malevich_coretools/secondary/const.py
RENAMED
|
@@ -7,6 +7,7 @@ from malevich_coretools.secondary.helpers import bool_to_str
|
|
|
7
7
|
# const
|
|
8
8
|
API_VERSION = "api/v1"
|
|
9
9
|
HEADERS = {'Content-type': 'application/json', 'Accept': 'application/json', 'User-Agent': 'malevich user agent'}
|
|
10
|
+
HEADERS_RAW = {'Content-type': 'text/plain; base64', 'Accept': 'application/json', 'User-Agent': 'malevich user agent'}
|
|
10
11
|
SLEEP_TIME = 0.1
|
|
11
12
|
LONG_SLEEP_TIME = 1 # second
|
|
12
13
|
WAIT_RESULT_TIMEOUT = 60 * 60 # hour
|
|
@@ -52,6 +53,12 @@ COLLECTIONS_FIX_SCHEME = lambda id, wait: with_wait(f"{COLLECTIONS_MAIN}/{id}/fi
|
|
|
52
53
|
COLLECTIONS_UNFIX_SCHEME = lambda id, wait: with_wait(f"{COLLECTIONS_MAIN}/{id}/unfixScheme", wait)
|
|
53
54
|
COLLECTIONS_METADATA = lambda id, wait: with_wait(f"{COLLECTIONS_MAIN}/{id}/metadata", wait)
|
|
54
55
|
|
|
56
|
+
## CollectionObjectsController
|
|
57
|
+
COLLECTION_OBJECTS_MAIN = f"{API_VERSION}/collectionObjects"
|
|
58
|
+
COLLECTION_OBJECTS_ALL_GET = lambda path, recursive: with_key_values(f"{COLLECTION_OBJECTS_MAIN}/all", {"path": path, "recursive": recursive})
|
|
59
|
+
COLLECTION_OBJECTS_ALL = lambda wait: with_wait(f"{COLLECTION_OBJECTS_MAIN}/all", wait)
|
|
60
|
+
COLLECTION_OBJECTS_PATH = lambda path, wait: with_key_values(f"{COLLECTION_OBJECTS_MAIN}/", {"path": path, "wait": None if wait is None else bool_to_str(wait)})
|
|
61
|
+
|
|
55
62
|
## SchemeController
|
|
56
63
|
SCHEMES_MAIN = f"{API_VERSION}/schemes"
|
|
57
64
|
SCHEMES = lambda wait: with_wait(f"{SCHEMES_MAIN}/", wait)
|
{malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/malevich_coretools/secondary/helpers.py
RENAMED
|
@@ -46,7 +46,7 @@ def __show_logs_result(res: LogsResult): # noqa: ANN202
|
|
|
46
46
|
print(res.data)
|
|
47
47
|
for run_id, logs in res.logs.items():
|
|
48
48
|
print(f"------- {run_id}:")
|
|
49
|
-
userLogs = res.userLogs
|
|
49
|
+
userLogs = res.userLogs.get(run_id, "")
|
|
50
50
|
if len(userLogs) > 0:
|
|
51
51
|
print(userLogs)
|
|
52
52
|
print("-------")
|
|
@@ -447,6 +447,60 @@ def delete_from_collection(
|
|
|
447
447
|
)
|
|
448
448
|
|
|
449
449
|
|
|
450
|
+
# CollectionObjects
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
def get_collection_objects(
|
|
454
|
+
path: Optional[str] = None,
|
|
455
|
+
recursive: Optional[str] = None,
|
|
456
|
+
*, auth: Optional[AUTH] = None, conn_url: Optional[str] = None
|
|
457
|
+
) -> FilesDirs:
|
|
458
|
+
"""return struct with list of paths: directories and files: walk if `recursive` else ls"""
|
|
459
|
+
return f.get_collection_objects(path, recursive, auth=auth, conn_url=conn_url)
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
def get_collection_object(
|
|
463
|
+
path: str,
|
|
464
|
+
*,
|
|
465
|
+
auth: Optional[AUTH] = None,
|
|
466
|
+
conn_url: Optional[str] = None,
|
|
467
|
+
) -> bytes:
|
|
468
|
+
"""return collection object bytes by `path`"""
|
|
469
|
+
return f.get_collection_object(
|
|
470
|
+
path, auth=auth, conn_url=conn_url
|
|
471
|
+
)
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
def update_collection_object(
|
|
475
|
+
path: str,
|
|
476
|
+
data: bytes,
|
|
477
|
+
wait: bool = True,
|
|
478
|
+
*,
|
|
479
|
+
auth: Optional[AUTH] = None,
|
|
480
|
+
conn_url: Optional[str] = None,
|
|
481
|
+
) -> Alias.Info:
|
|
482
|
+
"""update collection object with `path` by `data` """
|
|
483
|
+
return f.post_collections_object(path, data, wait=wait, auth=auth, conn_url=conn_url)
|
|
484
|
+
|
|
485
|
+
|
|
486
|
+
def delete_collection_objects(
|
|
487
|
+
wait: bool = True, *, auth: Optional[AUTH] = None, conn_url: Optional[str] = None
|
|
488
|
+
) -> Alias.Info:
|
|
489
|
+
"""delete all collection objects"""
|
|
490
|
+
return f.delete_collection_objects(wait=wait, auth=auth, conn_url=conn_url)
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
def delete_collection_object(
|
|
494
|
+
path: str,
|
|
495
|
+
wait: bool = True,
|
|
496
|
+
*,
|
|
497
|
+
auth: Optional[AUTH] = None,
|
|
498
|
+
conn_url: Optional[str] = None,
|
|
499
|
+
) -> Alias.Info:
|
|
500
|
+
"""delete collection object with `path` (or directory with them) """
|
|
501
|
+
return f.delete_collection_object(path, wait=wait, auth=auth, conn_url=conn_url)
|
|
502
|
+
|
|
503
|
+
|
|
450
504
|
# Scheme
|
|
451
505
|
|
|
452
506
|
|
malevich-coretools-0.2.9/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.2.9
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/malevich_coretools/abstract/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/malevich_coretools/secondary/__init__.py
RENAMED
|
File without changes
|
{malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/malevich_coretools/secondary/config.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/malevich_coretools.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/malevich_coretools.egg-info/requires.txt
RENAMED
|
File without changes
|
{malevich-coretools-0.2.9 → malevich-coretools-0.2.11}/malevich_coretools.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|