yellowdog-python-examples 8.3.0__py3-none-any.whl → 8.3.1__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 +1 -1
- yellowdog_cli/abort.py +11 -11
- yellowdog_cli/admin.py +2 -2
- yellowdog_cli/boost.py +3 -3
- yellowdog_cli/cancel.py +9 -9
- yellowdog_cli/cloudwizard.py +4 -4
- yellowdog_cli/compare.py +6 -6
- yellowdog_cli/create.py +54 -52
- yellowdog_cli/delete.py +10 -10
- yellowdog_cli/download.py +15 -15
- yellowdog_cli/finish.py +9 -9
- yellowdog_cli/instantiate.py +19 -17
- yellowdog_cli/list.py +41 -41
- yellowdog_cli/provision.py +28 -28
- yellowdog_cli/remove.py +28 -26
- yellowdog_cli/resize.py +9 -9
- yellowdog_cli/show.py +25 -25
- yellowdog_cli/shutdown.py +9 -9
- yellowdog_cli/submit.py +29 -29
- yellowdog_cli/terminate.py +8 -8
- yellowdog_cli/upload.py +11 -11
- yellowdog_cli/utils/cloudwizard_aws.py +32 -32
- yellowdog_cli/utils/cloudwizard_azure.py +27 -27
- yellowdog_cli/utils/cloudwizard_common.py +12 -10
- yellowdog_cli/utils/cloudwizard_gcp.py +8 -8
- yellowdog_cli/utils/csv_data.py +7 -7
- yellowdog_cli/utils/entity_utils.py +20 -20
- yellowdog_cli/utils/follow_utils.py +5 -5
- yellowdog_cli/utils/interactive.py +8 -8
- yellowdog_cli/utils/load_config.py +11 -11
- yellowdog_cli/utils/load_resources.py +4 -4
- yellowdog_cli/utils/misc_utils.py +3 -3
- yellowdog_cli/utils/printing.py +10 -9
- yellowdog_cli/utils/provision_utils.py +2 -2
- yellowdog_cli/utils/settings.py +1 -0
- yellowdog_cli/utils/start_hold_common.py +7 -7
- yellowdog_cli/utils/submit_utils.py +5 -5
- yellowdog_cli/utils/upload_utils.py +3 -3
- yellowdog_cli/utils/variables.py +5 -5
- yellowdog_cli/utils/wrapper.py +7 -7
- {yellowdog_python_examples-8.3.0.dist-info → yellowdog_python_examples-8.3.1.dist-info}/METADATA +2 -2
- yellowdog_python_examples-8.3.1.dist-info/RECORD +65 -0
- yellowdog_python_examples-8.3.0.dist-info/RECORD +0 -65
- {yellowdog_python_examples-8.3.0.dist-info → yellowdog_python_examples-8.3.1.dist-info}/WHEEL +0 -0
- {yellowdog_python_examples-8.3.0.dist-info → yellowdog_python_examples-8.3.1.dist-info}/entry_points.txt +0 -0
- {yellowdog_python_examples-8.3.0.dist-info → yellowdog_python_examples-8.3.1.dist-info}/licenses/LICENSE +0 -0
- {yellowdog_python_examples-8.3.0.dist-info → yellowdog_python_examples-8.3.1.dist-info}/top_level.txt +0 -0
yellowdog_cli/remove.py
CHANGED
|
@@ -31,7 +31,7 @@ from yellowdog_cli.utils.entity_utils import (
|
|
|
31
31
|
)
|
|
32
32
|
from yellowdog_cli.utils.interactive import confirmed
|
|
33
33
|
from yellowdog_cli.utils.load_resources import load_resource_specifications
|
|
34
|
-
from yellowdog_cli.utils.printing import print_error,
|
|
34
|
+
from yellowdog_cli.utils.printing import print_error, print_info, print_warning
|
|
35
35
|
from yellowdog_cli.utils.settings import (
|
|
36
36
|
DEFAULT_NAMESPACE,
|
|
37
37
|
NAMESPACE_PREFIX_SEPARATOR,
|
|
@@ -159,7 +159,7 @@ def remove_compute_source_template(resource: Dict):
|
|
|
159
159
|
|
|
160
160
|
try:
|
|
161
161
|
CLIENT.compute_client.delete_compute_source_template_by_id(source_id)
|
|
162
|
-
|
|
162
|
+
print_info(f"Removed Compute Source Template '{name}' ({source_id})")
|
|
163
163
|
except Exception as e:
|
|
164
164
|
print_error(
|
|
165
165
|
f"Unable to remove Compute Source Template '{name}' ({source_id}): {e}"
|
|
@@ -189,7 +189,7 @@ def remove_compute_requirement_template(resource: Dict):
|
|
|
189
189
|
|
|
190
190
|
try:
|
|
191
191
|
CLIENT.compute_client.delete_compute_requirement_template_by_id(template_id)
|
|
192
|
-
|
|
192
|
+
print_info(f"Removed Compute Requirement Template '{name}' ({template_id})")
|
|
193
193
|
except Exception as e:
|
|
194
194
|
print_error(
|
|
195
195
|
f"Unable to remove Compute Requirement Template '{name}'"
|
|
@@ -212,7 +212,7 @@ def remove_keyring(resource: Dict):
|
|
|
212
212
|
|
|
213
213
|
try:
|
|
214
214
|
CLIENT.keyring_client.delete_keyring_by_name(name)
|
|
215
|
-
|
|
215
|
+
print_info(f"Removed Keyring '{name}'")
|
|
216
216
|
except HTTPError as e:
|
|
217
217
|
if e.response.status_code == 404:
|
|
218
218
|
print_warning(f"Cannot find Keyring '{name}'")
|
|
@@ -239,7 +239,7 @@ def remove_credential(resource: Dict):
|
|
|
239
239
|
|
|
240
240
|
try:
|
|
241
241
|
CLIENT.keyring_client.delete_credential_by_name(keyring_name, credential_name)
|
|
242
|
-
|
|
242
|
+
print_info(
|
|
243
243
|
f"Removed Credential '{credential_name}' from Keyring '{keyring_name}' (if"
|
|
244
244
|
" it was present)"
|
|
245
245
|
)
|
|
@@ -285,7 +285,7 @@ def remove_image_family(resource: Dict):
|
|
|
285
285
|
|
|
286
286
|
try:
|
|
287
287
|
CLIENT.images_client.delete_image_family(image_family)
|
|
288
|
-
|
|
288
|
+
print_info(f"Removed Image Family '{fq_name}' ({image_family.id})")
|
|
289
289
|
except Exception as e:
|
|
290
290
|
print_error(f"Unable to remove Image Family '{fq_name}': {e}")
|
|
291
291
|
|
|
@@ -312,7 +312,7 @@ def remove_namespace_configuration(resource: Dict):
|
|
|
312
312
|
|
|
313
313
|
try:
|
|
314
314
|
CLIENT.object_store_client.delete_namespace_storage_configuration(namespace)
|
|
315
|
-
|
|
315
|
+
print_info(f"Removed Namespace Storage Configuration '{namespace}'")
|
|
316
316
|
except Exception as e:
|
|
317
317
|
print_error(
|
|
318
318
|
f"Unable to remove Namespace Storage Configuration '{namespace}': {e}"
|
|
@@ -350,7 +350,7 @@ def remove_configured_worker_pool(resource: Dict):
|
|
|
350
350
|
break
|
|
351
351
|
try:
|
|
352
352
|
CLIENT.worker_pool_client.shutdown_worker_pool_by_id(worker_pool.id)
|
|
353
|
-
|
|
353
|
+
print_info(
|
|
354
354
|
f"Shutting down [{worker_pool.status}] Configured Worker Pool"
|
|
355
355
|
f" '{fq_name}' ({worker_pool.id})"
|
|
356
356
|
)
|
|
@@ -358,7 +358,7 @@ def remove_configured_worker_pool(resource: Dict):
|
|
|
358
358
|
except Exception as e:
|
|
359
359
|
print_error(f"Failed to shut down Configured Worker Pool: {e}")
|
|
360
360
|
else:
|
|
361
|
-
|
|
361
|
+
print_info(
|
|
362
362
|
f"Not shutting down [{worker_pool.status}] Configured Worker Pool"
|
|
363
363
|
f" '{fq_name}' ({worker_pool.id})"
|
|
364
364
|
)
|
|
@@ -374,9 +374,9 @@ def remove_allowance(resource: Dict):
|
|
|
374
374
|
"""
|
|
375
375
|
description = resource.get("description", None)
|
|
376
376
|
if description is not None:
|
|
377
|
-
|
|
377
|
+
print_info(f"Removing allowance(s) matching description '{description}'")
|
|
378
378
|
num_removed = remove_allowances_matching_description(CLIENT, description)
|
|
379
|
-
|
|
379
|
+
print_info(f"Removed {num_removed} Allowance(s)")
|
|
380
380
|
|
|
381
381
|
|
|
382
382
|
def remove_resource_by_id(resource_id: str):
|
|
@@ -387,14 +387,16 @@ def remove_resource_by_id(resource_id: str):
|
|
|
387
387
|
if get_ydid_type(resource_id) == YDIDType.COMPUTE_SOURCE_TEMPLATE:
|
|
388
388
|
if confirmed(f"Remove Compute Source Template {resource_id}?"):
|
|
389
389
|
CLIENT.compute_client.delete_compute_source_template_by_id(resource_id)
|
|
390
|
-
|
|
390
|
+
print_info(
|
|
391
|
+
f"Removed Compute Source Template {resource_id} (if present)"
|
|
392
|
+
)
|
|
391
393
|
|
|
392
394
|
elif get_ydid_type(resource_id) == YDIDType.COMPUTE_REQUIREMENT_TEMPLATE:
|
|
393
395
|
if confirmed(f"Remove Compute Requirement Template {resource_id}?"):
|
|
394
396
|
CLIENT.compute_client.delete_compute_requirement_template_by_id(
|
|
395
397
|
resource_id
|
|
396
398
|
)
|
|
397
|
-
|
|
399
|
+
print_info(
|
|
398
400
|
f"Removed Compute Requirement Template {resource_id} (if present)"
|
|
399
401
|
)
|
|
400
402
|
|
|
@@ -404,7 +406,7 @@ def remove_resource_by_id(resource_id: str):
|
|
|
404
406
|
CLIENT.images_client.get_image_family_by_id(resource_id)
|
|
405
407
|
)
|
|
406
408
|
CLIENT.images_client.delete_image_family(family)
|
|
407
|
-
|
|
409
|
+
print_info(f"Removed Image Family {resource_id} (if present)")
|
|
408
410
|
|
|
409
411
|
elif get_ydid_type(resource_id) == YDIDType.IMAGE_GROUP:
|
|
410
412
|
if confirmed(f"Remove Image Group '{resource_id}'?"):
|
|
@@ -412,13 +414,13 @@ def remove_resource_by_id(resource_id: str):
|
|
|
412
414
|
resource_id
|
|
413
415
|
)
|
|
414
416
|
CLIENT.images_client.delete_image_group(group)
|
|
415
|
-
|
|
417
|
+
print_info(f"Removed Image Family {resource_id} (if present)")
|
|
416
418
|
|
|
417
419
|
elif get_ydid_type(resource_id) == YDIDType.IMAGE:
|
|
418
420
|
if confirmed(f"Remove Image '{resource_id}'?"):
|
|
419
421
|
image: MachineImage = CLIENT.images_client.get_image(resource_id)
|
|
420
422
|
CLIENT.images_client.delete_image(image)
|
|
421
|
-
|
|
423
|
+
print_info(f"Removed Image {resource_id} (if present)")
|
|
422
424
|
|
|
423
425
|
elif get_ydid_type(resource_id) == YDIDType.KEYRING:
|
|
424
426
|
if confirmed(f"Remove Keyring {resource_id}?"):
|
|
@@ -426,29 +428,29 @@ def remove_resource_by_id(resource_id: str):
|
|
|
426
428
|
for keyring in keyrings:
|
|
427
429
|
if keyring.id == resource_id:
|
|
428
430
|
CLIENT.keyring_client.delete_keyring_by_name(keyring.name)
|
|
429
|
-
|
|
431
|
+
print_info(f"Removed Keyring {resource_id}")
|
|
430
432
|
return
|
|
431
433
|
print_warning(f"Cannot find Keyring {resource_id}")
|
|
432
434
|
|
|
433
435
|
elif get_ydid_type(resource_id) == YDIDType.WORKER_POOL:
|
|
434
436
|
if confirmed(f"Shut down Worker Pool {resource_id}?"):
|
|
435
437
|
CLIENT.worker_pool_client.shutdown_worker_pool_by_id(resource_id)
|
|
436
|
-
|
|
438
|
+
print_info(f"Shut down Worker Pool {resource_id}")
|
|
437
439
|
|
|
438
440
|
elif get_ydid_type(resource_id) == YDIDType.ALLOWANCE:
|
|
439
441
|
if confirmed(f"Remove Allowance {resource_id}?"):
|
|
440
442
|
CLIENT.allowances_client.delete_allowance_by_id(resource_id)
|
|
441
|
-
|
|
443
|
+
print_info(f"Removed Allowance {resource_id} (if present)")
|
|
442
444
|
|
|
443
445
|
elif get_ydid_type(resource_id) == YDIDType.GROUP:
|
|
444
446
|
if confirmed(f"Remove Group {resource_id}?"):
|
|
445
447
|
CLIENT.account_client.delete_group(resource_id)
|
|
446
|
-
|
|
448
|
+
print_info(f"Removed Group {resource_id} (if present)")
|
|
447
449
|
|
|
448
450
|
elif get_ydid_type(resource_id) == YDIDType.APPLICATION:
|
|
449
451
|
if confirmed(f"Remove Application {resource_id}?"):
|
|
450
452
|
CLIENT.account_client.delete_application(resource_id)
|
|
451
|
-
|
|
453
|
+
print_info(f"Removed Application {resource_id} (if present)")
|
|
452
454
|
|
|
453
455
|
else:
|
|
454
456
|
print_error(f"Resource ID type is unknown/unsupported: {resource_id}")
|
|
@@ -474,7 +476,7 @@ def remove_attribute_definition(resource: Dict):
|
|
|
474
476
|
response = delete(url=url, headers=headers)
|
|
475
477
|
|
|
476
478
|
if response.status_code == 200:
|
|
477
|
-
|
|
479
|
+
print_info(f"Removed Attribute Definition '{name}' (if present)")
|
|
478
480
|
return
|
|
479
481
|
|
|
480
482
|
raise Exception(f"HTTP {response.status_code} ({response.text})")
|
|
@@ -505,7 +507,7 @@ def remove_namespace_policy(resource: Dict):
|
|
|
505
507
|
|
|
506
508
|
try:
|
|
507
509
|
CLIENT.namespaces_client.delete_namespace_policy(namespace)
|
|
508
|
-
|
|
510
|
+
print_info(f"Removed Namespace Policy '{namespace}'")
|
|
509
511
|
except Exception as e:
|
|
510
512
|
print_error(f"Unable to remove Namespace Policy '{namespace}': {e}")
|
|
511
513
|
|
|
@@ -530,7 +532,7 @@ def remove_group(resource: Dict):
|
|
|
530
532
|
|
|
531
533
|
try:
|
|
532
534
|
CLIENT.account_client.delete_group(group_id)
|
|
533
|
-
|
|
535
|
+
print_info(f"Removed Group '{group_name}' ({group_id})")
|
|
534
536
|
clear_group_caches()
|
|
535
537
|
except Exception as e:
|
|
536
538
|
print_error(f"Unable to remove Group '{group_name}' ({group_id}): {e}")
|
|
@@ -556,7 +558,7 @@ def remove_application(resource: Dict):
|
|
|
556
558
|
|
|
557
559
|
try:
|
|
558
560
|
CLIENT.account_client.delete_application(app_id)
|
|
559
|
-
|
|
561
|
+
print_info(f"Removed Application '{app_name}' ({app_id})")
|
|
560
562
|
clear_application_caches()
|
|
561
563
|
except Exception as e:
|
|
562
564
|
print_error(f"Unable to remove Application '{app_name}' ({app_id}): {e}")
|
|
@@ -593,7 +595,7 @@ def remove_namespace(resource: Dict):
|
|
|
593
595
|
else:
|
|
594
596
|
print_error(f"Unable to remove Namespace '{name}': {e}")
|
|
595
597
|
|
|
596
|
-
|
|
598
|
+
print_info(f"Removed Namespace '{name}' ({namespace_id})")
|
|
597
599
|
|
|
598
600
|
|
|
599
601
|
# Entry point
|
yellowdog_cli/resize.py
CHANGED
|
@@ -19,7 +19,7 @@ from yellowdog_cli.utils.entity_utils import (
|
|
|
19
19
|
)
|
|
20
20
|
from yellowdog_cli.utils.follow_utils import follow_events, follow_ids
|
|
21
21
|
from yellowdog_cli.utils.interactive import confirmed
|
|
22
|
-
from yellowdog_cli.utils.printing import
|
|
22
|
+
from yellowdog_cli.utils.printing import print_info, print_warning
|
|
23
23
|
from yellowdog_cli.utils.wrapper import ARGS_PARSER, CLIENT, CONFIG_COMMON, main_wrapper
|
|
24
24
|
from yellowdog_cli.utils.ydid_utils import YDIDType, get_ydid_type
|
|
25
25
|
|
|
@@ -36,7 +36,7 @@ def _resize_worker_pool():
|
|
|
36
36
|
"""
|
|
37
37
|
Resize a Worker Pool
|
|
38
38
|
"""
|
|
39
|
-
|
|
39
|
+
print_info(
|
|
40
40
|
f"Resizing Worker Pool '{ARGS_PARSER.worker_pool_name}' to"
|
|
41
41
|
f" {ARGS_PARSER.worker_pool_size:,d} node(s)"
|
|
42
42
|
)
|
|
@@ -62,7 +62,7 @@ def _resize_worker_pool():
|
|
|
62
62
|
)
|
|
63
63
|
|
|
64
64
|
if ARGS_PARSER.follow:
|
|
65
|
-
|
|
65
|
+
print_info("Following event stream(s)")
|
|
66
66
|
follow_ids([worker_pool.id], auto_cr=ARGS_PARSER.auto_cr)
|
|
67
67
|
|
|
68
68
|
|
|
@@ -70,11 +70,11 @@ def _resize_compute_requirement():
|
|
|
70
70
|
"""
|
|
71
71
|
Resize a Compute Requirement
|
|
72
72
|
"""
|
|
73
|
-
|
|
73
|
+
print_info(
|
|
74
74
|
f"Attempting to resize Compute Requirement '{ARGS_PARSER.worker_pool_name}' "
|
|
75
75
|
f"to {ARGS_PARSER.worker_pool_size:,d} instance(s)"
|
|
76
76
|
)
|
|
77
|
-
|
|
77
|
+
print_info(
|
|
78
78
|
f"Finding Compute Requirement in Namespace '{CONFIG_COMMON.namespace}' "
|
|
79
79
|
f"with status '{ComputeRequirementStatus.RUNNING}'"
|
|
80
80
|
)
|
|
@@ -90,14 +90,14 @@ def _resize_compute_requirement():
|
|
|
90
90
|
if ARGS_PARSER.worker_pool_name not in [cr_summary.name, cr_summary.id]:
|
|
91
91
|
continue
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
print_info(
|
|
94
94
|
"Current target/expected instance counts ="
|
|
95
95
|
f" {cr_summary.targetInstanceCount:,d}/"
|
|
96
96
|
f"{cr_summary.expectedInstanceCount:,d}"
|
|
97
97
|
)
|
|
98
98
|
|
|
99
99
|
if cr_summary.targetInstanceCount == ARGS_PARSER.worker_pool_size:
|
|
100
|
-
|
|
100
|
+
print_info("No resize attempted: target instance count would be unchanged")
|
|
101
101
|
return
|
|
102
102
|
|
|
103
103
|
if not confirmed(
|
|
@@ -112,7 +112,7 @@ def _resize_compute_requirement():
|
|
|
112
112
|
cr.targetInstanceCount = ARGS_PARSER.worker_pool_size
|
|
113
113
|
CLIENT.compute_client.update_compute_requirement(cr, reprovision=False)
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
print_info(
|
|
116
116
|
"Resizing complete: new target instance count ="
|
|
117
117
|
f" {cr.targetInstanceCount}"
|
|
118
118
|
)
|
|
@@ -123,7 +123,7 @@ def _resize_compute_requirement():
|
|
|
123
123
|
"Option '--auto-follow-compute-requirements/-a' is"
|
|
124
124
|
" ignored when resizing Compute Requirements"
|
|
125
125
|
)
|
|
126
|
-
|
|
126
|
+
print_info("Following event stream")
|
|
127
127
|
follow_events(cr.id, YDIDType.COMPUTE_REQUIREMENT)
|
|
128
128
|
|
|
129
129
|
return
|
yellowdog_cli/show.py
CHANGED
|
@@ -15,7 +15,7 @@ from yellowdog_cli.utils.entity_utils import (
|
|
|
15
15
|
)
|
|
16
16
|
from yellowdog_cli.utils.printing import (
|
|
17
17
|
print_error,
|
|
18
|
-
|
|
18
|
+
print_info,
|
|
19
19
|
print_to_file,
|
|
20
20
|
print_yd_object,
|
|
21
21
|
)
|
|
@@ -44,7 +44,7 @@ def main():
|
|
|
44
44
|
generate_json_list = len(ARGS_PARSER.yellowdog_ids) > 1 and ARGS_PARSER.quiet
|
|
45
45
|
|
|
46
46
|
if ARGS_PARSER.strip_ids:
|
|
47
|
-
|
|
47
|
+
print_info("Stripping YellowDog IDs (etc.) from detailed JSON objects")
|
|
48
48
|
|
|
49
49
|
if generate_json_list:
|
|
50
50
|
print("[")
|
|
@@ -73,9 +73,9 @@ def show_details(ydid: str, initial_indent: int = 0, with_final_comma: bool = Fa
|
|
|
73
73
|
try:
|
|
74
74
|
ydid_type = get_ydid_type(ydid)
|
|
75
75
|
if ydid_type == YDIDType.COMPUTE_SOURCE_TEMPLATE:
|
|
76
|
-
|
|
76
|
+
print_info(f"Showing details of Compute Source Template ID '{ydid}'")
|
|
77
77
|
if ARGS_PARSER.substitute_ids:
|
|
78
|
-
|
|
78
|
+
print_info("Substituting Image Family ID with name")
|
|
79
79
|
print_yd_object(
|
|
80
80
|
substitute_image_family_id_for_name_in_cst(
|
|
81
81
|
CLIENT, CLIENT.compute_client.get_compute_source_template(ydid)
|
|
@@ -86,9 +86,9 @@ def show_details(ydid: str, initial_indent: int = 0, with_final_comma: bool = Fa
|
|
|
86
86
|
)
|
|
87
87
|
|
|
88
88
|
elif ydid_type == YDIDType.COMPUTE_REQUIREMENT_TEMPLATE:
|
|
89
|
-
|
|
89
|
+
print_info(f"Showing details of Compute Requirement Template ID '{ydid}'")
|
|
90
90
|
if ARGS_PARSER.substitute_ids:
|
|
91
|
-
|
|
91
|
+
print_info(
|
|
92
92
|
"Substituting Compute Source Template IDs and Image Family IDs with names"
|
|
93
93
|
)
|
|
94
94
|
print_yd_object(
|
|
@@ -101,11 +101,11 @@ def show_details(ydid: str, initial_indent: int = 0, with_final_comma: bool = Fa
|
|
|
101
101
|
)
|
|
102
102
|
|
|
103
103
|
elif ydid_type == YDIDType.COMPUTE_REQUIREMENT:
|
|
104
|
-
|
|
104
|
+
print_info(f"Showing details of Compute Requirement ID '{ydid}'")
|
|
105
105
|
print_yd_object(CLIENT.compute_client.get_compute_requirement_by_id(ydid))
|
|
106
106
|
|
|
107
107
|
elif ydid_type == YDIDType.COMPUTE_SOURCE:
|
|
108
|
-
|
|
108
|
+
print_info(f"Showing details of Compute Source ID '{ydid}'")
|
|
109
109
|
compute_requirement = CLIENT.compute_client.get_compute_requirement_by_id(
|
|
110
110
|
ydid.rsplit(":", 1)[0].replace("compsrc", "compreq")
|
|
111
111
|
)
|
|
@@ -117,7 +117,7 @@ def show_details(ydid: str, initial_indent: int = 0, with_final_comma: bool = Fa
|
|
|
117
117
|
print_error(f"Compute Source ID '{ydid}' not found")
|
|
118
118
|
|
|
119
119
|
elif ydid_type == YDIDType.WORKER_POOL:
|
|
120
|
-
|
|
120
|
+
print_info(f"Showing details of Worker Pool ID '{ydid}'")
|
|
121
121
|
worker_pool = CLIENT.worker_pool_client.get_worker_pool_by_id(ydid)
|
|
122
122
|
print_yd_object(
|
|
123
123
|
worker_pool,
|
|
@@ -130,7 +130,7 @@ def show_details(ydid: str, initial_indent: int = 0, with_final_comma: bool = Fa
|
|
|
130
130
|
),
|
|
131
131
|
)
|
|
132
132
|
if ARGS_PARSER.show_token and isinstance(worker_pool, ConfiguredWorkerPool):
|
|
133
|
-
|
|
133
|
+
print_info("Showing Configured Worker Pool token data")
|
|
134
134
|
print_yd_object(
|
|
135
135
|
CLIENT.worker_pool_client.get_configured_worker_pool_token_by_id(
|
|
136
136
|
ydid
|
|
@@ -138,11 +138,11 @@ def show_details(ydid: str, initial_indent: int = 0, with_final_comma: bool = Fa
|
|
|
138
138
|
)
|
|
139
139
|
|
|
140
140
|
elif ydid_type == YDIDType.NODE:
|
|
141
|
-
|
|
141
|
+
print_info(f"Showing details of Node ID '{ydid}'")
|
|
142
142
|
print_yd_object(CLIENT.worker_pool_client.get_node_by_id(ydid))
|
|
143
143
|
|
|
144
144
|
elif ydid_type == YDIDType.WORKER:
|
|
145
|
-
|
|
145
|
+
print_info(f"Showing details of Worker ID '{ydid}'")
|
|
146
146
|
node = CLIENT.worker_pool_client.get_node_by_id(
|
|
147
147
|
ydid.rsplit(":", 1)[0].replace("wrkr", "node")
|
|
148
148
|
)
|
|
@@ -154,11 +154,11 @@ def show_details(ydid: str, initial_indent: int = 0, with_final_comma: bool = Fa
|
|
|
154
154
|
print_error(f"Worker ID '{ydid}' not found")
|
|
155
155
|
|
|
156
156
|
elif ydid_type == YDIDType.WORK_REQUIREMENT:
|
|
157
|
-
|
|
157
|
+
print_info(f"Showing details of Work Requirement ID '{ydid}'")
|
|
158
158
|
print_yd_object(CLIENT.work_client.get_work_requirement_by_id(ydid))
|
|
159
159
|
|
|
160
160
|
elif ydid_type == YDIDType.TASK_GROUP:
|
|
161
|
-
|
|
161
|
+
print_info(f"Showing details of Task Group ID '{ydid}'")
|
|
162
162
|
work_requirement = CLIENT.work_client.get_work_requirement_by_id(
|
|
163
163
|
ydid.rsplit(":", 1)[0].replace("taskgrp", "workreq")
|
|
164
164
|
)
|
|
@@ -170,7 +170,7 @@ def show_details(ydid: str, initial_indent: int = 0, with_final_comma: bool = Fa
|
|
|
170
170
|
print_error(f"Task Group ID '{ydid}' not found")
|
|
171
171
|
|
|
172
172
|
elif ydid_type == YDIDType.TASK:
|
|
173
|
-
|
|
173
|
+
print_info(f"Showing details of Task ID '{ydid}'")
|
|
174
174
|
try:
|
|
175
175
|
print_yd_object(CLIENT.work_client.get_task_by_id(ydid))
|
|
176
176
|
except Exception as e:
|
|
@@ -178,7 +178,7 @@ def show_details(ydid: str, initial_indent: int = 0, with_final_comma: bool = Fa
|
|
|
178
178
|
print_error(f"Task ID '{ydid}' not found")
|
|
179
179
|
|
|
180
180
|
elif ydid_type == YDIDType.IMAGE_FAMILY:
|
|
181
|
-
|
|
181
|
+
print_info(f"Showing details of Image Family ID '{ydid}'")
|
|
182
182
|
print_yd_object(
|
|
183
183
|
CLIENT.images_client.get_image_family_by_id(ydid),
|
|
184
184
|
initial_indent=initial_indent,
|
|
@@ -187,15 +187,15 @@ def show_details(ydid: str, initial_indent: int = 0, with_final_comma: bool = Fa
|
|
|
187
187
|
)
|
|
188
188
|
|
|
189
189
|
elif ydid_type == YDIDType.IMAGE_GROUP:
|
|
190
|
-
|
|
190
|
+
print_info(f"Showing details of Image Group ID '{ydid}'")
|
|
191
191
|
print_yd_object(CLIENT.images_client.get_image_group_by_id(ydid))
|
|
192
192
|
|
|
193
193
|
elif ydid_type == YDIDType.IMAGE:
|
|
194
|
-
|
|
194
|
+
print_info(f"Showing details of Image ID '{ydid}'")
|
|
195
195
|
print_yd_object(CLIENT.images_client.get_image(ydid))
|
|
196
196
|
|
|
197
197
|
elif ydid_type == YDIDType.KEYRING:
|
|
198
|
-
|
|
198
|
+
print_info(f"Showing details of Keyring ID '{ydid}'")
|
|
199
199
|
keyrings = CLIENT.keyring_client.find_all_keyrings()
|
|
200
200
|
for keyring in keyrings:
|
|
201
201
|
if keyring.id == ydid:
|
|
@@ -211,10 +211,10 @@ def show_details(ydid: str, initial_indent: int = 0, with_final_comma: bool = Fa
|
|
|
211
211
|
print_error(f"Keyring ID '{ydid}' not found")
|
|
212
212
|
|
|
213
213
|
elif ydid_type == YDIDType.ALLOWANCE:
|
|
214
|
-
|
|
214
|
+
print_info(f"Showing details of Allowance ID '{ydid}'")
|
|
215
215
|
allowance = CLIENT.allowances_client.get_allowance_by_id(ydid)
|
|
216
216
|
if ARGS_PARSER.substitute_ids:
|
|
217
|
-
|
|
217
|
+
print_info("Substituting ID with name")
|
|
218
218
|
allowance = substitute_id_for_name_in_allowance(CLIENT, allowance)
|
|
219
219
|
print_yd_object(
|
|
220
220
|
allowance,
|
|
@@ -224,7 +224,7 @@ def show_details(ydid: str, initial_indent: int = 0, with_final_comma: bool = Fa
|
|
|
224
224
|
)
|
|
225
225
|
|
|
226
226
|
elif ydid_type == YDIDType.APPLICATION:
|
|
227
|
-
|
|
227
|
+
print_info(f"Showing details of Application ID '{ydid}'")
|
|
228
228
|
group_names = [
|
|
229
229
|
group.name for group in get_application_group_summaries(CLIENT, ydid)
|
|
230
230
|
]
|
|
@@ -241,7 +241,7 @@ def show_details(ydid: str, initial_indent: int = 0, with_final_comma: bool = Fa
|
|
|
241
241
|
)
|
|
242
242
|
|
|
243
243
|
elif ydid_type == YDIDType.USER:
|
|
244
|
-
|
|
244
|
+
print_info(f"Showing details of User ID '{ydid}'")
|
|
245
245
|
user = CLIENT.account_client.get_user(ydid)
|
|
246
246
|
print_yd_object(
|
|
247
247
|
user,
|
|
@@ -251,7 +251,7 @@ def show_details(ydid: str, initial_indent: int = 0, with_final_comma: bool = Fa
|
|
|
251
251
|
)
|
|
252
252
|
|
|
253
253
|
elif ydid_type == YDIDType.GROUP:
|
|
254
|
-
|
|
254
|
+
print_info(f"Showing details of Group ID '{ydid}'")
|
|
255
255
|
print_yd_object(
|
|
256
256
|
CLIENT.account_client.get_group(ydid),
|
|
257
257
|
initial_indent=initial_indent,
|
|
@@ -260,7 +260,7 @@ def show_details(ydid: str, initial_indent: int = 0, with_final_comma: bool = Fa
|
|
|
260
260
|
)
|
|
261
261
|
|
|
262
262
|
elif ydid_type == YDIDType.ROLE:
|
|
263
|
-
|
|
263
|
+
print_info(f"Showing details of Role ID '{ydid}'")
|
|
264
264
|
print_yd_object(
|
|
265
265
|
CLIENT.account_client.get_role(ydid),
|
|
266
266
|
initial_indent=initial_indent,
|
yellowdog_cli/shutdown.py
CHANGED
|
@@ -21,7 +21,7 @@ from yellowdog_cli.utils.entity_utils import (
|
|
|
21
21
|
from yellowdog_cli.utils.follow_utils import follow_ids
|
|
22
22
|
from yellowdog_cli.utils.interactive import confirmed, select
|
|
23
23
|
from yellowdog_cli.utils.misc_utils import link_entity
|
|
24
|
-
from yellowdog_cli.utils.printing import print_error,
|
|
24
|
+
from yellowdog_cli.utils.printing import print_error, print_info, print_warning
|
|
25
25
|
from yellowdog_cli.utils.wrapper import ARGS_PARSER, CLIENT, CONFIG_COMMON, main_wrapper
|
|
26
26
|
from yellowdog_cli.utils.ydid_utils import YDIDType, get_ydid_type
|
|
27
27
|
|
|
@@ -32,7 +32,7 @@ def main():
|
|
|
32
32
|
shutdown_by_names_or_ids(ARGS_PARSER.worker_pool_nodes_list)
|
|
33
33
|
return
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
print_info(
|
|
36
36
|
"Shutting down Worker Pools in "
|
|
37
37
|
f"namespace '{CONFIG_COMMON.namespace}' with "
|
|
38
38
|
f"names including '{CONFIG_COMMON.name_tag}'"
|
|
@@ -72,20 +72,20 @@ def main():
|
|
|
72
72
|
worker_pool: WorkerPool = get_worker_pool_by_id(
|
|
73
73
|
CLIENT, worker_pool_summary.id
|
|
74
74
|
)
|
|
75
|
-
|
|
75
|
+
print_info(f"Shut down {link_entity(CONFIG_COMMON.url, worker_pool)}")
|
|
76
76
|
optionally_terminate_compute_requirement(worker_pool_summary.id)
|
|
77
77
|
except Exception as e:
|
|
78
78
|
print_error(f"Failed to shut down '{worker_pool_summary.name}': {e}")
|
|
79
79
|
|
|
80
80
|
if shutdown_count > 0:
|
|
81
|
-
|
|
81
|
+
print_info(f"Shut down {shutdown_count} Worker Pool(s)")
|
|
82
82
|
if ARGS_PARSER.follow:
|
|
83
83
|
follow_ids(
|
|
84
84
|
[wp.id for wp in selected_worker_pool_summaries],
|
|
85
85
|
auto_cr=ARGS_PARSER.auto_cr,
|
|
86
86
|
)
|
|
87
87
|
else:
|
|
88
|
-
|
|
88
|
+
print_info("No Worker Pools shut down")
|
|
89
89
|
|
|
90
90
|
|
|
91
91
|
def shutdown_by_names_or_ids(names_or_ids: List[str]):
|
|
@@ -108,7 +108,7 @@ def shutdown_by_names_or_ids(names_or_ids: List[str]):
|
|
|
108
108
|
worker_pool_ids.append(worker_pool_id)
|
|
109
109
|
|
|
110
110
|
if len(worker_pool_ids) == 0 and len(node_ids) == 0:
|
|
111
|
-
|
|
111
|
+
print_info("No Worker Pools or Nodes to shut down")
|
|
112
112
|
return
|
|
113
113
|
|
|
114
114
|
if not confirmed(
|
|
@@ -119,7 +119,7 @@ def shutdown_by_names_or_ids(names_or_ids: List[str]):
|
|
|
119
119
|
for worker_pool_id in worker_pool_ids:
|
|
120
120
|
try:
|
|
121
121
|
CLIENT.worker_pool_client.shutdown_worker_pool_by_id(worker_pool_id)
|
|
122
|
-
|
|
122
|
+
print_info(f"Shut down Worker Pool '{worker_pool_id}'")
|
|
123
123
|
optionally_terminate_compute_requirement(worker_pool_id)
|
|
124
124
|
except Exception as e:
|
|
125
125
|
print_error(f"Failed to shut down Worker Pool '{worker_pool_id}': ({e})")
|
|
@@ -127,7 +127,7 @@ def shutdown_by_names_or_ids(names_or_ids: List[str]):
|
|
|
127
127
|
for node_id in node_ids:
|
|
128
128
|
try:
|
|
129
129
|
CLIENT.worker_pool_client.shutdown_node_by_id(node_id)
|
|
130
|
-
|
|
130
|
+
print_info(f"Shut down Node '{node_id}'")
|
|
131
131
|
except Exception as e:
|
|
132
132
|
print_error(f"Failed to to shut down Node '{node_id}': ({e})")
|
|
133
133
|
|
|
@@ -149,7 +149,7 @@ def optionally_terminate_compute_requirement(worker_pool_id: str):
|
|
|
149
149
|
CLIENT.compute_client.terminate_compute_requirement_by_id(
|
|
150
150
|
worker_pool.computeRequirementId
|
|
151
151
|
)
|
|
152
|
-
|
|
152
|
+
print_info(
|
|
153
153
|
f"Terminated associated Compute Requirement '{worker_pool.computeRequirementId}'"
|
|
154
154
|
)
|
|
155
155
|
except Exception as e:
|