cgcsdk 1.0.16__py3-none-any.whl → 1.0.18__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 CHANGED
@@ -6,4 +6,4 @@ CONFIG_FILE_NAME = cfg.json
6
6
  TMP_DIR = .tmp
7
7
  RELEASE = 1
8
8
  MAJOR_VERSION = 0
9
- MINOR_VERSION = 16
9
+ MINOR_VERSION = 18
cgc/CHANGELOG.md CHANGED
@@ -1,8 +1,25 @@
1
1
  # Change Log
2
2
 
3
+ ## 1.0.18
4
+
5
+ Release on Aug 28, 2024
6
+
7
+ * `cgc job list` now also uses information from the job status
8
+ * `cgc compute port list` now shows full ingress path in the new column
9
+ * `cgc status` now shows user defined quotas
10
+
11
+ ## 1.0.17
12
+
13
+ Release on Aug 19, 2024
14
+
15
+ * `cgc port list` now shows which ports are ingress (`cgc resource ingress app_name`)
16
+ * fix bug for the `cgc keys ssh create` command
17
+ * `cgc context list` now shows which context is active
18
+ * `cgc context list` now shows context server address
19
+
3
20
  ## 1.0.16
4
21
 
5
- Release on Aug XX, 2024
22
+ Release on Aug 02, 2024
6
23
 
7
24
  * dynamic storage classes for volumes
8
25
  * dynamic templates available for compute
@@ -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 == "requests.cpu":
8
+ if resource == "limits.cpu":
9
9
  return "Total CPU"
10
- elif resource == "requests.memory":
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
- OTHER = 7
37
+ POD = 7
38
+ OTHER = 8
36
39
 
37
40
 
38
41
  def _resource_order(resource: str) -> ResourceOrder:
39
- if resource == "requests.cpu":
42
+ if resource == "limits.cpu":
40
43
  return ResourceOrder.CPU
41
- elif resource == "requests.memory":
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
 
@@ -1,12 +1,18 @@
1
1
  from typing import List
2
2
  from cgc.utils import quick_sort
3
- from cgc.utils.config_utils import read_from_cfg
3
+ from cgc.utils.config_utils import get_config_file_name, read_from_cfg
4
4
  from tabulate import tabulate
5
5
 
6
6
 
7
+ def _is_main_context_file(file: str) -> bool:
8
+ if get_config_file_name() == file:
9
+ return True
10
+ return None
11
+
12
+
7
13
  def table_of_user_context_files(config_files: List[str]):
8
14
  # print tabulate of: [context NR | namespace | user_id]
9
- headers = ["Context No.", "Namespace", "User ID"]
15
+ headers = ["Context No.", "Namespace", "User ID", "URL", "Is active"]
10
16
  contexts = []
11
17
  contexts_nrs = []
12
18
  for file in config_files:
@@ -16,13 +22,17 @@ def table_of_user_context_files(config_files: List[str]):
16
22
  ) # should never throw exception with good config_file list
17
23
  contexts_nrs.append(file_context[0])
18
24
  file_data = read_from_cfg(None, file)
19
- values_to_read = ["namespace", "user_id"]
25
+ values_to_read = ["namespace", "user_id", "cgc_api_url"]
20
26
  for k in values_to_read:
21
27
  try:
22
28
  value = file_data[k]
23
29
  except KeyError:
24
30
  value = None
31
+ if k == "cgc_api_url":
32
+ value = "https://cgc-api.comtegra.cloud:443"
25
33
  file_context.append(value)
34
+
35
+ file_context.append(_is_main_context_file(file))
26
36
  contexts.append(file_context)
27
37
 
28
38
  contexts_nrs_sorted = quick_sort(contexts_nrs)
@@ -9,12 +9,28 @@ from cgc.utils.response_utils import (
9
9
  tabulate_a_response,
10
10
  fill_missing_values_in_a_response,
11
11
  )
12
- from cgc.utils.message_utils import prepare_warning_message
13
12
 
14
13
 
15
14
  @key_error_decorator_for_helpers
16
15
  def get_compute_port_list(data: dict) -> list:
17
- return data["details"]["ports"]["ports"]
16
+ resource_ports_data = data["details"]["ports"]["ports"]
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
33
+ return resource_ports_data
18
34
 
