yellowdog-python-examples 7.9.1__tar.gz → 7.9.3__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.9.1/yellowdog_python_examples.egg-info → yellowdog_python_examples-7.9.3}/PKG-INFO +1 -1
  2. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/README.md +4 -4
  3. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/tests/test_demos.py +4 -0
  4. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/tests/test_dryruns.py +13 -0
  5. yellowdog_python_examples-7.9.3/yd_commands/__init__.py +1 -0
  6. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/args.py +1 -1
  7. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/create.py +9 -2
  8. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/delete.py +4 -12
  9. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/download.py +9 -8
  10. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/list.py +4 -14
  11. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/load_config.py +13 -0
  12. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/object_utilities.py +27 -0
  13. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/property_names.py +2 -0
  14. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/remove.py +3 -3
  15. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/submit.py +4 -1
  16. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/upload_utils.py +1 -1
  17. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3/yellowdog_python_examples.egg-info}/PKG-INFO +1 -1
  18. yellowdog_python_examples-7.9.1/yd_commands/__init__.py +0 -1
  19. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/LICENSE +0 -0
  20. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/PYPI_README.md +0 -0
  21. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/pyproject.toml +0 -0
  22. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/requirements.txt +0 -0
  23. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/setup.cfg +0 -0
  24. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/setup.py +0 -0
  25. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/tests/test_create_remove.py +0 -0
  26. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/tests/test_entrypoints.py +0 -0
  27. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/tests/test_gui.py +0 -0
  28. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/tests/test_list.py +0 -0
  29. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/tests/test_objects.py +0 -0
  30. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/tests/test_variable_processing.py +0 -0
  31. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/abort.py +0 -0
  32. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/admin.py +0 -0
  33. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/boost.py +0 -0
  34. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/cancel.py +0 -0
  35. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/check_imports.py +0 -0
  36. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/cloudwizard.py +0 -0
  37. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/cloudwizard_aws.py +0 -0
  38. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/cloudwizard_aws_types.py +0 -0
  39. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/cloudwizard_azure.py +0 -0
  40. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/cloudwizard_common.py +0 -0
  41. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/cloudwizard_gcp.py +0 -0
  42. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/compact_json.py +0 -0
  43. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/config_types.py +0 -0
  44. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/csv_data.py +0 -0
  45. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/follow.py +0 -0
  46. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/follow_utils.py +0 -0
  47. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/format_json.py +0 -0
  48. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/hold.py +0 -0
  49. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/id_utils.py +0 -0
  50. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/instantiate.py +0 -0
  51. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/interactive.py +0 -0
  52. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/items.py +0 -0
  53. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/jsonnet2json.py +0 -0
  54. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/load_resources.py +0 -0
  55. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/printing.py +0 -0
  56. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/provision.py +0 -0
  57. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/provision_utils.py +0 -0
  58. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/resize.py +0 -0
  59. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/settings.py +0 -0
  60. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/shutdown.py +0 -0
  61. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/start.py +0 -0
  62. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/start_hold_common.py +0 -0
  63. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/submit_utils.py +0 -0
  64. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/terminate.py +0 -0
  65. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/type_check.py +0 -0
  66. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/upload.py +0 -0
  67. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/utils.py +0 -0
  68. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/validate_properties.py +0 -0
  69. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/variables.py +0 -0
  70. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/version.py +0 -0
  71. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yd_commands/wrapper.py +0 -0
  72. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yellowdog_python_examples.egg-info/SOURCES.txt +0 -0
  73. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yellowdog_python_examples.egg-info/dependency_links.txt +0 -0
  74. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yellowdog_python_examples.egg-info/entry_points.txt +0 -0
  75. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/yellowdog_python_examples.egg-info/requires.txt +0 -0
  76. {yellowdog_python_examples-7.9.1 → yellowdog_python_examples-7.9.3}/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.9.1
3
+ Version: 7.9.3
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
@@ -1275,7 +1275,7 @@ where <working_directory> is:
1275
1275
  /var/opt/yellowdog/agent/data/workers/ydid_task_D0D0D0_68f5e5be-dc93-49eb-a824-1fcdb52f9195_1_1/
