cgcsdk 1.0.17__py3-none-any.whl → 1.1.0__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 +2 -2
- cgc/CHANGELOG.md +15 -0
- cgc/commands/auth/auth_utils.py +1 -1
- cgc/commands/cgc_cmd_responses.py +10 -5
- cgc/commands/compute/compute_responses.py +16 -4
- cgc/commands/compute/compute_utils.py +2 -2
- cgc/commands/jobs/job_utils.py +5 -4
- cgc/utils/version_control.py +3 -3
- {cgcsdk-1.0.17.dist-info → cgcsdk-1.1.0.dist-info}/METADATA +1 -1
- {cgcsdk-1.0.17.dist-info → cgcsdk-1.1.0.dist-info}/RECORD +14 -14
- {cgcsdk-1.0.17.dist-info → cgcsdk-1.1.0.dist-info}/WHEEL +1 -1
- {cgcsdk-1.0.17.dist-info → cgcsdk-1.1.0.dist-info}/LICENSE +0 -0
- {cgcsdk-1.0.17.dist-info → cgcsdk-1.1.0.dist-info}/entry_points.txt +0 -0
- {cgcsdk-1.0.17.dist-info → cgcsdk-1.1.0.dist-info}/top_level.txt +0 -0
cgc/.env
CHANGED
cgc/CHANGELOG.md
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 1.1.0
|
4
|
+
|
5
|
+
Release on Oct 02, 2024
|
6
|
+
|
7
|
+
* fix: not required `app-token` label for computes
|
8
|
+
* update: grant_type for JWT authentication
|
9
|
+
|
10
|
+
## 1.0.18
|
11
|
+
|
12
|
+
Release on Aug 28, 2024
|
13
|
+
|
14
|
+
* `cgc job list` now also uses information from the job status
|
15
|
+
* `cgc compute port list` now shows full ingress path in the new column
|
16
|
+
* `cgc status` now shows user defined quotas
|
17
|
+
|
3
18
|
## 1.0.17
|
4
19
|
|
5
20
|
Release on Aug 19, 2024
|
cgc/commands/auth/auth_utils.py
CHANGED
@@ -37,7 +37,7 @@ def _get_jwt_from_server(user_id: str = None, password: str = None) -> str:
|
|
37
37
|
"Content-Type": "application/x-www-form-urlencoded",
|
38
38
|
}
|
39
39
|
metric = "auth.jwt"
|
40
|
-
__payload = f"grant_type
|
40
|
+
__payload = f"grant_type=password&username={user_id}&password={password}"
|
41
41
|
__res = call_api(
|
42
42
|
request=EndpointTypes.post,
|
43
43
|
url=url,
|
@@ -5,9 +5,9 @@ from cgc.utils.message_utils import key_error_decorator_for_helpers
|
|
5
5
|
|
6
6
|
|
7
7
|
def _resource_match(resource: str) -> Union[str, None]:
|
8
|
-
if resource == "
|
8
|
+
if resource == "limits.cpu":
|
9
9
|
return "Total CPU"
|
10
|
-
elif resource == "
|
10
|
+
elif resource == "limits.memory":
|
11
11
|
return "Total RAM"
|
12
12
|
elif resource == "requests.nvidia.com/gpu":
|
13
13
|
return "Total GPU"
|
@@ -21,6 +21,8 @@ def _resource_match(resource: str) -> Union[str, None]:
|
|
21
21
|
elif resource.endswith(".storageclass.storage.k8s.io/requests.storage"):
|
22
22
|
storage_class = resource.split(".")[0]
|
23
23
|
return f"Storage ({storage_class})"
|
24
|
+
elif resource == "pods":
|
25
|
+
return "Pod Count"
|
24
26
|
else:
|
25
27
|
return None
|
26
28
|
|
@@ -32,13 +34,14 @@ class ResourceOrder(Enum):
|
|
32
34
|
STORAGE = 4
|
33
35
|
VOLUME = 5
|
34
36
|
GPU_TYPE = 6
|
35
|
-
|
37
|
+
POD = 7
|
38
|
+
OTHER = 8
|
36
39
|
|
37
40
|
|
38
41
|
def _resource_order(resource: str) -> ResourceOrder:
|
39
|
-
if resource == "
|
42
|
+
if resource == "limits.cpu":
|
40
43
|
return ResourceOrder.CPU
|
41
|
-
elif resource == "
|
44
|
+
elif resource == "limits.memory":
|
42
45
|
return ResourceOrder.MEMORY
|
43
46
|
elif resource == "requests.nvidia.com/gpu":
|
44
47
|
return ResourceOrder.GPU
|
@@ -50,6 +53,8 @@ def _resource_order(resource: str) -> ResourceOrder:
|
|
50
53
|
return ResourceOrder.STORAGE
|
51
54
|
elif resource.endswith(".storageclass.storage.k8s.io/requests.storage"):
|
52
55
|
return ResourceOrder.STORAGE
|
56
|
+
elif resource == "pods":
|
57
|
+
return ResourceOrder.POD
|
53
58
|
else:
|
54
59
|
return ResourceOrder.OTHER
|
55
60
|
|
@@ -14,10 +14,22 @@ from cgc.utils.response_utils import (
|
|
14
14
|
@key_error_decorator_for_helpers
|
15
15
|
def get_compute_port_list(data: dict) -> list:
|
16
16
|
resource_ports_data = data["details"]["ports"]["ports"]
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
try:
|
18
|
+
ingress_data = data["details"]["ingress"]
|
19
|
+
ingress_port_names = [port["port_name"] for port in ingress_data]
|
20
|
+
for port in resource_ports_data:
|
21
|
+
port["ingress"] = True if port["name"] in ingress_port_names else False
|
22
|
+
port_data = next(
|
23
|
+
(
|
24
|
+
ingress
|
25
|
+
for ingress in ingress_data
|
26
|
+
if ingress["port_name"] == port["name"]
|
27
|
+
),
|
28
|
+
None,
|
29
|
+
)
|
30
|
+
port["ingress_url"] = port_data.get("url", "") if port_data else ""
|
31
|
+
except KeyError:
|
32
|
+
pass # no ingress data, server outdated
|
21
33
|
return resource_ports_data
|
22
34
|
|
23
35
|
|
@@ -113,11 +113,11 @@ def get_app_list(pod_list: list, detailed: bool) -> list:
|
|
113
113
|
pod["labels"].pop("entity")
|
114
114
|
if detailed:
|
115
115
|
pod["labels"]["url"] = pod["labels"]["pod_url"]
|
116
|
-
if pod_data["type"]
|
116
|
+
if pod_data["type"] == "nvidia-pytorch":
|
117
117
|
pod["labels"]["url"] += f"""/?token={pod["labels"]['app-token']}"""
|
118
118
|
else:
|
119
119
|
pod["labels"]["url"] = pod["labels"]["pod_url"]
|
120
|
-
pod["labels"].pop("app-token")
|
120
|
+
pod["labels"].pop("app-token", None)
|
121
121
|
pod["labels"].pop("pod_url")
|
122
122
|
pod["labels"].pop("resource-type")
|
123
123
|
pod["labels"].pop("api-key-id", None)
|
cgc/commands/jobs/job_utils.py
CHANGED
@@ -122,7 +122,10 @@ def get_job_list(job_list: list, job_pod_list: list):
|
|
122
122
|
for job_pod in job_pod_list:
|
123
123
|
job_pod_labels: dict = job_pod.get("labels", {})
|
124
124
|
if job_pod_labels.get("app-name", "") == job.get("name"):
|
125
|
-
job["status"]
|
125
|
+
if job["status"] is not None and job["status"] == "Unknown":
|
126
|
+
job["status"] = job_pod["status"] # try to get status from pod
|
127
|
+
elif job["status"] is None: # support older server versions
|
128
|
+
job["status"] = job_pod["status"]
|
126
129
|
job["gpu-count"] = job_pod_labels.get("gpu-count", 0)
|
127
130
|
job["gpu-label"] = job_pod_labels.get("gpu-label", "N/A")
|
128
131
|
# job["status_reason"] = [
|
@@ -166,9 +169,7 @@ def get_job_json_data(job_list: list):
|
|
166
169
|
|
167
170
|
job_data = {
|
168
171
|
"name": job.get("labels", {}).get("app-name"),
|
169
|
-
"status": job.get("status", {}).get(
|
170
|
-
"phase", "Unknown"
|
171
|
-
), # only happen when Pod "disappeared" from the k8s - BUG
|
172
|
+
"status": job.get("status", {}).get("phase", "Unknown"),
|
172
173
|
"volumes_mounted": volumes_mounted,
|
173
174
|
"cpu": cpu,
|
174
175
|
"ram": ram,
|
cgc/utils/version_control.py
CHANGED
@@ -66,8 +66,8 @@ def check_version():
|
|
66
66
|
click.echo(prepare_error_message(OUTDATED_MAJOR))
|
67
67
|
print_compare_versions(server_version, client_version)
|
68
68
|
while True:
|
69
|
-
|
70
|
-
if
|
69
|
+
answer = input("Update now? (Y/N): ").lower()
|
70
|
+
if answer in ("y", "yes"):
|
71
71
|
update_file_path = os.path.join(os.path.dirname(__file__), "update.py")
|
72
72
|
try:
|
73
73
|
subprocess.Popen([sys.executable, update_file_path])
|
@@ -78,7 +78,7 @@ def check_version():
|
|
78
78
|
"Could not initiate update, try again or install update manually with: pip install --upgrade cgcsdk"
|
79
79
|
)
|
80
80
|
)
|
81
|
-
if
|
81
|
+
if answer in ("n", "no"):
|
82
82
|
sys.exit()
|
83
83
|
else:
|
84
84
|
click.echo(prepare_warning_message("wrong input, please try again."))
|
@@ -1,11 +1,11 @@
|
|
1
|
-
cgc/.env,sha256=
|
2
|
-
cgc/CHANGELOG.md,sha256=
|
1
|
+
cgc/.env,sha256=U3C0HJQT97waXH8lYgrRl4JwcuH_0YpwS25TKm8U9xY,209
|
2
|
+
cgc/CHANGELOG.md,sha256=A-OH4XghR7LI9eAVrdiphDuAEuhYVHi1k4HZ2fgFF-8,10253
|
3
3
|
cgc/__init__.py,sha256=d03Xv8Pw4ktNyUHfmicP6XfxYPXnVYLaCZPyUlg_RNQ,326
|
4
4
|
cgc/cgc.py,sha256=3I_Ef0ggX9caaJKJkhfGYSe8XwkHzSWxwGAClMHDnUs,1663
|
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=xuRoMtO7VG0sZbOFrEGxPWRg94SBrgyRJDQif4el7UM,5031
|
8
|
-
cgc/commands/cgc_cmd_responses.py,sha256=
|
8
|
+
cgc/commands/cgc_cmd_responses.py,sha256=k8_rTAb9Ambnupg3NqCa7Te375D2YdeSVyhqz8xJg-Y,3647
|
9
9
|
cgc/commands/cgc_helpers.py,sha256=-RduMrEDknGx-bxLRUX413JY9nuqWxBIGcwbwWrnDb4,1516
|
10
10
|
cgc/commands/cgc_models.py,sha256=ThYrflL6gfiu3u3cWCbiisY7vfkKbo9JGqd5Jqr2jXc,352
|
11
11
|
cgc/commands/exceptions.py,sha256=kVCWEdcqmkLO5QVIINdEXQw29_glyX2C11ZMFgT7b8E,155
|
@@ -13,12 +13,12 @@ cgc/commands/auth/__init__.py,sha256=JnqNezSEUEVVPQIymya4llXr8LIug2vymQSAGBr4Ovg
|
|
13
13
|
cgc/commands/auth/auth_cmd.py,sha256=f8_2oIlFQ1k0zvJXGfrwkdVoK5EJBwWesNdOcjtY_uM,4220
|
14
14
|
cgc/commands/auth/auth_logic.py,sha256=PzEyC6OBRSne_5dQT-cq69J0i8BqfGL0MIoXW-yM8qE,2281
|
15
15
|
cgc/commands/auth/auth_responses.py,sha256=kIGyCbNqSQKhDsVpIIcbzR-1bFQHkC3ClbUPBNfKPwk,2095
|
16
|
-
cgc/commands/auth/auth_utils.py,sha256=
|
16
|
+
cgc/commands/auth/auth_utils.py,sha256=3RSBAR_V5DANhJ_R0cN4poP2uCNdx2tU1VXxP17yXig,3605
|
17
17
|
cgc/commands/compute/__init__.py,sha256=lCdLfZ0ECSHtXEUSwq5YRHH85yXHchSsz8ZJvmClPtI,239
|
18
18
|
cgc/commands/compute/compute_cmd.py,sha256=YZYR0milioX8aShLUC5NSKWcJSimQx6d4WmweAgdCrw,16131
|
19
19
|
cgc/commands/compute/compute_models.py,sha256=MNwxG94fFJfaQ3kGlVXSJh1H5qPHLSU_6BnoiuWS7UA,860
|
20
|
-
cgc/commands/compute/compute_responses.py,sha256=
|
21
|
-
cgc/commands/compute/compute_utils.py,sha256=
|
20
|
+
cgc/commands/compute/compute_responses.py,sha256=X1ExOKDIxSFZbBRbWyfWSCeRAe3_cFGa3jOgq6CfjHw,6439
|
21
|
+
cgc/commands/compute/compute_utils.py,sha256=KNP-FRIeK20rBRoeyPCO5zKc90nXKQHH0pJ4-lZdNwY,9191
|
22
22
|
cgc/commands/compute/billing/__init__.py,sha256=ccjz-AzBCROjuR11qZRM4_62slI9ErmLi27xPUoRPHM,752
|
23
23
|
cgc/commands/compute/billing/billing_cmd.py,sha256=8lGf2GPyr09ZmqkRshmgfSPQgXa9o_IDSfwZgMfBE4k,4156
|
24
24
|
cgc/commands/compute/billing/billing_responses.py,sha256=5vQSR_d41uizengzfXlHXL7XivO_73PpWdKmoUgqYNw,1965
|
@@ -29,7 +29,7 @@ cgc/commands/db/db_models.py,sha256=zpMcrDBanLx7YQJ_-PWrQCbh3B-C0qWn1Pt5SnDwsh0,
|
|
29
29
|
cgc/commands/debug/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
30
30
|
cgc/commands/debug/debug_cmd.py,sha256=kuAuh5YOqzGFjoiYZwfM9FJ1z5OeSpC0JAIUEzS83lM,412
|
31
31
|
cgc/commands/jobs/__init__.py,sha256=E-438wgIzlnGmXs5jgmWAhJ1KNV6UXF2gz8SXu3UxA0,231
|
32
|
-
cgc/commands/jobs/job_utils.py,sha256=
|
32
|
+
cgc/commands/jobs/job_utils.py,sha256=pvTVEDqBazt6617sXsCMmlttCD6wZPpGQIrcrOd0Hyw,6707
|
33
33
|
cgc/commands/jobs/jobs_cmd.py,sha256=4zHZtT2y_FoBrGNR5nfSJ0gi-MX1rUP68KwpvuZ8m0Q,6922
|
34
34
|
cgc/commands/jobs/jobs_responses.py,sha256=QXFXA4zwQOo5Gvq5rEc7J_cxxsYqkdU19X9MCcZetUM,1771
|
35
35
|
cgc/commands/resource/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -77,7 +77,7 @@ cgc/utils/prepare_headers.py,sha256=Hi3WNqtqydW56tNTLZmpfMTpu4aKCoDrLx4OcCGH9_U,
|
|
77
77
|
cgc/utils/requests_helper.py,sha256=Z89dTOTbSSi1xmtNPmAdJpduR9-DC12WEQsHYeuM9a0,2046
|
78
78
|
cgc/utils/response_utils.py,sha256=9vJqAt2UFJ1n-oesFPe6CB_ooGoStjl-twY_31Jt4_I,7374
|
79
79
|
cgc/utils/update.py,sha256=AsQwhcBqsjgNPKn6AN6ojt0Ew5otvJXyshys6bjr7DQ,413
|
80
|
-
cgc/utils/version_control.py,sha256=
|
80
|
+
cgc/utils/version_control.py,sha256=rnHeo8_y-8HJfEKLqpiMM26QR8b-CAl3zfgcv0a3y8I,4163
|
81
81
|
cgc/utils/consts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
82
82
|
cgc/utils/consts/env_consts.py,sha256=_yHjhXDBwYfLfUWfHOPlhGdzC0j9VFlkjKuSrvblBsU,1154
|
83
83
|
cgc/utils/consts/message_consts.py,sha256=xSW7XaqPIAO_uJr-eK2fcjP2o7t0OJ0OP75otbUBnAg,1232
|
@@ -85,9 +85,9 @@ cgc/utils/cryptography/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
|
|
85
85
|
cgc/utils/cryptography/aes_crypto.py,sha256=S0rKg38oy7rM5lTrP6DDpjLA-XRxuZggAXyxMFHtyzY,3333
|
86
86
|
cgc/utils/cryptography/encryption_module.py,sha256=rbblBBorHYPGl-iKblyZX3_NuPEvUTpnH1l_RgNGCbA,1958
|
87
87
|
cgc/utils/cryptography/rsa_crypto.py,sha256=h3jU5qPpj9uVjP1rTqZJTdYB5yjhD9HZpr_nD439h9Q,4180
|
88
|
-
cgcsdk-1.0.
|
89
|
-
cgcsdk-1.0.
|
90
|
-
cgcsdk-1.0.
|
91
|
-
cgcsdk-1.0.
|
92
|
-
cgcsdk-1.0.
|
93
|
-
cgcsdk-1.0.
|
88
|
+
cgcsdk-1.1.0.dist-info/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
89
|
+
cgcsdk-1.1.0.dist-info/METADATA,sha256=OSfHEfaDvQhZ5y0tzORo9jwUKcOgsyf0FgyxyGVJAQc,2986
|
90
|
+
cgcsdk-1.1.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
91
|
+
cgcsdk-1.1.0.dist-info/entry_points.txt,sha256=bdfIHeJ6Y-BBr5yupCVoK7SUrJj1yNdew8OtIOg_3No,36
|
92
|
+
cgcsdk-1.1.0.dist-info/top_level.txt,sha256=nqW9tqcIcCXFigQT69AuOk7XHKc4pCuv4HGJQGXb6iA,12
|
93
|
+
cgcsdk-1.1.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|