19
35
 
20
36
  @key_error_decorator_for_helpers
@@ -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"] = job_pod["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,
@@ -14,3 +14,18 @@ class SSHKeyTypes(CGCEntityList):
14
14
  ECDSA_P384 = "ecdsa-sha2-nistp384"
15
15
  ECDSA_P521 = "ecdsa-sha2-nistp521"
16
16
  ED25519 = "ssh-ed25519"
17
+
18
+ def load_data() -> list:
19
+ """Return list of supported SSH key types
20
+
21
+ :return: list of supported SSH key types
22
+ :rtype: list
23
+ """
24
+ return [
25
+ SSHKeyTypes.RSA,
26
+ SSHKeyTypes.DSS,
27
+ SSHKeyTypes.ECDSA_P256,
28
+ SSHKeyTypes.ECDSA_P384,
29
+ SSHKeyTypes.ECDSA_P521,
30
+ SSHKeyTypes.ED25519,
31
+ ]
@@ -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
- anwser = input("Update now? (Y/N): ").lower()
70
- if anwser in ("y", "yes"):
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 anwser in ("n", "no"):
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,23 +1,20 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cgcsdk
3
- Version: 1.0.16
4
- Summary: Comtegra GPU Cloud REST API client
5
- Home-page: https://git.comtegra.pl/
3
+ Version: 1.0.18
4
+ Summary: CGC Core REST API client
5
+ Home-page: https://cgc.comtegra.cloud/
6
6
  Author: Comtegra AI Team
7
7
  Author-email: ai@comtegra.pl
8
8
  License: BSD 2-clause
9
9
  Project-URL: Documentation, https://docs.cgc.comtegra.cloud/
10
- Project-URL: GitHub, https://git.comtegra.pl/
11
- Project-URL: Changelog, https://git.comtegra.pl/foobar/foobar/blob/master/CHANGELOG.md
12
- Keywords: cloud,sdk,orchestrator,kubernetes,jupyter-notebook
13
- Classifier: Development Status :: 1 - Planning
10
+ Project-URL: GitHub, https://git.comtegra.pl/k8s/cgc-client-k8s-cloud
11
+ Project-URL: Changelog, https://git.comtegra.pl/k8s/cgc-client-k8s-cloud/-/blob/main/cgc/CHANGELOG.md
12
+ Keywords: cloud,sdk,orchestrator,kubernetes,jupyter-notebook,cgc-core
13
+ Classifier: Development Status :: 5 - Production/Stable
14
14
  Classifier: Intended Audience :: Science/Research
15
15
  Classifier: License :: OSI Approved :: BSD License
16
16
  Classifier: Operating System :: POSIX :: Linux
17
17
  Classifier: Programming Language :: Python :: 3
18
- Classifier: Programming Language :: Python :: 3.8
19
- Classifier: Programming Language :: Python :: 3.9
20
- Classifier: Programming Language :: Python :: 3.10
21
18
  Classifier: Programming Language :: Python :: 3.11
22
19
  Classifier: Programming Language :: Python :: 3.12
23
20
  Description-Content-Type: text/markdown
@@ -1,12 +1,12 @@
1
- cgc/.env,sha256=VMwTqev7-Fa9XaP3Ofy8Th-Dl2GurIWONmQgSLCUl2A,210
2
- cgc/CHANGELOG.md,sha256=gbcedsO6U2gjiefnjcOYV4czqaG0-QmtsSnykXZ_iL4,9625
1
+ cgc/.env,sha256=KTykewq9LWgx0m2GHM2FXfmPnd4v_qyo_DYZHZk-EHc,210
2
+ cgc/CHANGELOG.md,sha256=drq-88Bv02cAPKZ3A7YUoN9MBmq0lXEftYBzTKSqGug,10122
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=0bkRIxfd7EiVdShOubxhDiUSlGj6yEZQL_NOHtu334k,3525
9
- cgc/commands/cgc_helpers.py,sha256=ngArFjVw-8P_2g7J8k3b9xgDxfJw7JeaOtkhTySMSGU,1174
8
+ cgc/commands/cgc_cmd_responses.py,sha256=k8_rTAb9Ambnupg3NqCa7Te375D2YdeSVyhqz8xJg-Y,3647
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
12
12
  cgc/commands/auth/__init__.py,sha256=JnqNezSEUEVVPQIymya4llXr8LIug2vymQSAGBr4Ovg,397