1276
1276
  ```
1277
1277
 
1278
- Note that the Work Requirement name is automatically made available to the Task via the environment variable `YD_WORK_REQUIREMENT_NAME`, by `yd-submit`. It's also available for client-side variable substitution in Work Requirements using the variable `{{wr_name}}`.
1278
+ Note that the Work Requirement name is automatically made available to the Task via the environment variable `YD_WORK_REQUIREMENT_NAME`, by `yd-submit`, if the `addYDEnvironmentVariables` property is set to `true`. It's also available for client-side variable substitution in Work Requirements using the variable `{{wr_name}}`.
1279
1279
 
1280
1280
  ### Files Uploaded from a Node to the Object Store after Task Execution
1281
1281
 
@@ -1350,7 +1350,7 @@ This section discusses the context within which a Task operates when it's execut
1350
1350
 
1351
1351
  When a Task is allocated to a Worker on a node by the YellowDog Scheduler, the following steps are followed:
1352
1352
 
1353
- 1. The Agent running on the node downloads the Task's properties: its `taskType`, `arguments`, `environment`, `taskdata`, and (from the Object Store) any files in the `inputs` list and any available files in the `inputsOptional` list. A number of `YD_` environment variables are also automatically set by a combination of `yd_submit` and the Agent itself -- see above for details.
1353
+ 1. The Agent running on the node downloads the Task's properties: its `taskType`, `arguments`, `environment`, `taskdata`, and (from the Object Store) any files in the `inputs` list and any available files in the `inputsOptional` list. A number of `YD_` environment variables are also automatically set by a combination (optionally) of `yd_submit`, and the Agent itself -- see above for details.
1354
1354
  2. The downloaded files are placed in an ephemeral directory created for this Task's execution, and into which any output files are also written by default.
1355
1355
  2. The Agent runs the command specified for the `taskType` in the Agent's `application.yaml` configuration file. This done as a simple `exec` of a subprocess to run the Task.
1356
1356
  3. When the Task concludes, the Agent uses the exit code of the subprocess to report success (zero) or failure (non-zero).
@@ -2192,7 +2192,7 @@ Example:
2192
2192
  ```json
2193
2193
  {
2194
2194
  "resource": "NumericAttributeDefinition",
2195
- "name": "my-numeric-attribute",
2195
+ "name": "user.my-numeric-attribute",
2196
2196
  "title": "Attribute Title",
2197
2197
  "defaultRankOrder": "PREFER_LOWER",
2198
2198
  "description": "A description of the attribute",
@@ -2201,7 +2201,7 @@ Example:
2201
2201
  }
