yellowdog-python-examples 7.18.1__tar.gz → 7.18.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.
- {yellowdog_python_examples-7.18.1/yellowdog_python_examples.egg-info → yellowdog_python_examples-7.18.3}/PKG-INFO +3 -2
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/README.md +31 -23
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/requirements.txt +2 -1
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/tests/test_demos.py +1 -1
- yellowdog_python_examples-7.18.3/yellowdog_cli/__init__.py +1 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/list.py +16 -4
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/show.py +3 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/args.py +45 -16
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/interactive.py +4 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/load_config.py +31 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/printing.py +27 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/settings.py +1 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/variables.py +2 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3/yellowdog_python_examples.egg-info}/PKG-INFO +3 -2
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_python_examples.egg-info/requires.txt +2 -1
- yellowdog_python_examples-7.18.1/yellowdog_cli/__init__.py +0 -1
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/LICENSE +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/PYPI_README.md +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/pyproject.toml +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/setup.cfg +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/tests/test_create_remove.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/tests/test_dryruns.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/tests/test_entrypoints.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/tests/test_gui.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/tests/test_list.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/tests/test_objects.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/tests/test_variable_processing.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/abort.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/admin.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/boost.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/cancel.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/cloudwizard.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/compare.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/create.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/delete.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/download.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/follow.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/format_json.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/hold.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/instantiate.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/jsonnet2json.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/provision.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/remove.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/resize.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/shutdown.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/start.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/submit.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/terminate.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/upload.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/__init__.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/check_imports.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/cloudwizard_aws.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/cloudwizard_aws_types.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/cloudwizard_azure.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/cloudwizard_common.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/cloudwizard_gcp.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/compact_json.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/config_types.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/csv_data.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/entity_utils.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/follow_utils.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/items.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/load_resources.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/misc_utils.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/property_names.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/provision_utils.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/rich_console_input_fixed.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/start_hold_common.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/submit_utils.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/type_check.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/upload_utils.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/validate_properties.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/wrapper.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/ydid_utils.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/version.py +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_python_examples.egg-info/SOURCES.txt +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_python_examples.egg-info/dependency_links.txt +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_python_examples.egg-info/entry_points.txt +0 -0
- {yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_python_examples.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: yellowdog-python-examples
|
|
3
|
-
Version: 7.18.
|
|
3
|
+
Version: 7.18.3
|
|
4
4
|
Summary: Python CLI commands using the YellowDog Python SDK
|
|
5
5
|
Author-email: YellowDog Limited <support@yellowdog.co>
|
|
6
6
|
Project-URL: Homepage, https://github.com/yellowdog/python-examples
|
|
@@ -15,11 +15,12 @@ Description-Content-Type: text/markdown
|
|
|
15
15
|
License-File: LICENSE
|
|
16
16
|
Requires-Dist: PyPAC>=0.16.4
|
|
17
17
|
Requires-Dist: dateparser
|
|
18
|
+
Requires-Dist: dotenv
|
|
18
19
|
Requires-Dist: requests
|
|
19
20
|
Requires-Dist: rich==13.9.4
|
|
20
21
|
Requires-Dist: tabulate>=0.9.0
|
|
21
22
|
Requires-Dist: toml
|
|
22
|
-
Requires-Dist: yellowdog-sdk>=9.
|
|
23
|
+
Requires-Dist: yellowdog-sdk>=9.3.3
|
|
23
24
|
Provides-Extra: jsonnet
|
|
24
25
|
Requires-Dist: jsonnet; extra == "jsonnet"
|
|
25
26
|
Provides-Extra: cloudwizard
|
|
@@ -10,9 +10,10 @@
|
|
|
10
10
|
* [Configuration](#configuration)
|
|
11
11
|
* [Naming Rules](#naming-rules)
|
|
12
12
|
* [Common Properties](#common-properties)
|
|
13
|
-
* [Importing common
|
|
13
|
+
* [Importing common Properties](#importing-common-properties)
|
|
14
14
|
* [HTTPS Proxy Support](#https-proxy-support)
|
|
15
15
|
* [Specifying Common Properties using the Command Line or Environment Variables](#specifying-common-properties-using-the-command-line-or-environment-variables)
|
|
16
|
+
* [Support for .env Files](#support-for-env-files)
|
|
16
17
|
* [Variable Substitutions in Common Properties](#variable-substitutions-in-common-properties)
|
|
17
18
|
* [Variable Substitutions](#variable-substitutions)
|
|
18
19
|
* [Default Variables](#default-variables)
|
|
@@ -99,7 +100,7 @@
|
|
|
99
100
|
* [Namespace Policies](#namespace-policies)
|
|
100
101
|
* [Groups](#groups)
|
|
101
102
|
* [Applications](#applications)
|
|
102
|
-
* [Creating and
|
|
103
|
+
* [Creating and Regenerating Application Keys](#creating-and-regenerating-application-keys)
|
|
103
104
|
* [Users](#users)
|
|
104
105
|
* [Jsonnet Support](#jsonnet-support)
|
|
105
106
|
* [Jsonnet Installation](#jsonnet-installation)
|
|
@@ -130,7 +131,7 @@
|
|
|
130
131
|
* [yd-compare](#yd-compare)
|
|
131
132
|
|
|
132
133
|
<!-- Created by https://github.com/ekalinin/github-markdown-toc -->
|
|
133
|
-
<!-- Added by: pwt, at:
|
|
134
|
+
<!-- Added by: pwt, at: Mon Jul 28 21:41:59 BST 2025 -->
|
|
134
135
|
|
|
135
136
|
<!--te-->
|
|
136
137
|
|
|
@@ -161,7 +162,7 @@ The commands provide the following capabilities:
|
|
|
161
162
|
- **Listing** YellowDog items using the **`yd-list`** command
|
|
162
163
|
- **Resizing** Worker Pools and Compute Requirements with the **`yd-resize`** command
|
|
163
164
|
- **Boosting** Allowances with the **`yd-boost`** command
|
|
164
|
-
- **Creating, Updating and Removing** Source Templates, Compute Templates, Keyrings, Credentials,
|
|
165
|
+
- **Creating, Updating and Removing** Compute Source Templates, Compute Requirement Templates, Keyrings, Credentials, Storage Configurations, Image Families, Allowances, Configured Worker Pools, User Attributes, Namespace Policies, Groups, and Applications with the **`yd-create`** and **`yd-remove`** commands
|
|
165
166
|
- **Following Event Streams** for Work Requirements, Worker Pools and Compute Requirements with the **`yd-follow`** command
|
|
166
167
|
- **Showing** the details of any YellowDog entity using its YellowDog ID with the **`yd-show`** command
|
|
167
168
|
- **Comparing** whether worker pools are a match for task groups with the **`yd-compare`** command
|
|
@@ -328,7 +329,7 @@ An example `common` section is shown below:
|
|
|
328
329
|
|
|
329
330
|
Indentation is optional in TOML files and is for readability only.
|
|
330
331
|
|
|
331
|
-
## Importing `common`
|
|
332
|
+
## Importing `common` Properties
|
|
332
333
|
|
|
333
334
|
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:
|
|
334
335
|
|
|
@@ -383,6 +384,12 @@ When setting the value of the above properties, a property set on the command li
|
|
|
383
384
|
|
|
384
385
|
If all the required common properties are set using the command line or environment variables, then the entire `common` section of the TOML file can be omitted.
|
|
385
386
|
|
|
387
|
+
## Support for `.env` Files
|
|
388
|
+
|
|
389
|
+
Environment variables can also be set in a `.env` file, typically in the user's home directory. Entries in the `.env` file will not overwrite existing environment variables -- i.e., environment variables take precedence over entries in the `.env` file.
|
|
390
|
+
|
|
391
|
+
Environment variables sourced from a `.env` file whose names start with `YD` will be reported on the command line. Variables that do not start with `YD` will not be reported, but they will still be applied.
|
|
392
|
+
|
|
386
393
|
## Variable Substitutions in Common Properties
|
|
387
394
|
|
|
388
395
|
Note the use of `{{username}}` in the value of the `tag` property example above: this is a **variable substitution** that can optionally be used to insert the login username of the user running the commands. So, for username `abc`, the `tag` would be set to `testing-abc`. This can be helpful to disambiguate multiple users running with the same configuration data.
|
|
@@ -464,7 +471,8 @@ The precedence order for setting variables is:
|
|
|
464
471
|
1. Command line
|
|
465
472
|
2. `YD_VAR` environment variables
|
|
466
473
|
3. General environment variables
|
|
467
|
-
4.
|
|
474
|
+
4. Variables in a `.env` file
|
|
475
|
+
5. TOML file
|
|
468
476
|
|
|
469
477
|
This method can also be used to override the default variables, e.g., setting `-v username="other-user"` will override the default `{{username}}` variable.
|
|
470
478
|
|
|
@@ -824,6 +832,9 @@ Here's an example of the `workRequirement` section of a TOML configuration file,
|
|
|
824
832
|
providers = ["AWS"]
|
|
825
833
|
ram = [0.5, 2.0]
|
|
826
834
|
regions = ["eu-west-2"]
|
|
835
|
+
retryableErrors = [
|
|
836
|
+
{processExitCodes = [143], statusesAtFailure = ["FAILED"], errorTypes = ["ALLOCATION_LOST"]},
|
|
837
|
+
]
|
|
827
838
|
setTaskNames = false
|
|
828
839
|
tag = "my_tag"
|
|
829
840
|
taskBatchSize = 1000
|
|
@@ -844,9 +855,6 @@ Here's an example of the `workRequirement` section of a TOML configuration file,
|
|
|
844
855
|
taskTimeout = 120.0
|
|
845
856
|
taskType = "docker"
|
|
846
857
|
tasksPerWorker = 1
|
|
847
|
-
retryableErrors = [
|
|
848
|
-
{processExitCodes = [143], statusesAtFailure = ["FAILED"], errorTypes = ["ALLOCATION_LOST"]},
|
|
849
|
-
]
|
|
850
858
|
uploadFiles = [{localPath = "file_1.txt", uploadPath = "file_1.txt"}]
|
|
851
859
|
uploadTaskProcessOutput = true
|
|
852
860
|
vcpus = [1, 4]
|
|
@@ -892,6 +900,13 @@ Showing all possible properties at the Work Requirement level:
|
|
|
892
900
|
"providers": ["AWS"],
|
|
893
901
|
"ram": [0.5, 2],
|
|
894
902
|
"regions": ["eu-west-2"],
|
|
903
|
+
"retryableErrors": [
|
|
904
|
+
{
|
|
905
|
+
"processExitCodes": [143],
|
|
906
|
+
"statusesAtFailure" : ["FAILED"],
|
|
907
|
+
"errorTypes": ["ALLOCATION_LOST"]
|
|
908
|
+
}
|
|
909
|
+
]
|
|
895
910
|
"setTaskNames": false,
|
|
896
911
|
"tag": "my_tag"
|
|
897
912
|
"taskCount": 100,
|
|
@@ -906,13 +921,6 @@ Showing all possible properties at the Work Requirement level:
|
|
|
906
921
|
{"alwaysUpload": false, "destination": "dest_path_2", "source": "out_src_path_2"}
|
|
907
922
|
],
|
|
908
923
|
"taskGroupCount": 5,
|
|
909
|
-
"retryableErrors": [
|
|
910
|
-
{
|
|
911
|
-
"processExitCodes": [143],
|
|
912
|
-
"statusesAtFailure" : ["FAILED"],
|
|
913
|
-
"errorTypes": ["ALLOCATION_LOST"]
|
|
914
|
-
}
|
|
915
|
-
]
|
|
916
924
|
"taskTimeout": 120.0,
|
|
917
925
|
"taskTypes": ["docker"],
|
|
918
926
|
"tasksPerWorker": 1,
|
|
@@ -970,6 +978,13 @@ Showing all possible properties at the Task Group level:
|
|
|
970
978
|
"providers": ["AWS"],
|
|
971
979
|
"ram": [0.5, 2],
|
|
972
980
|
"regions": ["eu-west-2"],
|
|
981
|
+
"retryableErrors": [
|
|
982
|
+
{
|
|
983
|
+
"processExitCodes": [143],
|
|
984
|
+
"statusesAtFailure" : ["FAILED"],
|
|
985
|
+
"errorTypes": ["ALLOCATION_LOST"]
|
|
986
|
+
}
|
|
987
|
+
]
|
|
973
988
|
"setTaskNames": false,
|
|
974
989
|
"tag": "my_tag",
|
|
975
990
|
"taskCount": 5,
|
|
@@ -983,13 +998,6 @@ Showing all possible properties at the Task Group level:
|
|
|
983
998
|
{"alwaysUpload": true, "destination": "dest_path_1", "source": "out_src_path_1"},
|
|
984
999
|
{"alwaysUpload": false, "destination": "dest_path_2", "source": "out_src_path_2"}
|
|
985
1000
|
],
|
|
986
|
-
"retryableErrors": [
|
|
987
|
-
{
|
|
988
|
-
"processExitCodes": [143],
|
|
989
|
-
"statusesAtFailure" : ["FAILED"],
|
|
990
|
-
"errorTypes": ["ALLOCATION_LOST"]
|
|
991
|
-
}
|
|
992
|
-
]
|
|
993
1001
|
"taskTimeout": 120.0,
|
|
994
1002
|
"taskTypes": ["docker"],
|
|
995
1003
|
"tasksPerWorker": 1,
|
|
@@ -63,7 +63,7 @@ class TestDemos:
|
|
|
63
63
|
|
|
64
64
|
def test_montecarlo_graviton(self):
|
|
65
65
|
result = shell(
|
|
66
|
-
f"cd {DEMO_DIR}/montecarlo && yd-provision -c
|
|
66
|
+
f"cd {DEMO_DIR}/montecarlo && yd-provision -c config-graviton.toml && yd-submit -f && yd-terminate -y && yd-delete -y"
|
|
67
67
|
)
|
|
68
68
|
assert result.exit_code == 0
|
|
69
69
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "7.18.3"
|
|
@@ -93,6 +93,18 @@ def main():
|
|
|
93
93
|
# Always use interactive mode for selections
|
|
94
94
|
ARGS_PARSER.interactive = True
|
|
95
95
|
|
|
96
|
+
if (
|
|
97
|
+
ARGS_PARSER.auto_select_all
|
|
98
|
+
or ARGS_PARSER.strip_ids
|
|
99
|
+
or ARGS_PARSER.substitute_ids
|
|
100
|
+
or ARGS_PARSER.output_file
|
|
101
|
+
) and not ARGS_PARSER.details:
|
|
102
|
+
print_log("Automatically setting the '--details' option")
|
|
103
|
+
ARGS_PARSER.details = True
|
|
104
|
+
|
|
105
|
+
if ARGS_PARSER.details and ARGS_PARSER.strip_ids:
|
|
106
|
+
print_log("Omitting YellowDog IDs from detailed JSON objects")
|
|
107
|
+
|
|
96
108
|
if ARGS_PARSER.output_file and ARGS_PARSER.details:
|
|
97
109
|
if exists(ARGS_PARSER.output_file):
|
|
98
110
|
if not confirmed(
|
|
@@ -108,9 +120,9 @@ def main():
|
|
|
108
120
|
list_worker_pools()
|
|
109
121
|
elif ARGS_PARSER.compute_requirements or ARGS_PARSER.instances:
|
|
110
122
|
list_compute_requirements()
|
|
111
|
-
elif ARGS_PARSER.
|
|
123
|
+
elif ARGS_PARSER.compute_requirement_templates:
|
|
112
124
|
list_compute_requirement_templates()
|
|
113
|
-
elif ARGS_PARSER.
|
|
125
|
+
elif ARGS_PARSER.compute_source_templates:
|
|
114
126
|
list_compute_source_templates()
|
|
115
127
|
elif ARGS_PARSER.keyrings:
|
|
116
128
|
list_keyrings()
|
|
@@ -145,7 +157,7 @@ def check_for_valid_option() -> bool:
|
|
|
145
157
|
ARGS_PARSER.applications,
|
|
146
158
|
ARGS_PARSER.attribute_definitions,
|
|
147
159
|
ARGS_PARSER.compute_requirements,
|
|
148
|
-
ARGS_PARSER.
|
|
160
|
+
ARGS_PARSER.compute_requirement_templates,
|
|
149
161
|
ARGS_PARSER.groups,
|
|
150
162
|
ARGS_PARSER.image_families,
|
|
151
163
|
ARGS_PARSER.instances,
|
|
@@ -156,7 +168,7 @@ def check_for_valid_option() -> bool:
|
|
|
156
168
|
ARGS_PARSER.object_paths,
|
|
157
169
|
ARGS_PARSER.permissions,
|
|
158
170
|
ARGS_PARSER.roles,
|
|
159
|
-
ARGS_PARSER.
|
|
171
|
+
ARGS_PARSER.compute_source_templates,
|
|
160
172
|
ARGS_PARSER.task_groups,
|
|
161
173
|
ARGS_PARSER.tasks,
|
|
162
174
|
ARGS_PARSER.users,
|
|
@@ -33,6 +33,9 @@ def main():
|
|
|
33
33
|
# and the 'quiet' option is enabled
|
|
34
34
|
generate_json_list = len(ARGS_PARSER.yellowdog_ids) > 1 and ARGS_PARSER.quiet
|
|
35
35
|
|
|
36
|
+
if ARGS_PARSER.details and ARGS_PARSER.strip_ids:
|
|
37
|
+
print_log("Omitting YellowDog IDs from detailed JSON objects")
|
|
38
|
+
|
|
36
39
|
if generate_json_list:
|
|
37
40
|
print("[")
|
|
38
41
|
|
{yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/args.py
RENAMED
|
@@ -494,13 +494,6 @@ class CLIParser:
|
|
|
494
494
|
" level prefixes"
|
|
495
495
|
),
|
|
496
496
|
)
|
|
497
|
-
parser.add_argument(
|
|
498
|
-
"--details",
|
|
499
|
-
"-d",
|
|
500
|
-
action="store_true",
|
|
501
|
-
required=False,
|
|
502
|
-
help="show the full details of (interactively) selected objects",
|
|
503
|
-
)
|
|
504
497
|
parser.add_argument(
|
|
505
498
|
"--work-requirements",
|
|
506
499
|
"-w",
|
|
@@ -547,14 +540,14 @@ class CLIParser:
|
|
|
547
540
|
),
|
|
548
541
|
)
|
|
549
542
|
parser.add_argument(
|
|
550
|
-
"--compute-templates",
|
|
543
|
+
"--compute-requirement-templates",
|
|
551
544
|
"-C",
|
|
552
545
|
action="store_true",
|
|
553
546
|
required=False,
|
|
554
547
|
help="list compute requirement templates",
|
|
555
548
|
)
|
|
556
549
|
parser.add_argument(
|
|
557
|
-
"--source-templates",
|
|
550
|
+
"--compute-source-templates",
|
|
558
551
|
"-S",
|
|
559
552
|
action="store_true",
|
|
560
553
|
required=False,
|
|
@@ -657,16 +650,29 @@ class CLIParser:
|
|
|
657
650
|
required=False,
|
|
658
651
|
help="list permissions",
|
|
659
652
|
)
|
|
653
|
+
parser.add_argument(
|
|
654
|
+
"--details",
|
|
655
|
+
"-d",
|
|
656
|
+
action="store_true",
|
|
657
|
+
required=False,
|
|
658
|
+
help="show the full JSON representation of objects",
|
|
659
|
+
)
|
|
660
660
|
parser.add_argument(
|
|
661
661
|
"--output-file",
|
|
662
662
|
type=str,
|
|
663
663
|
required=False,
|
|
664
664
|
help=(
|
|
665
|
-
"if specified, the 'details' resource listing will be
|
|
665
|
+
"if specified, the 'details' JSON resource listing will also be written "
|
|
666
666
|
"to the nominated output file"
|
|
667
667
|
),
|
|
668
668
|
metavar="<output-file>",
|
|
669
669
|
)
|
|
670
|
+
parser.add_argument(
|
|
671
|
+
"--auto-select-all",
|
|
672
|
+
action="store_true",
|
|
673
|
+
required=False,
|
|
674
|
+
help="use with '--details' to select all objects automatically",
|
|
675
|
+
)
|
|
670
676
|
|
|
671
677
|
if any(module in sys.argv[0] for module in ["upload"]):
|
|
672
678
|
parser.add_argument(
|
|
@@ -1165,8 +1171,17 @@ class CLIParser:
|
|
|
1165
1171
|
action="store_true",
|
|
1166
1172
|
required=False,
|
|
1167
1173
|
help=(
|
|
1168
|
-
"substitute compute source template IDs and
|
|
1169
|
-
"names in detailed compute requirement templates"
|
|
1174
|
+
"use with '--details' to substitute compute source template IDs and "
|
|
1175
|
+
"image family IDs for names in detailed compute requirement templates"
|
|
1176
|
+
),
|
|
1177
|
+
)
|
|
1178
|
+
parser.add_argument(
|
|
1179
|
+
"--strip-ids",
|
|
1180
|
+
action="store_true",
|
|
1181
|
+
required=False,
|
|
1182
|
+
help=(
|
|
1183
|
+
"use with '--details' to omit the YellowDog IDs of objects from "
|
|
1184
|
+
"their JSON representations"
|
|
1170
1185
|
),
|
|
1171
1186
|
)
|
|
1172
1187
|
|
|
@@ -1334,6 +1349,10 @@ class CLIParser:
|
|
|
1334
1349
|
def details(self) -> Optional[bool]:
|
|
1335
1350
|
return self.args.details
|
|
1336
1351
|
|
|
1352
|
+
@details.setter
|
|
1353
|
+
def details(self, interactive: bool):
|
|
1354
|
+
self.args.details = interactive
|
|
1355
|
+
|
|
1337
1356
|
@property
|
|
1338
1357
|
@allow_missing_attribute
|
|
1339
1358
|
def debug(self) -> Optional[bool]:
|
|
@@ -1491,13 +1510,13 @@ class CLIParser:
|
|
|
1491
1510
|
|
|
1492
1511
|
@property
|
|
1493
1512
|
@allow_missing_attribute
|
|
1494
|
-
def
|
|
1495
|
-
return self.args.
|
|
1513
|
+
def compute_requirement_templates(self) -> Optional[bool]:
|
|
1514
|
+
return self.args.compute_requirement_templates
|
|
1496
1515
|
|
|
1497
1516
|
@property
|
|
1498
1517
|
@allow_missing_attribute
|
|
1499
|
-
def
|
|
1500
|
-
return self.args.
|
|
1518
|
+
def compute_source_templates(self) -> Optional[bool]:
|
|
1519
|
+
return self.args.compute_source_templates
|
|
1501
1520
|
|
|
1502
1521
|
@property
|
|
1503
1522
|
@allow_missing_attribute
|
|
@@ -1734,6 +1753,16 @@ class CLIParser:
|
|
|
1734
1753
|
def running_nodes_only(self) -> Optional[bool]:
|
|
1735
1754
|
return self.args.running_nodes_only
|
|
1736
1755
|
|
|
1756
|
+
@property
|
|
1757
|
+
@allow_missing_attribute
|
|
1758
|
+
def strip_ids(self) -> Optional[bool]:
|
|
1759
|
+
return self.args.strip_ids
|
|
1760
|
+
|
|
1761
|
+
@property
|
|
1762
|
+
@allow_missing_attribute
|
|
1763
|
+
def auto_select_all(self) -> Optional[bool]:
|
|
1764
|
+
return self.args.auto_select_all
|
|
1765
|
+
|
|
1737
1766
|
|
|
1738
1767
|
def lookup_module_description(module_name: str) -> Optional[str]:
|
|
1739
1768
|
"""
|
|
@@ -63,6 +63,10 @@ def select(
|
|
|
63
63
|
if not ARGS_PARSER.interactive and force_interactive is False:
|
|
64
64
|
return objects
|
|
65
65
|
|
|
66
|
+
if ARGS_PARSER.auto_select_all:
|
|
67
|
+
print_log("Automatically selecting all objects")
|
|
68
|
+
return objects
|
|
69
|
+
|
|
66
70
|
return [
|
|
67
71
|
objects[x - 1]
|
|
68
72
|
for x in get_selected_list_items(
|
|
@@ -9,6 +9,7 @@ from pathlib import Path
|
|
|
9
9
|
from sys import exit
|
|
10
10
|
from typing import Dict
|
|
11
11
|
|
|
12
|
+
from dotenv import dotenv_values, find_dotenv, load_dotenv
|
|
12
13
|
from toml import TomlDecodeError
|
|
13
14
|
|
|
14
15
|
from yellowdog_cli.utils.args import ARGS_PARSER
|
|
@@ -101,6 +102,10 @@ def load_config_common() -> ConfigCommon:
|
|
|
101
102
|
common_section_imported.update(common_section)
|
|
102
103
|
common_section = common_section_imported
|
|
103
104
|
|
|
105
|
+
# Load extra environment variables from a .env file if it exists;
|
|
106
|
+
# do not override existing variables (environment takes precedence)
|
|
107
|
+
_load_dotenv()
|
|
108
|
+
|
|
104
109
|
# Replace common section properties with command line or
|
|
105
110
|
# environment variable overrides. Precedence is:
|
|
106
111
|
# command line > environment variable > config file
|
|
@@ -445,3 +450,29 @@ def load_config_worker_pool() -> ConfigWorkerPool:
|
|
|
445
450
|
except ValueError as e:
|
|
446
451
|
print_error(f"Invalid type for configuration: {e}")
|
|
447
452
|
exit(1)
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
def _load_dotenv():
|
|
456
|
+
"""
|
|
457
|
+
Load extra environment variables from a .env file if it exists.
|
|
458
|
+
Do not override existing variables (environment takes precedence).
|
|
459
|
+
Report on YD vars that are taken from .env.
|
|
460
|
+
"""
|
|
461
|
+
dotenv_file = find_dotenv()
|
|
462
|
+
if dotenv_file == "":
|
|
463
|
+
return
|
|
464
|
+
|
|
465
|
+
dotenv_yd_substitutions = [ # Find 'YD' variables
|
|
466
|
+
f"'{key}'"
|
|
467
|
+
for key in dotenv_values(dotenv_file).keys()
|
|
468
|
+
if key.startswith("YD") and os.environ.get(key) is None
|
|
469
|
+
]
|
|
470
|
+
|
|
471
|
+
if len(dotenv_yd_substitutions) > 0:
|
|
472
|
+
print_log(
|
|
473
|
+
f"Adding 'YD' environment variables from '.env' file '{dotenv_file}': "
|
|
474
|
+
f"{', '.join(dotenv_yd_substitutions)}"
|
|
475
|
+
)
|
|
476
|
+
|
|
477
|
+
# Actually load the variables (including non-'YD' variables)
|
|
478
|
+
load_dotenv(dotenv_file, override=False)
|
|
@@ -71,6 +71,8 @@ from yellowdog_cli.utils.settings import (
|
|
|
71
71
|
MAX_LINES_COLOURED_FORMATTING,
|
|
72
72
|
MAX_TABLE_DESCRIPTION,
|
|
73
73
|
NAMESPACE_OBJECT_STORE_PREFIX_SEPARATOR,
|
|
74
|
+
PROP_CREATED_TIME,
|
|
75
|
+
PROP_ID,
|
|
74
76
|
PROP_RESOURCE,
|
|
75
77
|
WARNING_STYLE,
|
|
76
78
|
)
|
|
@@ -1062,6 +1064,30 @@ def print_yd_object(
|
|
|
1062
1064
|
using the compact JSON encoder.
|
|
1063
1065
|
"""
|
|
1064
1066
|
object_data: object = Json.dump(yd_object)
|
|
1067
|
+
|
|
1068
|
+
def remove_unused_props(d):
|
|
1069
|
+
"""
|
|
1070
|
+
Helper function to remove the 'id' and 'createdTime' properties
|
|
1071
|
+
recursively.
|
|
1072
|
+
"""
|
|
1073
|
+
if isinstance(d, dict):
|
|
1074
|
+
# Create a new dictionary omitting the 'id' and 'createdTime'
|
|
1075
|
+
# keys
|
|
1076
|
+
return {
|
|
1077
|
+
k: remove_unused_props(v)
|
|
1078
|
+
for k, v in d.items()
|
|
1079
|
+
if k not in [PROP_ID, PROP_CREATED_TIME]
|
|
1080
|
+
}
|
|
1081
|
+
elif isinstance(d, list):
|
|
1082
|
+
# Recursively process each item in the list
|
|
1083
|
+
return [remove_unused_props(item) for item in d]
|
|
1084
|
+
else:
|
|
1085
|
+
# Return non-dict/list values unchanged
|
|
1086
|
+
return d
|
|
1087
|
+
|
|
1088
|
+
if ARGS_PARSER.strip_ids:
|
|
1089
|
+
object_data = remove_unused_props(object_data)
|
|
1090
|
+
|
|
1065
1091
|
if add_fields is not None:
|
|
1066
1092
|
# Requires a copy of the 'object' datatype to be made,
|
|
1067
1093
|
# in order to insert additional fields
|
|
@@ -1071,6 +1097,7 @@ def print_yd_object(
|
|
|
1071
1097
|
for key, value in add_fields.items():
|
|
1072
1098
|
object_data_new[key] = value
|
|
1073
1099
|
object_data = object_data_new
|
|
1100
|
+
|
|
1074
1101
|
print_json(object_data, initial_indent, drop_first_line, with_final_comma)
|
|
1075
1102
|
|
|
1076
1103
|
|
|
@@ -134,6 +134,7 @@ RN_USER = "User"
|
|
|
134
134
|
|
|
135
135
|
# Property Names
|
|
136
136
|
PROP_AUTOSCALING_MAX_NODES = "autoscalingMaxNodes"
|
|
137
|
+
PROP_CREATED_TIME = "createdTime"
|
|
137
138
|
PROP_CREDENTIAL = "credential"
|
|
138
139
|
PROP_CST_ID = "sourceTemplateId"
|
|
139
140
|
PROP_DEFAULT_RANK_ORDER = "defaultRankOrder"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: yellowdog-python-examples
|
|
3
|
-
Version: 7.18.
|
|
3
|
+
Version: 7.18.3
|
|
4
4
|
Summary: Python CLI commands using the YellowDog Python SDK
|
|
5
5
|
Author-email: YellowDog Limited <support@yellowdog.co>
|
|
6
6
|
Project-URL: Homepage, https://github.com/yellowdog/python-examples
|
|
@@ -15,11 +15,12 @@ Description-Content-Type: text/markdown
|
|
|
15
15
|
License-File: LICENSE
|
|
16
16
|
Requires-Dist: PyPAC>=0.16.4
|
|
17
17
|
Requires-Dist: dateparser
|
|
18
|
+
Requires-Dist: dotenv
|
|
18
19
|
Requires-Dist: requests
|
|
19
20
|
Requires-Dist: rich==13.9.4
|
|
20
21
|
Requires-Dist: tabulate>=0.9.0
|
|
21
22
|
Requires-Dist: toml
|
|
22
|
-
Requires-Dist: yellowdog-sdk>=9.
|
|
23
|
+
Requires-Dist: yellowdog-sdk>=9.3.3
|
|
23
24
|
Provides-Extra: jsonnet
|
|
24
25
|
Requires-Dist: jsonnet; extra == "jsonnet"
|
|
25
26
|
Provides-Extra: cloudwizard
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "7.18.1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/tests/test_create_remove.py
RENAMED
|
File without changes
|
|
File without changes
|
{yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/tests/test_entrypoints.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/abort.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/admin.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/boost.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/cancel.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/cloudwizard.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/compare.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/create.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/delete.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/download.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/follow.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/format_json.py
RENAMED
|
File without changes
|
|
File without changes
|
{yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/instantiate.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/jsonnet2json.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/provision.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/remove.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/resize.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/shutdown.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/start.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/submit.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/terminate.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/upload.py
RENAMED
|
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
|
{yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/items.py
RENAMED
|
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
|
{yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/utils/wrapper.py
RENAMED
|
File without changes
|
|
File without changes
|
{yellowdog_python_examples-7.18.1 → yellowdog_python_examples-7.18.3}/yellowdog_cli/version.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|