yellowdog-python-examples 7.8.5__tar.gz → 7.8.7__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 (76) hide show
  1. {yellowdog_python_examples-7.8.5/yellowdog_python_examples.egg-info → yellowdog_python_examples-7.8.7}/PKG-INFO +1 -1
  2. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/README.md +24 -1
  3. yellowdog_python_examples-7.8.7/yd_commands/__init__.py +1 -0
  4. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/args.py +0 -2
  5. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/load_config.py +5 -2
  6. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/remove.py +21 -1
  7. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/upload_utils.py +14 -13
  8. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7/yellowdog_python_examples.egg-info}/PKG-INFO +1 -1
  9. yellowdog_python_examples-7.8.5/yd_commands/__init__.py +0 -1
  10. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/LICENSE +0 -0
  11. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/PYPI_README.md +0 -0
  12. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/pyproject.toml +0 -0
  13. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/requirements.txt +0 -0
  14. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/setup.cfg +0 -0
  15. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/setup.py +0 -0
  16. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/tests/test_create_remove.py +0 -0
  17. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/tests/test_demos.py +0 -0
  18. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/tests/test_dryruns.py +0 -0
  19. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/tests/test_entrypoints.py +0 -0
  20. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/tests/test_gui.py +0 -0
  21. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/tests/test_list.py +0 -0
  22. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/tests/test_objects.py +0 -0
  23. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/tests/test_variable_processing.py +0 -0
  24. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/abort.py +0 -0
  25. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/admin.py +0 -0
  26. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/boost.py +0 -0
  27. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/cancel.py +0 -0
  28. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/check_imports.py +0 -0
  29. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/cloudwizard.py +0 -0
  30. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/cloudwizard_aws.py +0 -0
  31. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/cloudwizard_aws_types.py +0 -0
  32. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/cloudwizard_azure.py +0 -0
  33. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/cloudwizard_common.py +0 -0
  34. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/cloudwizard_gcp.py +0 -0
  35. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/compact_json.py +0 -0
  36. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/config_types.py +0 -0
  37. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/create.py +0 -0
  38. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/csv_data.py +0 -0
  39. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/delete.py +0 -0
  40. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/download.py +0 -0
  41. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/follow.py +0 -0
  42. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/follow_utils.py +0 -0
  43. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/format_json.py +0 -0
  44. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/hold.py +0 -0
  45. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/id_utils.py +0 -0
  46. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/instantiate.py +0 -0
  47. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/interactive.py +0 -0
  48. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/items.py +0 -0
  49. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/jsonnet2json.py +0 -0
  50. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/list.py +0 -0
  51. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/load_resources.py +0 -0
  52. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/object_utilities.py +0 -0
  53. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/printing.py +0 -0
  54. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/property_names.py +0 -0
  55. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/provision.py +0 -0
  56. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/provision_utils.py +0 -0
  57. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/resize.py +0 -0
  58. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/settings.py +0 -0
  59. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/shutdown.py +0 -0
  60. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/start.py +0 -0
  61. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/start_hold_common.py +0 -0
  62. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/submit.py +0 -0
  63. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/submit_utils.py +0 -0
  64. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/terminate.py +0 -0
  65. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/type_check.py +0 -0
  66. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/upload.py +0 -0
  67. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/utils.py +0 -0
  68. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/validate_properties.py +0 -0
  69. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/variables.py +0 -0
  70. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/version.py +0 -0
  71. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yd_commands/wrapper.py +0 -0
  72. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yellowdog_python_examples.egg-info/SOURCES.txt +0 -0
  73. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yellowdog_python_examples.egg-info/dependency_links.txt +0 -0
  74. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yellowdog_python_examples.egg-info/entry_points.txt +0 -0
  75. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yellowdog_python_examples.egg-info/requires.txt +0 -0
  76. {yellowdog_python_examples-7.8.5 → yellowdog_python_examples-7.8.7}/yellowdog_python_examples.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: yellowdog-python-examples
3
- Version: 7.8.5
3
+ Version: 7.8.7
4
4
  Summary: Example Python commands using the YellowDog Python SDK
5
5
  Home-page: https://github.com/yellowdog/python-examples
6
6
  Author: YellowDog Limited
@@ -10,6 +10,7 @@
10
10
  * [Configuration](#configuration)
11
11
  * [Naming Rules](#naming-rules)
12
12
  * [Common Properties](#common-properties)
13
+ * [Importing common properties](#importing-common-properties)
13
14
  * [HTTPS Proxy Support](#https-proxy-support)
14
15
  * [Specifying Common Properties using the Command Line or Environment Variables](#specifying-common-properties-using-the-command-line-or-environment-variables)
15
16
  * [Variable Substitutions in Common Properties](#variable-substitutions-in-common-properties)
@@ -113,7 +114,7 @@
113
114
  * [yd-boost](#yd-boost)
114
115
 
115
116
  <!-- Created by https://github.com/ekalinin/github-markdown-toc -->
116
- <!-- Added by: pwt, at: Fri Mar 22 14:38:21 GMT 2024 -->
117
+ <!-- Added by: pwt, at: Fri Apr 19 11:43:37 BST 2024 -->
117
118
 
118
119
  <!--te-->
119
120
 
@@ -307,6 +308,28 @@ An example `common` section is shown below:
307
308
 
308
309
  Indentation is optional in TOML files and is for readability only.
309
310
 
311
+ ## Importing `common` properties
312
+
313
+ The `common` section can import properties from a separate TOML file, using the `importCommon` property. For example, the `key` and `secret` might be in a shared TOML file called `app_credentials.toml`, with the following contents:
314
+
315
+ ```toml
316
+ [common]
317
+ key = "asdfghjklzxcvb-1234567"
318
+ secret = "qwertyuiopasdfghjklzxcvbnm1234567890qwertyu"
319
+ ```
320
+
321
+ This could be imported into the main configuration as follows:
322
+
323
+ ```toml
324
+ [common]
325
+ importCommon = "app_credentials.toml"
326
+
327
+ namespace = "project-x"
328
+ tag = "testing-{{username}}"
329
+ ```
330
+
331
+ Properties set in the imported file are superseded by any of the same properties that are present in the main configuration file.
332
+
310
333
  ## HTTPS Proxy Support
311
334
 
312
335
  The commands will respect the value of the environment variable `HTTPS_PROXY` if routing through a proxy is required.
@@ -0,0 +1 @@
1
+ __version__ = "7.8.7"
@@ -127,8 +127,6 @@ class CLIParser:
127
127
  for module in [
128
128
  "boost",
129
129
  "resize",
130
- "create",
131
- "remove",
132
130
  "cloudwizard",
133
131
  "follow",
134
132
  ]
@@ -88,9 +88,12 @@ def load_config_common() -> ConfigCommon:
88
88
  common_section = CONFIG_TOML.get(COMMON_SECTION, {})
89
89
 
90
90
  # Check for IMPORT directive ('common' section in a separate file)
91
- common_section_import_file = common_section.get(IMPORT_COMMON, None)
91
+ common_section_import_file = common_section.pop(IMPORT_COMMON, None)
92
92
  if common_section_import_file is not None:
93
- common_section = import_toml(common_section_import_file)
93
+ common_section_imported = import_toml(common_section_import_file)
94
+ # Local properties supersede imported properties
95
+ common_section_imported.update(common_section)
96
+ common_section = common_section_imported
94
97
 
95
98
  # Replace common section properties with command line or
96
99
  # environment variable overrides. Precedence is:
@@ -9,6 +9,9 @@ from typing import Dict, List, Optional
9
9
 
10
10
  from requests.exceptions import HTTPError
11
11
  from yellowdog_client.model import (
12
+ MachineImage,
13
+ MachineImageFamily,
14
+ MachineImageGroup,
12
15
  NamespaceStorageConfiguration,
13
16
  WorkerPoolStatus,
14
17
  WorkerPoolSummary,
@@ -353,9 +356,26 @@ def remove_resource_by_id(resource_id: str):
353
356
 
354
357
  elif resource_id.startswith("ydid:imgfam:"):
355
358
  if confirmed(f"Remove Image Family '{resource_id}'?"):
356
- CLIENT.images_client.delete_image_family(resource_id)
359
+ family: MachineImageFamily = (
360
+ CLIENT.images_client.get_image_family_by_id(resource_id)
361
+ )
362
+ CLIENT.images_client.delete_image_family(family)
363
+ print_log(f"Removed Image Family {resource_id} (if present)")
364
+
365
+ elif resource_id.startswith("ydid:imggrp:"):
366
+ if confirmed(f"Remove Image Group '{resource_id}'?"):
367
+ group: MachineImageGroup = CLIENT.images_client.get_image_group_by_id(
368
+ resource_id
369
+ )
370
+ CLIENT.images_client.delete_image_group(group)
357
371
  print_log(f"Removed Image Family {resource_id} (if present)")
358
372
 
373
+ elif resource_id.startswith("ydid:image:"):
374
+ if confirmed(f"Remove Image '{resource_id}'?"):
375
+ image: MachineImage = CLIENT.images_client.get_image(resource_id)
376
+ CLIENT.images_client.delete_image(image)
377
+ print_log(f"Removed Image {resource_id} (if present)")
378
+
359
379
  elif resource_id.startswith("ydid:keyring:"):
360
380
  if confirmed(f"Remove Keyring {resource_id}?"):
361
381
  keyrings = CLIENT.keyring_client.find_all_keyrings()
@@ -100,19 +100,20 @@ def upload_file_core(
100
100
  destination_file_name=remote_file,
101
101
  )
102
102
  session.start()
103
+
103
104
  # Wait for upload to complete
104
105
  session = session.when_status_matches(lambda status: status.is_finished()).result()
106
+
105
107
  if session.status != FileTransferStatus.Completed:
106
- print_error(f"Failed to upload file: {local_file}")
107
- # Continue here?
108
- else:
109
- print_log(
110
- f"Uploaded file '{local_file}' to"
111
- f" '{namespace}{NAMESPACE_PREFIX_SEPARATOR}{remote_file}'"
112
- )
113
- remote_file = remote_file.replace("/", "%2F")
114
- link_ = link(
115
- url,
116
- f"#/objects/{namespace}/{remote_file}?object=true",
117
- )
118
- print_log(f"Object URL: {link_}")
108
+ raise Exception(f"Failed to upload file: {local_file}")
109
+
110
+ print_log(
111
+ f"Uploaded file '{local_file}' to"
112
+ f" '{namespace}{NAMESPACE_PREFIX_SEPARATOR}{remote_file}'"
113
+ )
114
+ remote_file = remote_file.replace("/", "%2F")
115
+ link_ = link(
116
+ url,
117
+ f"#/objects/{namespace}/{remote_file}?object=true",
118
+ )
119
+ print_log(f"Object URL: {link_}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: yellowdog-python-examples
3
- Version: 7.8.5
3
+ Version: 7.8.7
4
4
  Summary: Example Python commands using the YellowDog Python SDK
5
5
  Home-page: https://github.com/yellowdog/python-examples
6
6
  Author: YellowDog Limited
@@ -1 +0,0 @@
1
- __version__ = "7.8.5"