2202
2202
  ```
2203
2203
 
2204
- The `name`, `title` and `defaultRankOrder` properties are required, while the rest are optional. The `user.` prefix is required when specifying the `name` property.
2204
+ The `name`, `title` and `defaultRankOrder` properties are required, while the rest are optional. Either the `range` property or the `options` property (with numeric option values) can be specified, but not both. The `user.` prefix is required when specifying the `name` property.
2205
2205
 
2206
2206
  # Jsonnet Support
2207
2207
 
@@ -61,6 +61,10 @@ class TestDemos:
61
61
  result = shell(f"cd {DEMO_DIR}/montecarlo && {CMD_SEQ}")
62
62
  assert result.exit_code == 0
63
63
 
64
+ def test_ansys(self):
65
+ result = shell(f"cd {DEMO_DIR}/ansys && {CMD_SEQ}")
66
+ assert result.exit_code == 0
67
+
64
68
  def test_nextflow_image_montage(self):
65
69
  result = shell(
66
70
  f"cd {DEMO_DIR}/nextflow/image-montage && {NEXTFLOW} main.nf "
@@ -64,6 +64,10 @@ class TestDemoDryRuns:
64
64
  result = shell(f"cd {DEMO_DIR}/montecarlo && {CMD_SEQ}")
65
65
  assert result.exit_code == 0
66
66
 
67
+ def test_ansys(self):
68
+ result = shell(f"cd {DEMO_DIR}/ansys && {CMD_SEQ}")
69
+ assert result.exit_code == 0
70
+
67
71
  # Tests run from outside the demo directories
68
72
  def test_bash_out(self):
69
73
  demo_name = "bash"
@@ -182,3 +186,12 @@ class TestDemoDryRuns:
182
186
  f" {demo_name}/config.toml"
183
187
  )
184
188
  assert result.exit_code == 0
189
+
190
+ def test_ansys_out(self):
191
+ demo_name = "ansys"
192
+ result = shell(
193
+ f"cd {DEMO_DIR} && yd-provision -D -c {demo_name}/config.toml && yd-submit"
194
+ f" -D -c {demo_name}/config.toml && yd-instantiate -D -c"
195
+ f" {demo_name}/config.toml"
196
+ )
197
+ assert result.exit_code == 0
@@ -0,0 +1 @@
1
+ __version__ = "7.9.3"
@@ -534,7 +534,7 @@ class CLIParser:
534
534
  "-R",
535
535
  action="store_true",
536
536
  required=False,
537
- help="list attribute definitions",
537
+ help="list user attribute definitions",
538
538
  )
539
539
 
540
540
  if any(module in sys.argv[0] for module in ["upload"]):
@@ -124,7 +124,7 @@ def create_resources(
124
124
  RN_STRING_ATTRIBUTE_DEFINITION,
125
125
  RN_NUMERIC_ATTRIBUTE_DEFINITION,
126
126
  ]:
127
- create_attribute_definition_via_api(resource, resource_type)
127
+ create_attribute_definition(resource, resource_type)
128
128
  else:
129
129
  print_error(f"Unknown resource type '{resource_type}'")
130
130
  except Exception as e:
@@ -796,7 +796,7 @@ def _get_model_class(class_name: str):
796
796
  return getattr(model, class_name)
797
797
 
798
798
 
799
- def create_attribute_definition_via_api(resource: Dict, resource_type: str):
799
+ def create_attribute_definition(resource: Dict, resource_type: str):
800
800
  """
801
801
  Use the API to create/update user attribute definitions.
802
802
  """
@@ -812,21 +812,28 @@ def create_attribute_definition_via_api(resource: Dict, resource_type: str):
812
812
  headers = {"Authorization": f"yd-key {CONFIG_COMMON.key}:{CONFIG_COMMON.secret}"}
813
813
  if resource_type == RN_STRING_ATTRIBUTE_DEFINITION:
814
814
  payload = {
815
+ # Required
815
816
  "type": "co.yellowdog.platform.model.StringAttributeDefinition",
816
817
  "name": name,
817
818
  "title": title,
819
+ # Optional
818
820
  "description": resource.get("description"),
819
821
  "options": resource.get("options"),
820
822
  }
821
823
  else: # RN_NUMERIC_ATTRIBUTE_DEFINITION
822
824
  payload = {
825
+ # Required
823
826
  "type": "co.yellowdog.platform.model.NumericAttributeDefinition",
824
827
  "name": name,
825
828
  "title": title,
826
829
  "defaultRankOrder": default_rank_order,
830
+ # Optional
827
831
  "description": resource.get("description"),
828
832
  "units": resource.get("units"),
833
+ # Note: Only one of 'range', 'options' can be supplied
834
+ # Allow the API to error-check
829
835
  "range": resource.get("range"),
836
+ "options": resource.get("options"),
830
837
  }
831
838
 
832
839
  # Attempt attribute creation
@@ -4,11 +4,8 @@
4
4
  A script to delete YellowDog Object Store items.
5
5
  """
6
6
 
7
- from typing import List, Optional
8
-
9
- from yellowdog_client.model import ObjectPath, ObjectPathsRequest
10
-
11
7
  from yd_commands.interactive import confirmed, select
8
+ from yd_commands.object_utilities import list_matching_object_paths
12
9
  from yd_commands.printing import print_log
13
10
  from yd_commands.utils import unpack_namespace_in_prefix
14
11
  from yd_commands.wrapper import ARGS_PARSER, CLIENT, CONFIG_COMMON, main_wrapper
@@ -45,18 +42,13 @@ def delete_object_paths(namespace: str, prefix: str, flat: bool):
45
42
  f"prefix starting with '{prefix}'"
46
43
  )
47
44
 
48
- object_paths_to_delete: Optional[List[ObjectPath]] = (
49
- CLIENT.object_store_client.get_namespace_object_paths(
50
- ObjectPathsRequest(namespace=namespace, prefix=prefix, flat=flat)
51
- )
52
- )
45
+ object_paths_to_delete = list_matching_object_paths(CLIENT, namespace, prefix, flat)
53
46
 
54
- if object_paths_to_delete is None:
47
+ if len(object_paths_to_delete) == 0:
55
48
  print_log("No matching Object Paths")
56
49
  return
57
50
 
58
- if len(object_paths_to_delete) > 0:
59
- object_paths_to_delete = select(CLIENT, object_paths_to_delete)
51
+ object_paths_to_delete = select(CLIENT, object_paths_to_delete)
60
52
 
61
53
  if len(object_paths_to_delete) > 0 and confirmed(
62
54
  f"Delete {len(object_paths_to_delete)} Object Path(s)?"
@@ -6,9 +6,8 @@ A script to download YellowDog Object Store objects.
6
6
 
7
7
  from concurrent import futures
8
8
  from pathlib import Path
9
- from typing import List, Optional
9
+ from typing import Optional
10
10
 
11
- from yellowdog_client.model import ObjectPath, ObjectPathsRequest
12
11
  from yellowdog_client.object_store.download.download_batch_builder import (
13
12
  AbstractTransferBatch,
14
13
  DownloadBatchBuilder,
@@ -17,6 +16,7 @@ from yellowdog_client.object_store.download.download_batch_builder import (
17
16
  from yellowdog_client.object_store.model import FileTransferStatus
18
17
 
19
18
  from yd_commands.interactive import confirmed, select
19
+ from yd_commands.object_utilities import list_matching_object_paths
20
20
  from yd_commands.printing import print_batch_download_files, print_log
21
21
  from yd_commands.utils import unpack_namespace_in_prefix
22
22
  from yd_commands.wrapper import ARGS_PARSER, CLIENT, CONFIG_COMMON, main_wrapper
@@ -58,14 +58,15 @@ def download_object_paths(
58
58
  + ("" if pattern is None else f", matching name pattern '{pattern}'")
59
59
  )
60
60
 
61
- object_paths_to_download: List[ObjectPath] = (
62
- CLIENT.object_store_client.get_namespace_object_paths(
63
- ObjectPathsRequest(namespace=namespace, prefix=prefix, flat=flat)
64
- )
61
+ object_paths_to_download = list_matching_object_paths(
62
+ CLIENT, namespace, prefix, flat
65
63
  )
66
64
 
67
- if len(object_paths_to_download) > 0:
68
- object_paths_to_download = select(CLIENT, object_paths_to_download)
65
+ if len(object_paths_to_download) == 0:
66
+ print_log("No matching Object Paths")
67
+ return
68
+
69
+ object_paths_to_download = select(CLIENT, object_paths_to_download)
69
70
 
70
71
  if len(object_paths_to_download) == 0:
71
72
  print_log("No Objects Paths to include")
@@ -29,8 +29,6 @@ from yellowdog_client.model import (
29
29
  MachineImageFamilySummary,
30
30
  NamespaceStorageConfiguration,
31
31
  ObjectDetail,
32
- ObjectPath,
33
- ObjectPathsRequest,
34
32
  Task,
35
33
  TaskGroup,
36
34
  TaskSearch,
@@ -45,6 +43,7 @@ from yd_commands.interactive import select
45
43
  from yd_commands.object_utilities import (
46
44
  get_filtered_work_requirements,
47
45
  get_task_groups_from_wr_summary,
46
+ list_matching_object_paths,
48
47
  )
49
48
  from yd_commands.printing import (
50
49
  indent,
@@ -210,19 +209,10 @@ def list_object_paths():
210
209
  if ARGS_PARSER.all and not ARGS_PARSER.details:
211
210
  print_log("Listing all Objects")
212
211
 
213
- object_paths: List[ObjectPath] = (
214
- CLIENT.object_store_client.get_namespace_object_paths(
215
- ObjectPathsRequest(
216
- namespace=namespace,
217
- prefix=tag,
218
- flat=ARGS_PARSER.all,
219
- )
220
- )
221
- )
212
+ object_paths = list_matching_object_paths(CLIENT, namespace, tag, ARGS_PARSER.all)
222
213
 
223
- # We shouldn't get a None return, but ...
224
- if object_paths is None or len(object_paths) == 0:
225
- print_log("No matching Object Paths found")
214
+ if len(object_paths) == 0:
215
+ print_log("No matching Object Paths")
226
216
  return
227
217
 
228
218
  if not ARGS_PARSER.details:
@@ -150,6 +150,19 @@ def load_config_common() -> ConfigCommon:
150
150
  name_tag = process_variable_substitutions(common_section[NAME_TAG])
151
151
  add_substitutions_without_overwriting(subs={NAME_TAG: name_tag})
152
152
 
153
+ # Specify a certificates bundle directly by setting the requests
154
+ # environment variable; this will override the default certificates
155
+ certificates = process_variable_substitutions(
156
+ common_section.get(CERTIFICATES, None)
157
+ )
158
+ if certificates is not None:
159
+ certificates = abspath(certificates)
160
+ requests_ca_bundle = "REQUESTS_CA_BUNDLE"
161
+ print_log(
162
+ f"Setting environment variable '{requests_ca_bundle}' to '{certificates}'"
163
+ )
164
+ os.environ["REQUESTS_CA_BUNDLE"] = certificates
165
+
153
166
  return ConfigCommon(
154
167
  # Required
155
168
  key=key,
@@ -16,6 +16,8 @@ from yellowdog_client.model import (
16
16
  ComputeSourceTemplateSummary,
17
17
  MachineImageFamilySearch,
18
18
  MachineImageFamilySummary,
19
+ ObjectPath,
20
+ ObjectPathsRequest,
19
21
  ProvisionedWorkerPool,
20
22
  Task,
21
23
  TaskGroup,
@@ -279,3 +281,28 @@ def remove_allowances_matching_description(
279
281
  print_log(f"Removed Allowance with YellowDog ID {allowance.id}")
280
282
 
281
283
  return len(allowances)
284
+
285
+
286
+ def list_matching_object_paths(
287
+ client: PlatformClient, namespace: str, prefix: str, flat: bool
288
+ ) -> List[ObjectPath]:
289
+ """
290
+ List object paths matching the namespace and starting with the prefix.
291
+ """
292
+ object_paths: List[ObjectPath] = (
293
+ client.object_store_client.get_namespace_object_paths(
294
+ ObjectPathsRequest(namespace=namespace, prefix=prefix, flat=flat)
295
+ )
296
+ )
297
+
298
+ if object_paths is None:
299
+ return []
300
+
301
+ # Check that the prefix actually matches!
302
+ object_paths = [
303
+ object_path
304
+ for object_path in object_paths
305
+ if object_path.name.startswith(prefix)
306
+ ]
307
+
308
+ return object_paths
@@ -5,6 +5,7 @@ Property names.
5
5
  ADD_YD_ENV_VARS = "addYDEnvironmentVariables"
6
6
  ALWAYS_UPLOAD = "alwaysUpload" # Bool
7
7
  ARGS = "arguments" # List
8
+ CERTIFICATES = "certificates"
8
9
  COMMON_SECTION = "common" # No value
9
10
  COMPLETED_TASK_TTL = "completedTaskTtl" # Float
10
11
  COMPUTE_REQUIREMENT_BATCH_SIZE = "computeRequirementBatchSize" # Integer
@@ -102,6 +103,7 @@ ALL_KEYS = [
102
103
  ADD_YD_ENV_VARS,
103
104
  ALWAYS_UPLOAD,
104
105
  ARGS,
106
+ CERTIFICATES,
105
107
  COMMON_SECTION,
106
108
  COMPLETED_TASK_TTL,
107
109
  COMPUTE_REQUIREMENT_BATCH_SIZE,
@@ -99,7 +99,7 @@ def remove_resources(resources: Optional[List[Dict]] = None):
99
99
  RN_STRING_ATTRIBUTE_DEFINITION,
100
100
  RN_NUMERIC_ATTRIBUTE_DEFINITION,
101
101
  ]:
102
- remove_attribute_definition_via_api(resource)
102
+ remove_attribute_definition(resource)
103
103
  else:
104
104
  print_error(f"Unknown resource type '{resource_type}'")
105
105
  except Exception as e:
@@ -415,9 +415,9 @@ def remove_resource_by_id(resource_id: str):
415
415
  print_error(f"Unable to remove resource with ID {resource_id}: {e}")
416
416
 
417
417
 
418
- def remove_attribute_definition_via_api(resource: Dict):
418
+ def remove_attribute_definition(resource: Dict):
419
419
  """
420
- Use the API to remove user string attribute definitions.
420
+ Use the API to remove user attribute definitions.
421
421
  """
422
422
  try:
423
423
  name = resource["name"]
@@ -411,7 +411,10 @@ def create_task_group(
411
411
  if config_wr.task_type is not None and len(task_types) == 0:
412
412
  task_types.append(config_wr.task_type)
413
413
  if len(task_types) == 0:
414
- raise Exception(f"No Task Type(s) specified in Task Group '{task_group_name}'")
414
+ raise Exception(
415
+ f"No Task Type(s) specified in Task Group '{task_group_name}': "
416
+ "is a valid Work Requirement defined?"
417
+ )
415
418
 
416
419
  vcpus_data: Optional[List[float]] = check_list(
417
420
  task_group_data.get(VCPUS, wr_data.get(VCPUS, config_wr.vcpus))
@@ -10,7 +10,7 @@ from typing import Optional
10
10
  from yellowdog_client import PlatformClient
11
11
  from yellowdog_client.object_store.model import FileTransferStatus
12
12
 
13
- from yd_commands.printing import print_error, print_log
13
+ from yd_commands.printing import print_log
14
14
  from yd_commands.settings import NAMESPACE_PREFIX_SEPARATOR
15
15
  from yd_commands.utils import link
16
16
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: yellowdog-python-examples
3
- Version: 7.9.1
3
+ Version: 7.9.3
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.9.1"