cgcsdk 1.0.17__tar.gz → 1.1.0__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.
Files changed (101) hide show
  1. {cgcsdk-1.0.17/cgcsdk.egg-info → cgcsdk-1.1.0}/PKG-INFO +1 -1
  2. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/.env +2 -2
  3. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/CHANGELOG.md +15 -0
  4. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/auth/auth_utils.py +1 -1
  5. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/cgc_cmd_responses.py +10 -5
  6. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/compute/compute_responses.py +16 -4
  7. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/compute/compute_utils.py +2 -2
  8. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/jobs/job_utils.py +5 -4
  9. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/utils/version_control.py +3 -3
  10. {cgcsdk-1.0.17 → cgcsdk-1.1.0/cgcsdk.egg-info}/PKG-INFO +1 -1
  11. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/LICENSE +0 -0
  12. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/MANIFEST.in +0 -0
  13. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/README.md +0 -0
  14. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/__init__.py +0 -0
  15. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/cgc.py +0 -0
  16. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/__init__.py +0 -0
  17. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/auth/__init__.py +0 -0
  18. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/auth/auth_cmd.py +0 -0
  19. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/auth/auth_logic.py +0 -0
  20. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/auth/auth_responses.py +0 -0
  21. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/cgc_cmd.py +0 -0
  22. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/cgc_helpers.py +0 -0
  23. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/cgc_models.py +0 -0
  24. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/compute/__init__.py +0 -0
  25. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/compute/billing/__init__.py +0 -0
  26. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/compute/billing/billing_cmd.py +0 -0
  27. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/compute/billing/billing_responses.py +0 -0
  28. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/compute/billing/billing_utils.py +0 -0
  29. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/compute/compute_cmd.py +0 -0
  30. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/compute/compute_models.py +0 -0
  31. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/db/__init__.py +0 -0
  32. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/db/db_cmd.py +0 -0
  33. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/db/db_models.py +0 -0
  34. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/debug/__init__.py +0 -0
  35. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/debug/debug_cmd.py +0 -0
  36. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/exceptions.py +0 -0
  37. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/jobs/__init__.py +0 -0
  38. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/jobs/jobs_cmd.py +0 -0
  39. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/jobs/jobs_responses.py +0 -0
  40. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/resource/__init__.py +0 -0
  41. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/resource/resource_cmd.py +0 -0
  42. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/resource/resource_responses.py +0 -0
  43. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/user/__init__.py +0 -0
  44. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/user/keys_cmd.py +0 -0
  45. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/user/keys_models.py +0 -0
  46. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/user/keys_responses.py +0 -0
  47. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/user/keys_utils.py +0 -0
  48. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/user/secret_cmd.py +0 -0
  49. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/user/secret_models.py +0 -0
  50. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/user/secret_responses.py +0 -0
  51. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/user/secret_utils.py +0 -0
  52. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/volume/__init__.py +0 -0
  53. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/volume/data_model.py +0 -0
  54. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/volume/volume_cmd.py +0 -0
  55. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/volume/volume_models.py +0 -0
  56. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/volume/volume_responses.py +0 -0
  57. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/commands/volume/volume_utils.py +0 -0
  58. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/config.py +0 -0
  59. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/sdk/__init__.py +0 -0
  60. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/sdk/exceptions.py +0 -0
  61. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/sdk/job.py +0 -0
  62. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/sdk/postgresql.py +0 -0
  63. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/sdk/resource.py +0 -0
  64. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/server.crt +0 -0
  65. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/telemetry/__init__.py +0 -0
  66. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/telemetry/basic.py +0 -0
  67. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/tests/__init__.py +0 -0
  68. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/tests/desired_responses/test_billing_invoice.txt +0 -0
  69. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/tests/desired_responses/test_billing_status.txt +0 -0
  70. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/tests/desired_responses/test_billing_stop_events_compute.txt +0 -0
  71. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/tests/desired_responses/test_billing_stop_events_volume.txt +0 -0
  72. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/tests/desired_responses/test_compute_list.txt +0 -0
  73. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/tests/desired_responses/test_compute_list_no_labels.txt +0 -0
  74. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/tests/desired_responses/test_tabulate_response.txt +0 -0
  75. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/tests/desired_responses/test_volume_list.txt +0 -0
  76. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/tests/responses_tests.py +0 -0
  77. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/utils/__init__.py +0 -0
  78. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/utils/click_group.py +0 -0
  79. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/utils/config_utils.py +0 -0
  80. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/utils/consts/__init__.py +0 -0
  81. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/utils/consts/env_consts.py +0 -0
  82. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/utils/consts/message_consts.py +0 -0
  83. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/utils/cryptography/__init__.py +0 -0
  84. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/utils/cryptography/aes_crypto.py +0 -0
  85. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/utils/cryptography/encryption_module.py +0 -0
  86. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/utils/cryptography/rsa_crypto.py +0 -0
  87. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/utils/custom_exceptions.py +0 -0
  88. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/utils/get_headers_data.py +0 -0
  89. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/utils/message_utils.py +0 -0
  90. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/utils/prepare_headers.py +0 -0
  91. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/utils/requests_helper.py +0 -0
  92. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/utils/response_utils.py +0 -0
  93. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgc/utils/update.py +0 -0
  94. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgcsdk.egg-info/SOURCES.txt +0 -0
  95. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgcsdk.egg-info/dependency_links.txt +0 -0
  96. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgcsdk.egg-info/entry_points.txt +0 -0
  97. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgcsdk.egg-info/requires.txt +0 -0
  98. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/cgcsdk.egg-info/top_level.txt +0 -0
  99. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/pyproject.toml +0 -0
  100. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/setup.cfg +0 -0
  101. {cgcsdk-1.0.17 → cgcsdk-1.1.0}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cgcsdk
3
- Version: 1.0.17
3
+ Version: 1.1.0
4
4
  Summary: CGC Core REST API client
5
5
  Home-page: https://cgc.comtegra.cloud/
6
6
  Author: Comtegra AI Team
@@ -5,5 +5,5 @@ API_SECURE_CONNECTION=yes
5
5
  CONFIG_FILE_NAME = cfg.json
6
6
  TMP_DIR = .tmp
7
7
  RELEASE = 1
8
- MAJOR_VERSION = 0
9
- MINOR_VERSION = 17
8
+ MAJOR_VERSION = 1
9
+ MINOR_VERSION = 0
@@ -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
@@ -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=&username={user_id}&password={password}"
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 == "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
 
@@ -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
- ingress_data = data["details"]["ingress"]
18
- ingress_port_names = [port["port_name"] for port in ingress_data]
19
- for port in resource_ports_data:
20
- port["ingress"] = True if port["name"] in ingress_port_names else False
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"] != "filebrowser":
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)
@@ -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,
@@ -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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cgcsdk
3
- Version: 1.0.17
3
+ Version: 1.1.0
4
4
  Summary: CGC Core REST API client
5
5
  Home-page: https://cgc.comtegra.cloud/
6
6
  Author: Comtegra AI Team
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes