yellowdog-python-examples 8.1.5__py3-none-any.whl → 8.1.7__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.
yellowdog_cli/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "8.1.5"
1
+ __version__ = "8.1.7"
yellowdog_cli/create.py CHANGED
@@ -1319,8 +1319,10 @@ def create_namespace(resource: Dict):
1319
1319
  )
1320
1320
  except Exception as e:
1321
1321
  if "ConflictException" in str(e):
1322
- raise Exception(f"Namespace '{name}' already exists")
1323
- raise Exception(f"Failed to create namespace '{name}' ({e})")
1322
+ print_warning(f"Namespace '{name}' already exists")
1323
+ return
1324
+ else:
1325
+ raise Exception(f"Failed to create namespace '{name}' ({e})")
1324
1326
 
1325
1327
  print_log(f"Created namespace '{name}' ({namespace_id})")
1326
1328
 
yellowdog_cli/remove.py CHANGED
@@ -151,7 +151,7 @@ def remove_compute_source_template(resource: Dict):
151
151
 
152
152
  source_id = find_compute_source_template_id_by_name(CLIENT, name)
153
153
  if source_id is None:
154
- print_error(f"Cannot find Compute Source Template '{name}'")
154
+ print_warning(f"Cannot find Compute Source Template '{name}'")
155
155
  return
156
156
 
157
157
  if not confirmed(f"Remove Compute Source Template '{name}'?"):
@@ -181,7 +181,7 @@ def remove_compute_requirement_template(resource: Dict):
181
181
 
182
182
  template_id = find_compute_requirement_template_id_by_name(CLIENT, name)
183
183
  if template_id is None:
184
- print_error(f"Cannot find Compute Requirement Template '{name}'")
184
+ print_warning(f"Cannot find Compute Requirement Template '{name}'")
185
185
  return
186
186
 
187
187
  if not confirmed(f"Remove Compute Requirement Template '{name}' ({template_id})?"):
@@ -215,7 +215,7 @@ def remove_keyring(resource: Dict):
215
215
  print_log(f"Removed Keyring '{name}'")
216
216
  except HTTPError as e:
217
217
  if e.response.status_code == 404:
218
- print_error(f"Cannot find Keyring '{name}'")
218
+ print_warning(f"Cannot find Keyring '{name}'")
219
219
  else:
220
220
  print_error(f"Unable to remove Keyring '{name}': {e}")
221
221
 
@@ -245,7 +245,7 @@ def remove_credential(resource: Dict):
245
245
  )
246
246
  except HTTPError as e:
247
247
  if e.response.status_code == 404:
248
- print_error(
248
+ print_warning(
249
249
  f"Cannot find Keyring '{keyring_name}'(possibly already deleted,"
250
250
  " including its credentials?)"
251
251
  )
@@ -275,7 +275,7 @@ def remove_image_family(resource: Dict):
275
275
  )
276
276
  except HTTPError as e:
277
277
  if e.response.status_code == 404:
278
- print_error(f"Cannot find Machine Image Family '{fq_name}'")
278
+ print_warning(f"Cannot find Machine Image Family '{fq_name}'")
279
279
  return
280
280
  else:
281
281
  raise e
@@ -304,7 +304,7 @@ def remove_namespace_configuration(resource: Dict):
304
304
  CLIENT.object_store_client.get_namespace_storage_configurations()
305
305
  )
306
306
  if namespace not in [x.namespace for x in namespaces]:
307
- print_error(f"Cannot find Namespace Storage Configuration '{namespace}'")
307
+ print_warning(f"Cannot find Namespace Storage Configuration '{namespace}'")
308
308
  return
309
309
 
310
310
  if not confirmed(f"Remove Namespace Storage Configuration '{namespace}'?"):
@@ -365,7 +365,7 @@ def remove_configured_worker_pool(resource: Dict):
365
365
  return
366
366
 
367
367
  else:
368
- print_error(f"Cannot find Configured Worker Pool '{fq_name}'")
368
+ print_warning(f"Cannot find Configured Worker Pool '{fq_name}'")
369
369
 
370
370
 
371
371
  def remove_allowance(resource: Dict):
@@ -428,7 +428,7 @@ def remove_resource_by_id(resource_id: str):
428
428
  CLIENT.keyring_client.delete_keyring_by_name(keyring.name)
429
429
  print_log(f"Removed Keyring {resource_id}")
430
430
  return
431
- raise Exception(f"Cannot find Keyring {resource_id}")
431
+ print_warning(f"Cannot find Keyring {resource_id}")
432
432
 
433
433
  elif get_ydid_type(resource_id) == YDIDType.WORKER_POOL:
434
434
  if confirmed(f"Shut down Worker Pool {resource_id}?"):
@@ -497,7 +497,7 @@ def remove_namespace_policy(resource: Dict):
497
497
  return
498
498
  except Exception:
499
499
  # Assume it's not found ... 404 from API
500
- print_error(f"Cannot find Namespace Policy '{namespace}'")
500
+ print_warning(f"Cannot find Namespace Policy '{namespace}'")
501
501
  return
502
502
 
503
503
  if not confirmed(f"Remove Namespace Policy '{namespace}'?"):
yellowdog_cli/shutdown.py CHANGED
@@ -16,11 +16,12 @@ from yellowdog_client.model import (
16
16
  from yellowdog_cli.utils.entity_utils import (
17
17
  get_worker_pool_by_id,
18
18
  get_worker_pool_id_by_name,
19
+ get_worker_pools,
19
20
  )
20
21
  from yellowdog_cli.utils.follow_utils import follow_ids
21
22
  from yellowdog_cli.utils.interactive import confirmed, select
22
23
  from yellowdog_cli.utils.misc_utils import link_entity
23
- from yellowdog_cli.utils.printing import print_error, print_log
24
+ from yellowdog_cli.utils.printing import print_error, print_log, print_warning
24
25
  from yellowdog_cli.utils.wrapper import ARGS_PARSER, CLIENT, CONFIG_COMMON, main_wrapper
25
26
  from yellowdog_cli.utils.ydid_utils import YDIDType, get_ydid_type
26
27
 
@@ -37,9 +38,10 @@ def main():
37
38
  f"names including '{CONFIG_COMMON.name_tag}'"
38
39
  )
39
40
 
40
- worker_pool_summaries: List[WorkerPoolSummary] = (
41
- CLIENT.worker_pool_client.find_all_worker_pools()
41
+ worker_pool_summaries: List[WorkerPoolSummary] = get_worker_pools(
42
+ CLIENT, CONFIG_COMMON.namespace, CONFIG_COMMON.name_tag
42
43
  )
44
+
43
45
  shutdown_count = 0
44
46
 
45
47
  selected_worker_pool_summaries: List[WorkerPoolSummary] = []
@@ -73,7 +75,7 @@ def main():
73
75
  print_log(f"Shut down {link_entity(CONFIG_COMMON.url, worker_pool)}")
74
76
  optionally_terminate_compute_requirement(worker_pool_summary.id)
75
77
  except Exception as e:
76
- print_error(f"Unable to shut down '{worker_pool_summary.name}': {e}")
78
+ print_error(f"Failed to shut down '{worker_pool_summary.name}': {e}")
77
79
 
78
80
  if shutdown_count > 0:
79
81
  print_log(f"Shut down {shutdown_count} Worker Pool(s)")
@@ -101,7 +103,7 @@ def shutdown_by_names_or_ids(names_or_ids: List[str]):
101
103
  else:
102
104
  worker_pool_id = get_worker_pool_id_by_name(CLIENT, name_or_id)
103
105
  if worker_pool_id is None:
104
- print_error(f"Worker Pool '{name_or_id}' not found")
106
+ print_warning(f"Worker Pool '{name_or_id}' not found")
105
107
  continue
106
108
  worker_pool_ids.append(worker_pool_id)
107
109
 
@@ -120,14 +122,14 @@ def shutdown_by_names_or_ids(names_or_ids: List[str]):
120
122
  print_log(f"Shut down Worker Pool '{worker_pool_id}'")
121
123
  optionally_terminate_compute_requirement(worker_pool_id)
122
124
  except Exception as e:
123
- print_error(f"Unable to shut down Worker Pool '{worker_pool_id}': ({e})")
125
+ print_error(f"Failed to shut down Worker Pool '{worker_pool_id}': ({e})")
124
126
 
125
127
  for node_id in node_ids:
126
128
  try:
127
129
  CLIENT.worker_pool_client.shutdown_node_by_id(node_id)
128
130
  print_log(f"Shut down Node '{node_id}'")
129
131
  except Exception as e:
130
- print_error(f"Unable to shut down Node '{node_id}': ({e})")
132
+ print_error(f"Failed to to shut down Node '{node_id}': ({e})")
131
133
 
132
134
  if ARGS_PARSER.follow:
133
135
  follow_ids(worker_pool_ids, auto_cr=ARGS_PARSER.auto_cr)
@@ -151,7 +153,7 @@ def optionally_terminate_compute_requirement(worker_pool_id: str):
151
153
  f"Terminated associated Compute Requirement '{worker_pool.computeRequirementId}'"
152
154
  )