@@ -17,7 +17,7 @@ cgc/commands/auth/auth_utils.py,sha256=8NZQQuR0JDCxRkNOHy8nRLDpeT3W87iNyaBI1owj7
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=DnRIZC_F1ZE887fMOXXYGYuYmB9n5x63sf8Ga_TL4Ww,5806
20
+ cgc/commands/compute/compute_responses.py,sha256=X1ExOKDIxSFZbBRbWyfWSCeRAe3_cFGa3jOgq6CfjHw,6439
21
21
  cgc/commands/compute/compute_utils.py,sha256=Pj4xa-C8-MzXF-CCnnHNXn0sXjHy_t-N7c-eig-vF1Y,9182
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
@@ -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=LlgMK11XQ-yjl_eOTFYwdJwOxyeiSCNkZQRZFpFW14A,6560
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
@@ -37,7 +37,7 @@ cgc/commands/resource/resource_cmd.py,sha256=y2R6ZF0jFhTppD9JUpwLIcEdFRXg82Xw_5y
37
37
  cgc/commands/resource/resource_responses.py,sha256=sES7mAi_Cv5B6Z3I_6eUOqVwOr2HgMO45cz8MiNZetQ,197
38
38
  cgc/commands/user/__init__.py,sha256=Rhaa2SDXQsJVJnTX0oFyZ90tAuiAUBeRy3Bd415S4os,382
39
39
  cgc/commands/user/keys_cmd.py,sha256=dfHnhHmEwRH1xl_wRNQcpCT-THJTBYPHMTJSI2AsDXE,4509
40
- cgc/commands/user/keys_models.py,sha256=IYojnAu3aTGJ7qHIYvZy-0YFzXRmueZNplS4RqdfJfw,378
40
+ cgc/commands/user/keys_models.py,sha256=FhpVZ--AUQf-Q8cvnSD2Gysrh38awqXSc-jT3yKnk2s,767
41
41
  cgc/commands/user/keys_responses.py,sha256=TBHFWAVN1kEgP6sudbMwfpiZOcfTr0a0SD-f-Wn-ed8,1389
42
42
  cgc/commands/user/keys_utils.py,sha256=w1TcMTlKJNxXjnj-XsiUU8N__-l1TsWqfPPjGpRqtI0,2285
43
43
  cgc/commands/user/secret_cmd.py,sha256=_b9ewJlEE4gMCrgdyycpO5MOdJvibeHObAiPE-mWIgA,4165
@@ -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=MTXpwFC0zl0xKZsllFHZMOUm0VuihA0u3g4jVW70c7w,4163
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.16.dist-info/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
89
- cgcsdk-1.0.16.dist-info/METADATA,sha256=omC-JocyzpOolm58Rv7yP2lYEqvBDwAfl8EPP_OsGSw,3091
90
- cgcsdk-1.0.16.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
91
- cgcsdk-1.0.16.dist-info/entry_points.txt,sha256=bdfIHeJ6Y-BBr5yupCVoK7SUrJj1yNdew8OtIOg_3No,36
92
- cgcsdk-1.0.16.dist-info/top_level.txt,sha256=nqW9tqcIcCXFigQT69AuOk7XHKc4pCuv4HGJQGXb6iA,12
93
- cgcsdk-1.0.16.dist-info/RECORD,,
88
+ cgcsdk-1.0.18.dist-info/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
89
+ cgcsdk-1.0.18.dist-info/METADATA,sha256=VTXLNnbKhUMb3xRdPkwr7cxYMUD-tcm86wkHH6TLHfo,2987
90
+ cgcsdk-1.0.18.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
91
+ cgcsdk-1.0.18.dist-info/entry_points.txt,sha256=bdfIHeJ6Y-BBr5yupCVoK7SUrJj1yNdew8OtIOg_3No,36
92
+ cgcsdk-1.0.18.dist-info/top_level.txt,sha256=nqW9tqcIcCXFigQT69AuOk7XHKc4pCuv4HGJQGXb6iA,12
93
+ cgcsdk-1.0.18.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (72.1.0)
2
+ Generator: setuptools (75.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5