cgcsdk 1.0.7__py3-none-any.whl → 1.0.9__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.
- cgc/.env +1 -1
- cgc/CHANGELOG.md +19 -0
- cgc/cgc.py +2 -0
- cgc/commands/auth/__init__.py +2 -2
- cgc/commands/auth/auth_cmd.py +14 -2
- cgc/commands/auth/auth_responses.py +9 -2
- cgc/commands/auth/auth_utils.py +6 -5
- cgc/commands/cgc_models.py +9 -0
- cgc/commands/compute/compute_models.py +1 -23
- cgc/commands/db/db_cmd.py +7 -1
- cgc/commands/db/db_models.py +37 -0
- cgc/commands/exceptions.py +8 -0
- cgc/commands/jobs/job_utils.py +36 -31
- cgc/commands/jobs/jobs_responses.py +1 -1
- cgc/commands/keys/__init__.py +5 -0
- cgc/commands/keys/keys_cmd.py +176 -0
- cgc/commands/keys/keys_models.py +16 -0
- cgc/commands/keys/keys_responses.py +47 -0
- cgc/commands/keys/keys_utils.py +79 -0
- cgc/commands/resource/resource_cmd.py +2 -1
- cgc/sdk/__init__.py +0 -2
- cgc/sdk/job.py +1 -1
- cgc/utils/__init__.py +8 -0
- cgc/utils/config_utils.py +5 -1
- cgc/utils/consts/env_consts.py +1 -1
- cgc/utils/custom_exceptions.py +3 -0
- cgc/utils/message_utils.py +1 -1
- cgc/utils/prepare_headers.py +22 -13
- cgc/utils/requests_helper.py +1 -3
- {cgcsdk-1.0.7.dist-info → cgcsdk-1.0.9.dist-info}/METADATA +3 -7
- {cgcsdk-1.0.7.dist-info → cgcsdk-1.0.9.dist-info}/RECORD +35 -31
- cgc/sdk/handlers.py +0 -24
- cgc/sdk/mongodb.py +0 -204
- cgc/sdk/redis.py +0 -91
- {cgcsdk-1.0.7.dist-info → cgcsdk-1.0.9.dist-info}/LICENSE +0 -0
- {cgcsdk-1.0.7.dist-info → cgcsdk-1.0.9.dist-info}/WHEEL +0 -0
- {cgcsdk-1.0.7.dist-info → cgcsdk-1.0.9.dist-info}/entry_points.txt +0 -0
- {cgcsdk-1.0.7.dist-info → cgcsdk-1.0.9.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,79 @@
|
|
1
|
+
from typing import Optional
|
2
|
+
import click
|
3
|
+
from cgc.commands.keys.keys_models import SSHKeyTypes
|
4
|
+
|
5
|
+
|
6
|
+
def create_ssh_key_payload(
|
7
|
+
public_key: Optional[str] = None,
|
8
|
+
key_type: Optional[str] = None,
|
9
|
+
key: Optional[str] = None,
|
10
|
+
comment: str = "",
|
11
|
+
) -> dict:
|
12
|
+
"""Create a payload for creating a new SSH key"""
|
13
|
+
if public_key:
|
14
|
+
try:
|
15
|
+
key_parts = public_key.split(" ")
|
16
|
+
key_type = key_parts[0] if key_parts[0] in SSHKeyTypes.get_list() else ""
|
17
|
+
if not key_type:
|
18
|
+
raise click.ClickException("Invalid key type")
|
19
|
+
key = key_parts[1]
|
20
|
+
comment = key_parts[2] if len(key_parts) > 2 else comment
|
21
|
+
except IndexError:
|
22
|
+
raise click.ClickException("Invalid public key format")
|
23
|
+
if not key_type or not key:
|
24
|
+
raise click.ClickException("Invalid public key or key_type")
|
25
|
+
payload = {
|
26
|
+
"key_type": key_type,
|
27
|
+
"key": key,
|
28
|
+
"comment": comment,
|
29
|
+
}
|
30
|
+
return payload
|
31
|
+
|
32
|
+
|
33
|
+
def update_ssh_key_payload(
|
34
|
+
key_type: Optional[str] = None,
|
35
|
+
key: Optional[str] = None,
|
36
|
+
comment: Optional[str] = None,
|
37
|
+
) -> dict:
|
38
|
+
"""Create a payload for creating a new SSH key"""
|
39
|
+
payload = {}
|
40
|
+
if key_type:
|
41
|
+
if not key:
|
42
|
+
raise click.ClickException("Invalid public key")
|
43
|
+
payload["key_type"] = key_type
|
44
|
+
if key:
|
45
|
+
if not key_type:
|
46
|
+
raise click.ClickException("Invalid key_type")
|
47
|
+
payload["key"] = key
|
48
|
+
if comment:
|
49
|
+
payload["comment"] = comment
|
50
|
+
return payload
|
51
|
+
|
52
|
+
|
53
|
+
def get_user_ssh_keys(keys: list) -> list:
|
54
|
+
"""
|
55
|
+
Format list of keys for user
|
56
|
+
:param keys: list of user keys
|
57
|
+
:type keys: list
|
58
|
+
:return: formatted list of keys
|
59
|
+
:rtype: list
|
60
|
+
"""
|
61
|
+
output_data = []
|
62
|
+
|
63
|
+
for key in keys:
|
64
|
+
try:
|
65
|
+
key_data = {
|
66
|
+
"key_id": key["key_id"],
|
67
|
+
"key_type": key["key_type"],
|
68
|
+
"key": key["key"],
|
69
|
+
"comment": key["comment"],
|
70
|
+
"date_added": key["date_added"],
|
71
|
+
"date_updated": key["date_updated"],
|
72
|
+
}
|
73
|
+
# appending the rest of labels
|
74
|
+
key_data.update(key)
|
75
|
+
output_data.append(key_data)
|
76
|
+
except KeyError:
|
77
|
+
pass
|
78
|
+
|
79
|
+
return output_data
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import click
|
2
2
|
import json
|
3
3
|
|
4
|
-
from cgc.commands.
|
4
|
+
from cgc.commands.db.db_models import DatabasesList
|
5
|
+
from cgc.commands.compute.compute_models import ComputesList
|
5
6
|
from cgc.commands.compute.compute_responses import (
|
6
7
|
template_list_response,
|
7
8
|
template_get_start_path_response,
|
cgc/sdk/__init__.py
CHANGED
cgc/sdk/job.py
CHANGED
@@ -119,7 +119,7 @@ def job_list():
|
|
119
119
|
)
|
120
120
|
# job_pod_list = _response.get("details", {}).get("job_pod_list", [])
|
121
121
|
# job_list = _response.get("details", {}).get("job_list", [])
|
122
|
-
# return _job_utils.get_job_list(
|
122
|
+
# return _job_utils.get_job_list(job_list)
|
123
123
|
|
124
124
|
|
125
125
|
def job_delete(name: str):
|
cgc/utils/__init__.py
CHANGED
@@ -20,6 +20,14 @@ def require_confirm_loop(message: str):
|
|
20
20
|
exit(0)
|
21
21
|
|
22
22
|
|
23
|
+
def require_answer_loop(message: str, default: str):
|
24
|
+
while True:
|
25
|
+
answer = input(f"{message}: [{default}]").lower()
|
26
|
+
if answer == "":
|
27
|
+
return default
|
28
|
+
return answer
|
29
|
+
|
30
|
+
|
23
31
|
def quick_sort(collection: list) -> list:
|
24
32
|
"""A pure Python implementation of quick sort algorithm
|
25
33
|
|
cgc/utils/config_utils.py
CHANGED
@@ -5,7 +5,7 @@ import click
|
|
5
5
|
|
6
6
|
from cgc.commands.auth import NoNamespaceInConfig, NoConfigFileFound
|
7
7
|
from cgc.utils.message_utils import prepare_error_message
|
8
|
-
from cgc.utils.consts.env_consts import get_config_file_name
|
8
|
+
from cgc.utils.consts.env_consts import CGC_API_URL, CGC_SECRET, get_config_file_name
|
9
9
|
|
10
10
|
|
11
11
|
def get_config_path():
|
@@ -78,6 +78,10 @@ def read_from_cfg(key: str, filename=None):
|
|
78
78
|
except KeyError:
|
79
79
|
if key == "namespace":
|
80
80
|
raise NoNamespaceInConfig()
|
81
|
+
elif key == "cgc_secret":
|
82
|
+
return CGC_SECRET
|
83
|
+
elif key == "cgc_api_url":
|
84
|
+
return CGC_API_URL
|
81
85
|
print("Config file is corrupted. Please contact support at support@comtegra.pl")
|
82
86
|
sys.exit()
|
83
87
|
|
cgc/utils/consts/env_consts.py
CHANGED
@@ -33,7 +33,7 @@ else:
|
|
33
33
|
raise Exception("not defined API_SECURE_CONNECTION. set yes/no")
|
34
34
|
|
35
35
|
API_PORT = os.getenv("API_PORT")
|
36
|
-
|
36
|
+
CGC_API_URL = f"{__prefix}://{API_HOST}:{API_PORT}"
|
37
37
|
TMP_DIR = os.getenv("TMP_DIR")
|
38
38
|
RELEASE = int(os.getenv("RELEASE"))
|
39
39
|
MAJOR_VERSION = int(os.getenv("MAJOR_VERSION"))
|
cgc/utils/custom_exceptions.py
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
CUSTOM_EXCEPTIONS = {
|
5
5
|
500: {
|
6
6
|
"UNDEFINED": "undefined exception",
|
7
|
+
"USER_KEY_CREATE_ERROR": "Error while creating key",
|
7
8
|
},
|
8
9
|
413: {
|
9
10
|
"PVC_CREATE_STORAGE_LIMIT_EXCEEDED": "This request exceeds your storage limits",
|
@@ -17,6 +18,7 @@ CUSTOM_EXCEPTIONS = {
|
|
17
18
|
"RESOURCE_PORTS_ALREADY_EXISTS": "Port with this name already exists.",
|
18
19
|
"RESOURCE_TEMPLATE_NAME_ALREADY_EXISTS": "Resource with this name already exists.",
|
19
20
|
"JOB_CREATE_ALREADY_EXISTS": "Job with this name already exists.",
|
21
|
+
"USER_KEY_ALREADY_EXISTS": "Key with these data already exists.",
|
20
22
|
},
|
21
23
|
404: {
|
22
24
|
"PVC_CREATE_NO_SC": "Selected disk type and access mode unavailable",
|
@@ -33,6 +35,7 @@ CUSTOM_EXCEPTIONS = {
|
|
33
35
|
"COMPUTE_RESOURCE_QUOTA_NOT_FOUND": "You do not have enforced limits on your namespace.",
|
34
36
|
"JOB_NOT_FOUND": "Job with this name not found.",
|
35
37
|
"RESOURCE_NOT_FOUND": "Resource with this name not found.",
|
38
|
+
"USER_KEY_NOT_FOUND": "Key with this id not found.",
|
36
39
|
},
|
37
40
|
400: {
|
38
41
|
"WRONG_DATE_FORMAT": "Wrong date format.",
|
cgc/utils/message_utils.py
CHANGED
@@ -58,7 +58,7 @@ def key_error_decorator_for_helpers(func):
|
|
58
58
|
if "debug" in kwargs:
|
59
59
|
raise err
|
60
60
|
return prepare_error_message(UNKNOWN_ERROR)
|
61
|
-
except ResponseException as err:
|
61
|
+
except (ResponseException, click.ClickException) as err:
|
62
62
|
return prepare_warning_message(err)
|
63
63
|
|
64
64
|
return wrapper
|
cgc/utils/prepare_headers.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
from cgc.utils.config_utils import read_from_cfg
|
2
|
-
from cgc.utils.consts.env_consts import API_URL, CGC_SECRET
|
3
2
|
from cgc.commands.auth import auth_utils
|
4
3
|
from cgc.utils.message_utils import key_error_decorator_for_helpers
|
5
4
|
|
@@ -13,41 +12,51 @@ def load_user_api_keys():
|
|
13
12
|
return read_from_cfg("api_key"), read_from_cfg("api_secret")
|
14
13
|
|
15
14
|
|
15
|
+
def load_user_cgc_secret():
|
16
|
+
return read_from_cfg("cgc_secret")
|
17
|
+
|
18
|
+
|
19
|
+
def load_user_api_url():
|
20
|
+
return read_from_cfg("cgc_api_url")
|
21
|
+
|
22
|
+
|
16
23
|
@key_error_decorator_for_helpers
|
17
24
|
def get_api_url_and_prepare_headers():
|
18
|
-
"""Loads
|
25
|
+
"""Loads CGC_API_URL and user api keys into single function. Mend to be used as single point of truth for all endpoints except register - due to different Content-Type header
|
19
26
|
|
20
|
-
:return:
|
27
|
+
:return: CGC_API_URL and headers
|
21
28
|
:rtype: string and dict
|
22
29
|
"""
|
23
30
|
api_key, api_secret = load_user_api_keys()
|
24
31
|
headers = {
|
25
|
-
"Content-Type": "application/json; charset=UTF-8",
|
26
32
|
"accept": "application/json",
|
33
|
+
"Content-Type": "application/json; charset=UTF-8",
|
34
|
+
"comtegra-cgc": load_user_cgc_secret(),
|
27
35
|
"api-key": api_key,
|
28
36
|
"api-secret": api_secret,
|
29
|
-
"comtegra-cgc": CGC_SECRET,
|
30
37
|
}
|
31
|
-
return
|
38
|
+
return load_user_api_url(), headers
|
32
39
|
|
33
40
|
|
34
|
-
def get_url_and_prepare_headers_register(
|
41
|
+
def get_url_and_prepare_headers_register(
|
42
|
+
user_id: str, access_key: str, url: str = None, secret: str = None
|
43
|
+
):
|
35
44
|
"""Creates and returns url and headers for register request.
|
36
45
|
|
37
46
|
:return: url, headers
|
38
47
|
:rtype: string and dict
|
39
48
|
"""
|
40
|
-
url = f"{
|
49
|
+
url = f"{load_user_api_url() if url is None else url}/v1/api/user/register?user_id={user_id}&access_key={access_key}"
|
41
50
|
headers = {
|
42
51
|
"accept": "application/json",
|
43
|
-
"comtegra-cgc": CGC_SECRET,
|
44
52
|
"Content-Type": "octet-stream",
|
53
|
+
"comtegra-cgc": load_user_cgc_secret() if secret is None else secret,
|
45
54
|
}
|
46
55
|
return url, headers
|
47
56
|
|
48
57
|
|
49
58
|
def get_url_and_headers_jwt_token():
|
50
|
-
url = f"{
|
59
|
+
url = f"{load_user_api_url()}/v1/api/user/create/token"
|
51
60
|
headers = {
|
52
61
|
"accept": "application/json",
|
53
62
|
"Content-Type": "application/x-www-form-urlencoded",
|
@@ -64,8 +73,8 @@ def prepare_headers_api_key(user_id: str = None, password: str = None):
|
|
64
73
|
"""
|
65
74
|
headers = {
|
66
75
|
"accept": "application/json",
|
67
|
-
"comtegra-cgc": CGC_SECRET,
|
68
76
|
"Authorization": f"Bearer {auth_utils.get_jwt(user_id, password)}",
|
77
|
+
"comtegra-cgc": load_user_cgc_secret(),
|
69
78
|
}
|
70
79
|
return headers
|
71
80
|
|
@@ -76,10 +85,10 @@ def get_api_url_and_prepare_headers_version_control():
|
|
76
85
|
:return: url and headers in a for of dictionary
|
77
86
|
:rtype: string, dict
|
78
87
|
"""
|
79
|
-
url = f"{
|
88
|
+
url = f"{load_user_api_url()}/v1/api/info/version"
|
80
89
|
headers = {
|
81
90
|
"accept": "application/json",
|
82
|
-
"comtegra-cgc": CGC_SECRET,
|
83
91
|
"Content-Type": "application/json",
|
92
|
+
"comtegra-cgc": load_user_cgc_secret(),
|
84
93
|
}
|
85
94
|
return url, headers
|
cgc/utils/requests_helper.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
import requests
|
2
2
|
import urllib3
|
3
3
|
import urllib3.exceptions
|
4
|
-
import ssl
|
5
4
|
import click
|
6
5
|
import sys
|
7
6
|
|
@@ -19,7 +18,6 @@ from cgc.utils.consts.message_consts import (
|
|
19
18
|
|
20
19
|
urllib3.disable_warnings(urllib3.exceptions.SecurityWarning)
|
21
20
|
|
22
|
-
|
23
21
|
class EndpointTypes(Enum):
|
24
22
|
get = requests.get
|
25
23
|
post = requests.post
|
@@ -27,7 +25,7 @@ class EndpointTypes(Enum):
|
|
27
25
|
|
28
26
|
|
29
27
|
def _process_endpoint_kwargs(**kwargs):
|
30
|
-
if
|
28
|
+
if "timeout" not in kwargs.keys():
|
31
29
|
kwargs["timeout"] = 30
|
32
30
|
return kwargs
|
33
31
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: cgcsdk
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.9
|
4
4
|
Summary: Comtegra GPU Cloud REST API client
|
5
5
|
Author: Comtegra AI Team
|
6
6
|
Author-email: ai@comtegra.pl
|
@@ -30,8 +30,6 @@ Requires-Dist: statsd
|
|
30
30
|
Requires-Dist: requests
|
31
31
|
Requires-Dist: setuptools
|
32
32
|
Requires-Dist: colorama
|
33
|
-
Requires-Dist: redis
|
34
|
-
Requires-Dist: pymongo
|
35
33
|
Requires-Dist: psycopg2-binary
|
36
34
|
|
37
35
|
# Comtegra GPU Cloud CLI Client
|
@@ -54,10 +52,8 @@ For now, we provide the ability to spawn compute resources like:
|
|
54
52
|
Notebooks are equiped with all CUDA libraries and GPU drivers which enables the usage of GPU for accelerated computations.
|
55
53
|
Apart from compute resources, we provide the database engines accessible from within your namespace:
|
56
54
|
|
57
|
-
1. [
|
58
|
-
2. [
|
59
|
-
3. [Redis](https://redis.io/)
|
60
|
-
4. [Weaviate](https://weaviate.io/)
|
55
|
+
1. [PostgreSQL](https://www.postgresql.org/)
|
56
|
+
2. [Weaviate](https://weaviate.io/)
|
61
57
|
|
62
58
|
More are coming!
|
63
59
|
Please follow instructions to get started.
|
@@ -1,49 +1,53 @@
|
|
1
|
-
cgc/.env,sha256=
|
2
|
-
cgc/CHANGELOG.md,sha256=
|
1
|
+
cgc/.env,sha256=9SFROL8yLunt_B6HnKsZXY7RQ8-njO1_mScMhSQJ5Rs,209
|
2
|
+
cgc/CHANGELOG.md,sha256=Ndoiy_uhnTCvgJcTdTa_kFV06stYTVAT3tUHdMZbocI,8255
|
3
3
|
cgc/__init__.py,sha256=d03Xv8Pw4ktNyUHfmicP6XfxYPXnVYLaCZPyUlg_RNQ,326
|
4
|
-
cgc/cgc.py,sha256=
|
4
|
+
cgc/cgc.py,sha256=bW2Q2vcWfCBBkQ2nopXVCjW5GAbv6DGzTG-ZEn_VsLo,1571
|
5
5
|
cgc/config.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
6
|
cgc/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
7
|
cgc/commands/cgc_cmd.py,sha256=QwqjZl9FmAMOvuUQMJm-wOV88OxbdwK5UIS0zkg-mAo,4956
|
8
8
|
cgc/commands/cgc_cmd_responses.py,sha256=wO9Hf5_4jaw1ZRhQvh9Za0S_vhc22t-0_CoEGz5ndNE,2245
|
9
9
|
cgc/commands/cgc_helpers.py,sha256=ngArFjVw-8P_2g7J8k3b9xgDxfJw7JeaOtkhTySMSGU,1174
|
10
|
-
cgc/commands/
|
11
|
-
cgc/commands/
|
12
|
-
cgc/commands/auth/
|
13
|
-
cgc/commands/auth/
|
14
|
-
cgc/commands/auth/
|
10
|
+
cgc/commands/cgc_models.py,sha256=T4eCMO5AO2kZpIRqpZ7ZfgO9gxCo_MLlY33msCzrLvA,182
|
11
|
+
cgc/commands/exceptions.py,sha256=kVCWEdcqmkLO5QVIINdEXQw29_glyX2C11ZMFgT7b8E,155
|
12
|
+
cgc/commands/auth/__init__.py,sha256=JnqNezSEUEVVPQIymya4llXr8LIug2vymQSAGBr4Ovg,397
|
13
|
+
cgc/commands/auth/auth_cmd.py,sha256=FiRM16RGtP1zoJ9InbFAa-3W-EkJQbzBDxF0AmZa1JA,4196
|
14
|
+
cgc/commands/auth/auth_responses.py,sha256=oZ1aC7tyrT43imF2iMaL0u1jTJzuGLEmCN8RBeMxpf4,1959
|
15
|
+
cgc/commands/auth/auth_utils.py,sha256=-diCsKuF5UcQZoq962RuLktrG6sRmipJrDkm9Sf3wbg,5507
|
15
16
|
cgc/commands/billing/__init__.py,sha256=0arQm0R3Ouw7tXPooJsvWd_pGeHhzaVwQCbWMKQPT9A,753
|
16
17
|
cgc/commands/billing/billing_cmd.py,sha256=T1E5WW5Z-RlzddaotimTuvLvIbGihNpStIBETnlUznM,4140
|
17
18
|
cgc/commands/billing/billing_responses.py,sha256=HAD5N-Odx3Jz1OmhO4v66rHoXpTYIOGlXDsrs0da9dk,1949
|
18
19
|
cgc/commands/billing/billing_utils.py,sha256=zXLbBBcWeOgur-r0OKiIjaKeaxMNxASXWzCTeTsyC6o,4711
|
19
20
|
cgc/commands/compute/__init__.py,sha256=lCdLfZ0ECSHtXEUSwq5YRHH85yXHchSsz8ZJvmClPtI,239
|
20
21
|
cgc/commands/compute/compute_cmd.py,sha256=jgO61ULXIAuRn1LcFn0VU0X2-oLvBQB-0_OYMzXau0w,15490
|
21
|
-
cgc/commands/compute/compute_models.py,sha256=
|
22
|
+
cgc/commands/compute/compute_models.py,sha256=yse6mCEhhE2RdWIO7EHx4r5Y-350gWWy4UWFsdltNNg,778
|
22
23
|
cgc/commands/compute/compute_responses.py,sha256=eOmcllyOqPYqN0kSUzSpuC2S1rFmkkawgc_F-0-LSIQ,5807
|
23
24
|
cgc/commands/compute/compute_utills.py,sha256=XXnd_EuF9vCmW14r0ThlN98ScKSx3KAeqFbWy2g2mlk,8812
|
24
25
|
cgc/commands/db/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
25
|
-
cgc/commands/db/db_cmd.py,sha256=
|
26
|
+
cgc/commands/db/db_cmd.py,sha256=iA7YAgyosydMsRagus1nxbMTPhFlr1olUaWPVjV2BsA,3513
|
27
|
+
cgc/commands/db/db_models.py,sha256=oJUAF23nb_r8fSyhLHMJrRbRzLY_vpJQu6Vy4WRa0cg,1036
|
26
28
|
cgc/commands/debug/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
27
29
|
cgc/commands/debug/debug_cmd.py,sha256=kuAuh5YOqzGFjoiYZwfM9FJ1z5OeSpC0JAIUEzS83lM,412
|
28
30
|
cgc/commands/jobs/__init__.py,sha256=E-438wgIzlnGmXs5jgmWAhJ1KNV6UXF2gz8SXu3UxA0,231
|
29
|
-
cgc/commands/jobs/job_utils.py,sha256=
|
31
|
+
cgc/commands/jobs/job_utils.py,sha256=Pu8SvVrmxee_dfkc4eFHWe5AeV31RyiUwiuuSFYA8fo,6195
|
30
32
|
cgc/commands/jobs/jobs_cmd.py,sha256=Q-orK6B9Zk1zAf8sOM6QqF9Eeu092P-UEg4GRA-zX-s,6555
|
31
|
-
cgc/commands/jobs/jobs_responses.py,sha256=
|
33
|
+
cgc/commands/jobs/jobs_responses.py,sha256=QXFXA4zwQOo5Gvq5rEc7J_cxxsYqkdU19X9MCcZetUM,1771
|
34
|
+
cgc/commands/keys/__init__.py,sha256=rznd63OZhZvKHbdnXAsIBV_OWTnzHtFGfqzgNM4zCXk,112
|
35
|
+
cgc/commands/keys/keys_cmd.py,sha256=RQtDlvy31WNp7MgqrAfB1ydUya12wnr2eq1BOt2ZLz4,4437
|
36
|
+
cgc/commands/keys/keys_models.py,sha256=IYojnAu3aTGJ7qHIYvZy-0YFzXRmueZNplS4RqdfJfw,378
|
37
|
+
cgc/commands/keys/keys_responses.py,sha256=ENHRpUWEGX1r9mpMIwcVnYy6ikO0F1e-68834JHL9LE,1474
|
38
|
+
cgc/commands/keys/keys_utils.py,sha256=GiQcBoQdI6Zy_fvU9AVvBbUfaQx7g26s8NRbonmG474,2285
|
32
39
|
cgc/commands/resource/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
33
|
-
cgc/commands/resource/resource_cmd.py,sha256=
|
40
|
+
cgc/commands/resource/resource_cmd.py,sha256=6iVkl77ZHpgky5a1Qjof6sBKLMOnUzyqSbOiJ5BmhBQ,4090
|
34
41
|
cgc/commands/resource/resource_responses.py,sha256=sES7mAi_Cv5B6Z3I_6eUOqVwOr2HgMO45cz8MiNZetQ,197
|
35
42
|
cgc/commands/volume/__init__.py,sha256=Ou3kyb72aaXkrVCfQCVdniA65R2xHsRFgebooG1gflA,384
|
36
43
|
cgc/commands/volume/data_model.py,sha256=meprXdaXLo3mMTZta1ks1-BJ7G0rO16qi_ycH-sXJpY,1295
|
37
44
|
cgc/commands/volume/volume_cmd.py,sha256=5bd0vq5--Y7IfniO33tGBYH0Z67Le2s_AMTiwJcPBA4,7673
|
38
45
|
cgc/commands/volume/volume_responses.py,sha256=WefUohXxXZ9Znfc6P2XjoAM2RlA19hMKcVaW-xG9HWs,3199
|
39
46
|
cgc/commands/volume/volume_utils.py,sha256=n6s0FgpsYyxFMp_JdMRCzRi5Ar3_Svg9JDvWSdX4lhk,1919
|
40
|
-
cgc/sdk/__init__.py,sha256=
|
47
|
+
cgc/sdk/__init__.py,sha256=m8uAD2e_ADbHC4_kaOpLrUk_bHy7wC56rPjhcttclCs,177
|
41
48
|
cgc/sdk/exceptions.py,sha256=99XIzDO6LYKjex715troH-MkGUN7hi2Bit4KHfSHDis,214
|
42
|
-
cgc/sdk/
|
43
|
-
cgc/sdk/job.py,sha256=SclaqhY0rDACT_yg9e9AiYTsmXglIt6iTharwUPSAa4,5332
|
44
|
-
cgc/sdk/mongodb.py,sha256=TJ2XU7nilNRXLOIpQQPrRiVxHN2TaVM5QOSuMRtNDVs,7221
|
49
|
+
cgc/sdk/job.py,sha256=q9Vsarc3rKzurM4AOmbQDsQUVdyRqx0UzJVe_uO8xCU,5318
|
45
50
|
cgc/sdk/postgresql.py,sha256=ziXaMMwjSF3k1OAID3F9npqWVxreQaoZ8wn7X8x1FZw,1637
|
46
|
-
cgc/sdk/redis.py,sha256=W5wS9Sgyv4098yzWAwG7qEk4HEDwscE3JmWgPC3NCzc,2844
|
47
51
|
cgc/sdk/resource.py,sha256=Wodt8pe15zg1uuclfV4Qxntffph70ULhNig_gOgMKz8,13544
|
48
52
|
cgc/telemetry/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
49
53
|
cgc/telemetry/basic.py,sha256=XagCcyH4QSEPmfiQ1WCjqXslnJO6IaJCY0AMPySd5rc,3175
|
@@ -57,26 +61,26 @@ cgc/tests/desired_responses/test_compute_list.txt,sha256=3CDAuILJdwBmX6-GLj3zDbn
|
|
57
61
|
cgc/tests/desired_responses/test_compute_list_no_labels.txt,sha256=-OeQIaEHHsHZ81tCOI5j6VQYUMlj8VYcyyOU_DhPOpU,155
|
58
62
|
cgc/tests/desired_responses/test_tabulate_response.txt,sha256=beNyCTS9fwrHn4ueEOVk2BpOeSYZWumIa3H5EUGnW1I,789
|
59
63
|
cgc/tests/desired_responses/test_volume_list.txt,sha256=vYB1p50BBHD801q7LUdDc_aca4ezQ8CFLWw7I-b4Uao,309
|
60
|
-
cgc/utils/__init__.py,sha256=
|
64
|
+
cgc/utils/__init__.py,sha256=o3YYCh02WiAvmHw-8Hy3FJA4LjGWwPkaLTur6tEvsbE,3669
|
61
65
|
cgc/utils/click_group.py,sha256=Scfw8eMIyt2dE1ezUq2JuiI-E_LklqXQXJEr7L-EG6A,633
|
62
|
-
cgc/utils/config_utils.py,sha256=
|
63
|
-
cgc/utils/custom_exceptions.py,sha256=
|
64
|
-
cgc/utils/message_utils.py,sha256=
|
65
|
-
cgc/utils/prepare_headers.py,sha256=
|
66
|
-
cgc/utils/requests_helper.py,sha256=
|
66
|
+
cgc/utils/config_utils.py,sha256=NlPs334y6BSNGoYbFjrB5cKc9trTWIXOn8UN6O4ztNU,2884
|
67
|
+
cgc/utils/custom_exceptions.py,sha256=qvHdzaunZswZgN96iOHZIfLjehlJ79mcjqoMoW-tqEM,2628
|
68
|
+
cgc/utils/message_utils.py,sha256=FAiUC-0zJiMhfPQAQC0ki1ZUs1vI_QqHwLmfoCDbLeU,1790
|
69
|
+
cgc/utils/prepare_headers.py,sha256=67YMPogNoGbKnHQmGFc3iJCbsDZbRVjAIe3kBY-Dq98,2838
|
70
|
+
cgc/utils/requests_helper.py,sha256=1gorWHXtFkb8eSIXfftiPyqagHGVyJpD5yx2IF8mFHU,2038
|
67
71
|
cgc/utils/response_utils.py,sha256=9vJqAt2UFJ1n-oesFPe6CB_ooGoStjl-twY_31Jt4_I,7374
|
68
72
|
cgc/utils/update.py,sha256=AsQwhcBqsjgNPKn6AN6ojt0Ew5otvJXyshys6bjr7DQ,413
|
69
73
|
cgc/utils/version_control.py,sha256=VsqNzNYWDvU3VsoPuYIaZV7Img-K2_DmEOHd7rZlRxk,3267
|
70
74
|
cgc/utils/consts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
71
|
-
cgc/utils/consts/env_consts.py,sha256=
|
75
|
+
cgc/utils/consts/env_consts.py,sha256=8huPDBkbNEXoPHskFhYwiRi6TTw0_e9ylClpgh1NF2E,1290
|
72
76
|
cgc/utils/consts/message_consts.py,sha256=8CIe3N_HL6Pj-gSArkPkpegsvm-QMWxqqnSgtzG08Qw,1218
|
73
77
|
cgc/utils/cryptography/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
74
78
|
cgc/utils/cryptography/aes_crypto.py,sha256=S0rKg38oy7rM5lTrP6DDpjLA-XRxuZggAXyxMFHtyzY,3333
|
75
79
|
cgc/utils/cryptography/encryption_module.py,sha256=rbblBBorHYPGl-iKblyZX3_NuPEvUTpnH1l_RgNGCbA,1958
|
76
80
|
cgc/utils/cryptography/rsa_crypto.py,sha256=h3jU5qPpj9uVjP1rTqZJTdYB5yjhD9HZpr_nD439h9Q,4180
|
77
|
-
cgcsdk-1.0.
|
78
|
-
cgcsdk-1.0.
|
79
|
-
cgcsdk-1.0.
|
80
|
-
cgcsdk-1.0.
|
81
|
-
cgcsdk-1.0.
|
82
|
-
cgcsdk-1.0.
|
81
|
+
cgcsdk-1.0.9.dist-info/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
82
|
+
cgcsdk-1.0.9.dist-info/METADATA,sha256=wjetOTsxZ1T4g0eJ0DrDkkwCTHcVhJy8eGYZ5NEUR5w,3057
|
83
|
+
cgcsdk-1.0.9.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
84
|
+
cgcsdk-1.0.9.dist-info/entry_points.txt,sha256=bdfIHeJ6Y-BBr5yupCVoK7SUrJj1yNdew8OtIOg_3No,36
|
85
|
+
cgcsdk-1.0.9.dist-info/top_level.txt,sha256=nqW9tqcIcCXFigQT69AuOk7XHKc4pCuv4HGJQGXb6iA,12
|
86
|
+
cgcsdk-1.0.9.dist-info/RECORD,,
|
cgc/sdk/handlers.py
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
from pymongo.errors import OperationFailure, ConnectionFailure
|
2
|
-
# TODO: redis, postgres
|
3
|
-
# TODO: print -> click.echo ?
|
4
|
-
|
5
|
-
def exception_handler(func):
|
6
|
-
def inner_function(*args, **kwargs):
|
7
|
-
err_count = 0
|
8
|
-
err_limit = 3
|
9
|
-
while True and err_count < err_limit:
|
10
|
-
try:
|
11
|
-
err_count += 1
|
12
|
-
return func(*args, **kwargs)
|
13
|
-
except (ConnectionFailure,) as e:
|
14
|
-
print(f"MongoDB connection error: {e}")
|
15
|
-
print(f"retrying {err_count}/{err_limit} ...")
|
16
|
-
# args[0]._reset_connection()
|
17
|
-
except OperationFailure as e:
|
18
|
-
print(f"MongoDB OperationFailure: {e}")
|
19
|
-
raise e
|
20
|
-
else:
|
21
|
-
print(f"MongoDB exception for customer")
|
22
|
-
# TODO: HTTP EXCEPTION FOR CUSTOMER, but keep thread alive
|
23
|
-
|
24
|
-
return inner_function
|