153
155
  except Exception as e:
154
- print_error(f"Error terminating Compute Requirement: ({e})")
156
+ print_error(f"Failed to terminate Compute Requirement: ({e})")
155
157
 
156
158
 
157
159
  # Entry point
@@ -77,7 +77,7 @@ def main():
77
77
  )
78
78
  except Exception as e:
79
79
  print_error(
80
- f"Unable to terminate '{compute_requirement_summary.name}': {e}"
80
+ f"Failed to terminate '{compute_requirement_summary.name}': {e}"
81
81
  )
82
82
 
83
83
  if terminated_count > 0:
@@ -125,7 +125,7 @@ def terminate_cr_by_name_or_id(names_or_ids: List[str]):
125
125
  )
126
126
  print_log(f"Terminated '{compute_requirement_id}'")
127
127
  except Exception as e:
128
- print_error(f"Unable to terminate '{compute_requirement_id}': ({e})")
128
+ print_error(f"Failed to terminate '{compute_requirement_id}': ({e})")
129
129
 
130
130
  if ARGS_PARSER.follow:
131
131
  follow_ids(compute_requirement_ids)
@@ -54,7 +54,7 @@ from yellowdog_client.model import (
54
54
 
55
55
  from yellowdog_cli.utils.args import ARGS_PARSER
56
56
  from yellowdog_cli.utils.interactive import confirmed, select
57
- from yellowdog_cli.utils.printing import print_log
57
+ from yellowdog_cli.utils.printing import print_log, print_warning
58
58
  from yellowdog_cli.utils.settings import NAMESPACE_PREFIX_SEPARATOR
59
59
  from yellowdog_cli.utils.ydid_utils import YDIDType, get_ydid_type
60
60
 
@@ -534,7 +534,16 @@ def remove_allowances_matching_description(
534
534
  """
535
535
  allowances = client.allowances_client.get_allowances(
536
536
  AllowanceSearch(description=description)
537
- ).list_all()
537
+ ).list_all() # Can return partial matches
538
+
539
+ # Ensure exact match
540
+ allowances = [
541
+ allowance for allowance in allowances if description == allowance.description
542
+ ]
543
+
544
+ if len(allowances) == 0:
545
+ print_log(f"Cannot find Allowance matching description '{description}'")
546
+ return 0
538
547
 
539
548
  if len(allowances) > 1:
540
549
  print_log(f"Multiple Allowances match the description '{description}'")
@@ -1022,7 +1031,6 @@ def get_image_family_summaries(
1022
1031
  "Warning: Possible 'IMAGE_READ' permission missing if "
1023
1032
  f"'{namespace}' is meant as an Image namespace?"
1024
1033
  )
1025
- pass
1026
1034
 
1027
1035
  return []
1028
1036
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yellowdog-python-examples
3
- Version: 8.1.5
3
+ Version: 8.1.7
4
4
  Summary: Python CLI commands using the YellowDog Python SDK
5
5
  Author-email: YellowDog Limited <support@yellowdog.co>
6
6
  License-Expression: Apache-2.0
@@ -1,11 +1,11 @@
1
- yellowdog_cli/__init__.py,sha256=UE2byv3TrjFSpmrlMMLljjtWoisXIAZ0MoNAF9Lc36k,22
1
+ yellowdog_cli/__init__.py,sha256=DSjpcTXEMbKTSEhH-ChqB5reU3Hdp38wfe3HkEnrtRQ,22
2
2
  yellowdog_cli/abort.py,sha256=3mzTL8DH5InpJry4wPhwi3WJjC8_vCmPpkyf6jLDrBM,4302
3
3
  yellowdog_cli/admin.py,sha256=Iipc0_A-Rf997hSDjOOYTaPpB3dsuqekV8Slmm154GI,1010
4
4
  yellowdog_cli/boost.py,sha256=JOUkXpl7yvmVZCAS_iv8GJ6g2wF1siVjGGJ-EUDI0FI,1268
5
5
  yellowdog_cli/cancel.py,sha256=KWUOZbH4Nh6jcOKDXyHOHlgW-UdcW2BAdjfRHSJd2jk,6349
6
6
  yellowdog_cli/cloudwizard.py,sha256=UC1CDNPAsUMh_0C9ScLF4wGmvJ2Rbryravj67LHdFnI,2647
7
7
  yellowdog_cli/compare.py,sha256=yihgygtxedvRXz0mQV9hmvvMeKaNYIMfgBlTHetaa_s,24311
8
- yellowdog_cli/create.py,sha256=hgNrFjteAu87rje99I1YV7EybVEF2pjZbeU9m9bOWOQ,51919
8
+ yellowdog_cli/create.py,sha256=Jrkf6IeIMnNpFdtiU19e60oMqIPVHvvnkWjoTXGBbpw,51954
9
9
  yellowdog_cli/delete.py,sha256=7YWGY8vI9ec3QP2y7VSEFFyAsY3IWcsZndDDXhlUNTY,3023
10
10
  yellowdog_cli/download.py,sha256=zYlfr7jCoJGzoayjhpoy3Ku9unmXnLu5XORRuUIuDlo,5479
11
11
  yellowdog_cli/finish.py,sha256=tPKophQty2aDUrnQ-A6zSrYk3W-ZRS7uQM3bAavGWXI,5227
@@ -16,13 +16,13 @@ yellowdog_cli/instantiate.py,sha256=TDwvUVwqWLY4m0updxbWPTgLX2J0SOmT-EqZRDHgOgI,
16
16
  yellowdog_cli/jsonnet2json.py,sha256=kv-AZSR-xwIbXnUdL3gYGjYdSiHq7cAvlEGPz4StdTE,765
17
17
  yellowdog_cli/list.py,sha256=WxaKGQ5Upou8wkTeRsgAGPGH5U1yLuWq-DM1ozsuvJc,33344
18
18
  yellowdog_cli/provision.py,sha256=-rbFJYzd3Kfq6zpFhbM_KM0VUSkJAa3mvY2YODTNc5Q,19667
19
- yellowdog_cli/remove.py,sha256=SxR2tut0ox-jnvFhefh66t1vCgZz3TR21109--YSOFo,20890
19
+ yellowdog_cli/remove.py,sha256=yPZSVXY0shzcb_FN8MvW1friuixVzuVGmwqZAnFLDno,20904
20
20
  yellowdog_cli/resize.py,sha256=5oMqZmT1KXjnqEClCVzQbCDyZaEu-oc06mypy0TlTBo,4353
21
21
  yellowdog_cli/show.py,sha256=rOi6ROkG_o-c65XB84JvQgDHxV-h3zvTX9H09fIV2BE,11014
22
- yellowdog_cli/shutdown.py,sha256=eIvnmiPuJ8yZVFV2Sjbe14-Y8QWGZbd-EYTnGEKkWag,5538
22
+ yellowdog_cli/shutdown.py,sha256=Coc4qljvpUzG1r3ZuOLSLzTglzXZVbWbh3GzUH7tpeU,5605
23
23
  yellowdog_cli/start.py,sha256=9PHUAbS6vSq9RbttKkymOBzltIlWssQvk4zHJ8R-bWw,314
24
24
  yellowdog_cli/submit.py,sha256=Q0qUul2WqswvuxCGkpsDEAIh0Ju-iYJWaVU76S6aV5g,61680
25
- yellowdog_cli/terminate.py,sha256=lY_3w9w9tkhd4imVAlOdrj3a9nlFJkzORAqtI4RUlPg,4685
25
+ yellowdog_cli/terminate.py,sha256=G-4yeeF6eN_VHT9wkfMeyRmu0HYm2kZ_BxiseIBAwQ0,4685
26
26
  yellowdog_cli/upload.py,sha256=tCqspQ5xNqUFsAIqBxzvyVQ5Uhk5uZFTf1xM3JFSgBs,5389
27
27
  yellowdog_cli/version.py,sha256=IADl53F8zo2pe1FrgZqo3hKNQXmfz7GnynIbXZ7ryQo,1208
28
28
  yellowdog_cli/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -36,7 +36,7 @@ yellowdog_cli/utils/cloudwizard_gcp.py,sha256=zb4WdNrkMgbWWgko3zOb8uTyeQ6BuWsdeV
36
36
  yellowdog_cli/utils/compact_json.py,sha256=l-tOoOaiS7Th8ravH66F_xam0dPX2CXLRq-gEBIcNl8,3757
37
37
  yellowdog_cli/utils/config_types.py,sha256=Oe2YIz9Vgms3C2CVuit5qVFWpiqdll2XFm7YmL27XpA,3919
38
38
  yellowdog_cli/utils/csv_data.py,sha256=vyLhb6ZRzQXzSjK9VWzoP6AP43SuHoWxbD5kEAzUwvM,14409
39
- yellowdog_cli/utils/entity_utils.py,sha256=KC67qd7YmhDa0Uxri6ma4WxeOa8fbYAzgxZuwkZA2Zg,32725
39
+ yellowdog_cli/utils/entity_utils.py,sha256=hozm5RiI8Pg-XygCQ5TwjOBpQy3uc0YO0GybFAedVIc,33022
40
40
  yellowdog_cli/utils/follow_utils.py,sha256=Tiq6n86v1cEMBACVoz6IFj_GLW0Fp0qKB2EZINX8wKE,4320
41
41
  yellowdog_cli/utils/interactive.py,sha256=VQZKZ9GtA-bSsWGJgEoOQ0WrOeXbeALpkRhHENCJ8q0,5778
42
42
  yellowdog_cli/utils/items.py,sha256=AhSyhgi-p6EZpwozFIxwIxbjxRwKgR2_wt6QdZtORj8,1333
@@ -56,9 +56,9 @@ yellowdog_cli/utils/validate_properties.py,sha256=TsroKrf4jcAg_uQLRb9DpoSjRZ49XB
56
56
  yellowdog_cli/utils/variables.py,sha256=AHaolW682lkqm1P9MqWZnwvvK-Gd8hgV0HgzX76A1Ck,20542
57
57
  yellowdog_cli/utils/wrapper.py,sha256=TtvHmPKqKRk9meQw3LcsZcpkYNyuPSGcS0tC3fbQ4U4,3846
58
58
  yellowdog_cli/utils/ydid_utils.py,sha256=Gs98Pidkpd6v-cpL28t3z8mOW9JMB7ZY2MkGBX8EhMo,2360
59
- yellowdog_python_examples-8.1.5.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
60
- yellowdog_python_examples-8.1.5.dist-info/METADATA,sha256=gLiHPqH0B3Fo5sAsmnaiSbdB_cQ6cLebiPXyrTAMbOk,3927
61
- yellowdog_python_examples-8.1.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
62
- yellowdog_python_examples-8.1.5.dist-info/entry_points.txt,sha256=KABYVOB3kO7kVqnUplNNoz4l36KUUVY05ynsZ9jSVL8,1016
63
- yellowdog_python_examples-8.1.5.dist-info/top_level.txt,sha256=RfffFF4rsBrBbPB1qRkJsRpUn_5icIZSdCqMDLO3hgA,14
64
- yellowdog_python_examples-8.1.5.dist-info/RECORD,,
59
+ yellowdog_python_examples-8.1.7.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
60
+ yellowdog_python_examples-8.1.7.dist-info/METADATA,sha256=5W5dmjQmQeHcAMN0ISUtdkZAez8yiFqxHS_8zyJ40Qw,3927
61
+ yellowdog_python_examples-8.1.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
62
+ yellowdog_python_examples-8.1.7.dist-info/entry_points.txt,sha256=KABYVOB3kO7kVqnUplNNoz4l36KUUVY05ynsZ9jSVL8,1016
63
+ yellowdog_python_examples-8.1.7.dist-info/top_level.txt,sha256=RfffFF4rsBrBbPB1qRkJsRpUn_5icIZSdCqMDLO3hgA,14
64
+ yellowdog_python_examples-8.1.7.dist-info/RECORD,,