yellowdog-python-examples 8.2.1__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.
Files changed (49) hide show
  1. yellowdog_cli/__init__.py +1 -1
  2. yellowdog_cli/abort.py +11 -11
  3. yellowdog_cli/admin.py +2 -2
  4. yellowdog_cli/application.py +104 -0
  5. yellowdog_cli/boost.py +3 -3
  6. yellowdog_cli/cancel.py +9 -9
  7. yellowdog_cli/cloudwizard.py +4 -4
  8. yellowdog_cli/compare.py +6 -6
  9. yellowdog_cli/create.py +56 -54
  10. yellowdog_cli/delete.py +10 -10
  11. yellowdog_cli/download.py +15 -15
  12. yellowdog_cli/finish.py +9 -9
  13. yellowdog_cli/instantiate.py +19 -17
  14. yellowdog_cli/list.py +45 -43
  15. yellowdog_cli/provision.py +28 -28
  16. yellowdog_cli/remove.py +28 -26
  17. yellowdog_cli/resize.py +9 -9
  18. yellowdog_cli/show.py +29 -27
  19. yellowdog_cli/shutdown.py +9 -9
  20. yellowdog_cli/submit.py +29 -29
  21. yellowdog_cli/terminate.py +8 -8
  22. yellowdog_cli/upload.py +11 -11
  23. yellowdog_cli/utils/args.py +2 -0
  24. yellowdog_cli/utils/cloudwizard_aws.py +32 -32
  25. yellowdog_cli/utils/cloudwizard_azure.py +27 -27
  26. yellowdog_cli/utils/cloudwizard_common.py +12 -10
  27. yellowdog_cli/utils/cloudwizard_gcp.py +8 -8
  28. yellowdog_cli/utils/csv_data.py +7 -7
  29. yellowdog_cli/utils/entity_utils.py +85 -20
  30. yellowdog_cli/utils/follow_utils.py +5 -5
  31. yellowdog_cli/utils/interactive.py +8 -8
  32. yellowdog_cli/utils/load_config.py +11 -11
  33. yellowdog_cli/utils/load_resources.py +4 -4
  34. yellowdog_cli/utils/misc_utils.py +6 -3
  35. yellowdog_cli/utils/printing.py +10 -9
  36. yellowdog_cli/utils/provision_utils.py +2 -2
  37. yellowdog_cli/utils/settings.py +1 -0
  38. yellowdog_cli/utils/start_hold_common.py +7 -7
  39. yellowdog_cli/utils/submit_utils.py +5 -5
  40. yellowdog_cli/utils/upload_utils.py +3 -3
  41. yellowdog_cli/utils/variables.py +5 -5
  42. yellowdog_cli/utils/wrapper.py +32 -53
  43. {yellowdog_python_examples-8.2.1.dist-info → yellowdog_python_examples-8.3.1.dist-info}/METADATA +3 -2
  44. yellowdog_python_examples-8.3.1.dist-info/RECORD +65 -0
  45. {yellowdog_python_examples-8.2.1.dist-info → yellowdog_python_examples-8.3.1.dist-info}/entry_points.txt +1 -0
  46. yellowdog_python_examples-8.2.1.dist-info/RECORD +0 -64
  47. {yellowdog_python_examples-8.2.1.dist-info → yellowdog_python_examples-8.3.1.dist-info}/WHEEL +0 -0
  48. {yellowdog_python_examples-8.2.1.dist-info → yellowdog_python_examples-8.3.1.dist-info}/licenses/LICENSE +0 -0
  49. {yellowdog_python_examples-8.2.1.dist-info → yellowdog_python_examples-8.3.1.dist-info}/top_level.txt +0 -0
yellowdog_cli/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "8.2.1"
1
+ __version__ = "8.3.1"
yellowdog_cli/abort.py CHANGED
@@ -21,7 +21,7 @@ from yellowdog_cli.utils.entity_utils import (
21
21
  from yellowdog_cli.utils.interactive import confirmed, select
22
22
  from yellowdog_cli.utils.printing import (
23
23
  print_error,
24
- print_log,
24
+ print_info,
25
25
  print_warning,
26
26
  sorted_objects,
27
27
  )
@@ -36,7 +36,7 @@ def main():
36
36
  _abort_tasks_by_name_or_id(ARGS_PARSER.task_id_list)
37
37
  return
38
38
 
39
- print_log(
39
+ print_info(
40
40
  "Finding active Work Requirements in "
41
41
  f"namespace '{CONFIG_COMMON.namespace}' with tags "
42
42
  f"including '{CONFIG_COMMON.name_tag}'"
@@ -66,7 +66,7 @@ def main():
66
66
  override_quiet=True,
67
67
  )
68
68
  else:
69
- print_log("No matching Work Requirements found")
69
+ print_info("No matching Work Requirements found")
70
70
 
71
71
  if len(selected_work_requirement_summaries) == 1:
72
72
  abort_tasks_selectively(selected_work_requirement_summaries[0])
@@ -78,7 +78,7 @@ def abort_tasks_selectively(
78
78
  """
79
79
  Abort selected Tasks in a Work Requirements
80
80
  """
81
- print_log(f"Aborting Tasks in Work Requirement '{wr_summary.name}'")
81
+ print_info(f"Aborting Tasks in Work Requirement '{wr_summary.name}'")
82
82
 
83
83
  task_search = TaskSearch(
84
84
  workRequirementId=wr_summary.id,
@@ -91,7 +91,7 @@ def abort_tasks_selectively(
91
91
  CLIENT, sorted_objects(tasks), parent=wr_summary, override_quiet=True
92
92
  )
93
93
  else:
94
- print_log(
94
+ print_info(
95
95
  "No currently executing Tasks in this Work Requirement",
96
96
  override_quiet=True,
97
97
  )
@@ -101,7 +101,7 @@ def abort_tasks_selectively(
101
101
  for task in tasks:
102
102
  try:
103
103
  CLIENT.work_client.cancel_task(task, abort=True)
104
- print_log(
104
+ print_info(
105
105
  f"Aborted Task '{task.name}' in Task Group"
106
106
  f" '{get_task_group_name(CLIENT, wr_summary, task)}' in Work"
107
107
  f" Requirement '{wr_summary.name}'"
@@ -111,9 +111,9 @@ def abort_tasks_selectively(
111
111
  print_error(f"Unable to abort Task '{task.name}': {e}")
112
112
 
113
113
  if aborted_tasks == 0:
114
- print_log("No Tasks Aborted")
114
+ print_info("No Tasks Aborted")
115
115
  elif aborted_tasks > 1:
116
- print_log(f"Aborted {aborted_tasks} Tasks")
116
+ print_info(f"Aborted {aborted_tasks} Tasks")
117
117
 
118
118
 
119
119
  def _abort_tasks_by_name_or_id(task_id_list: List[str]):
@@ -131,15 +131,15 @@ def _abort_tasks_by_name_or_id(task_id_list: List[str]):
131
131
 
132
132
  try:
133
133
  CLIENT.work_client.cancel_task_by_id(task_id, abort=True)
134
- print_log(f"Cancelled and aborted Task '{task_id}'")
134
+ print_info(f"Cancelled and aborted Task '{task_id}'")
135
135
  aborted_count += 1
136
136
  except Exception as e:
137
137
  print_error(f"Unable to cancel and abort Task '{task_id}': {e}")
138
138
 
139
139
  if aborted_count > 1:
140
- print_log(f"Cancelled and aborted {aborted_count} Tasks")
140
+ print_info(f"Cancelled and aborted {aborted_count} Tasks")
141
141
  elif aborted_count == 0:
142
- print_log("No Tasks cancelled and aborted")
142
+ print_info("No Tasks cancelled and aborted")
143
143
 
144
144
 
145
145
  # Entry point
yellowdog_cli/admin.py CHANGED
@@ -6,7 +6,7 @@ Skeleton CLI for admin commands (YellowDog only)
6
6
 
7
7
  import requests
8
8
 
9
- from yellowdog_cli.utils.printing import print_error, print_log
9
+ from yellowdog_cli.utils.printing import print_error, print_info
10
10
  from yellowdog_cli.utils.wrapper import ARGS_PARSER, CONFIG_COMMON, main_wrapper
11
11
 
12
12
 
@@ -24,7 +24,7 @@ def main():
24
24
  },
25
25
  )
26
26
  if response.status_code == 200:
27
- print_log(f"Refreshed Work Requirement '{wr_id}'")
27
+ print_info(f"Refreshed Work Requirement '{wr_id}'")
28
28
  else:
29
29
  print_error(f"Failed to refresh Work Requirement '{wr_id}'")
30
30
  raise Exception(f"{response.text}")
@@ -0,0 +1,104 @@
1
+ #!/usr/bin/env python3
2
+
3
+ """
4
+ A script for reporting on the details of the Application being used.
5
+ """
6
+
7
+ from yellowdog_client.model import ApplicationDetails
8
+
9
+ from yellowdog_cli.utils.entity_utils import (
10
+ get_all_roles_and_namespaces_for_application,
11
+ get_application_details,
12
+ get_application_group_summaries,
13
+ )
14
+ from yellowdog_cli.utils.printing import print_simple
15
+ from yellowdog_cli.utils.wrapper import CLIENT, CONFIG_COMMON, main_wrapper
16
+
17
+
18
+ @main_wrapper
19
+ def main():
20
+
21
+ application_details: ApplicationDetails = get_application_details(CLIENT)
22
+
23
+ print()
24
+ print_simple(
25
+ f" Application name: {application_details.name}",
26
+ override_quiet=True,
27
+ )
28
+ print_simple(
29
+ f" Application ID: {application_details.id}",
30
+ override_quiet=True,
31
+ )
32
+ print_simple(
33
+ f" Account name: {application_details.accountName}",
34
+ override_quiet=True,
35
+ )
36
+ if "api" in CONFIG_COMMON.url:
37
+ print_simple(
38
+ " Portal URL: "
39
+ f"{CONFIG_COMMON.url.replace('api', 'portal')}"
40
+ f"/#/signin?account={application_details.accountName}",
41
+ override_quiet=True,
42
+ )
43
+ print_simple(
44
+ f" Account ID: {application_details.accountId}",
45
+ override_quiet=True,
46
+ )
47
+ features = (
48
+ ""
49
+ if application_details.features is None
50
+ else ", ".join([str(feature) for feature in application_details.features])
51
+ )
52
+ print_simple(
53
+ f" Account features: {features}",
54
+ override_quiet=True,
55
+ )
56
+ all_ns_readable = "Yes" if application_details.allNamespacesReadable else "No"
57
+ print_simple(
58
+ f" All namespaces readable: {all_ns_readable}",
59
+ override_quiet=True,
60
+ )
61
+ if not application_details.allNamespacesReadable:
62
+ readable_namespaces = (
63
+ ""
64
+ if application_details.readableNamespaces is None
65
+ else ", ".join([rns for rns in application_details.readableNamespaces])
66
+ )
67
+ print_simple(
68
+ f" Readable namespaces: {readable_namespaces}",
69
+ override_quiet=True,
70
+ )
71
+ try:
72
+ groups = get_application_group_summaries(CLIENT, application_details.id)
73
+ group_names = ", ".join([group.name for group in groups])
74
+ print_simple(
75
+ f" In group(s): {group_names}",
76
+ override_quiet=True,
77
+ )
78
+ for i, (role, namespaces) in enumerate(
79
+ get_all_roles_and_namespaces_for_application(
80
+ CLIENT, application_details.id
81
+ ).items()
82
+ ):
83
+ msg = f"{role} [{', '.join(namespaces)}]"
84
+ if i == 0:
85
+ print_simple(
86
+ f" With role(s) [in namespace(s)]: {msg}",
87
+ override_quiet=True,
88
+ )
89
+ else:
90
+ print_simple(
91
+ f" {msg}",
92
+ override_quiet=True,
93
+ )
94
+
95
+ except Exception as e:
96
+ if "Forbidden" in str(e):
97
+ print_simple(
98
+ " Groups and roles: "
99
+ "Cannot be determined due to application permissions",
100
+ override_quiet=True,
101
+ )
102
+ else:
103
+ pass
104
+ print()
yellowdog_cli/boost.py CHANGED
@@ -5,7 +5,7 @@ A script to boost allowances.
5
5
  """
6
6
 
7
7
  from yellowdog_cli.utils.interactive import confirmed
8
- from yellowdog_cli.utils.printing import print_error, print_log, print_warning
8
+ from yellowdog_cli.utils.printing import print_error, print_info, print_warning
9
9
  from yellowdog_cli.utils.wrapper import ARGS_PARSER, CLIENT, main_wrapper
10
10
  from yellowdog_cli.utils.ydid_utils import YDIDType, get_ydid_type
11
11
 
@@ -26,7 +26,7 @@ def main():
26
26
  CLIENT.allowances_client.boost_allowance_by_id(
27
27
  allowance, ARGS_PARSER.boost_hours
28
28
  )
29
- print_log(
29
+ print_info(
30
30
  f"Boosted Allowance {allowance} by {ARGS_PARSER.boost_hours} hours"
31
31
  )
32
32
  count += 1
@@ -34,7 +34,7 @@ def main():
34
34
  print_error(f"Unable to boost Allowance {allowance}: {e}")
35
35
 
36
36
  if count > 1:
37
- print_log(f"Boosted {count} allowances by {ARGS_PARSER.boost_hours} hours")
37
+ print_info(f"Boosted {count} allowances by {ARGS_PARSER.boost_hours} hours")
38
38
 
39
39
 
40
40
  # Standalone entry point
yellowdog_cli/cancel.py CHANGED
@@ -19,7 +19,7 @@ from yellowdog_cli.utils.entity_utils import (
19
19
  from yellowdog_cli.utils.follow_utils import follow_ids
20
20
  from yellowdog_cli.utils.interactive import confirmed, select
21
21
  from yellowdog_cli.utils.misc_utils import link_entity
22
- from yellowdog_cli.utils.printing import print_error, print_log, print_warning
22
+ from yellowdog_cli.utils.printing import print_error, 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
 
@@ -30,7 +30,7 @@ def main():
30
30
  _cancel_work_requirements_by_name_or_id(ARGS_PARSER.work_requirement_names)
31
31
  return
32
32
 
33
- print_log(
33
+ print_info(
34
34
  "Cancelling Work Requirements in namespace "
35
35
  f"'{CONFIG_COMMON.namespace}' with tags "
36
36
  f"including '{CONFIG_COMMON.name_tag}'"
@@ -73,7 +73,7 @@ def main():
73
73
  CLIENT.work_client.get_work_requirement_by_id(work_summary.id)
74
74
  )
75
75
  cancelled_count += 1
76
- print_log(
76
+ print_info(
77
77
  f"Cancelled {link_entity(CONFIG_COMMON.url, work_requirement)} "
78
78
  f"('{work_summary.name}')"
79
79
  f"{'' if not ARGS_PARSER.abort else ' and aborted all allocated tasks'}"
@@ -85,22 +85,22 @@ def main():
85
85
  )
86
86
 
87
87
  elif work_summary.status == WorkRequirementStatus.CANCELLING:
88
- print_log(
88
+ print_info(
89
89
  f"Work Requirement '{work_summary.name}' is already cancelling"
90
90
  )
91
91
  cancelling_count += 1
92
92
  work_requirement_ids.append(work_summary.id)
93
93
 
94
94
  if cancelled_count > 1:
95
- print_log(f"Cancelled {cancelled_count} Work Requirement(s)")
95
+ print_info(f"Cancelled {cancelled_count} Work Requirement(s)")
96
96
  elif cancelled_count == 0 and cancelling_count == 0:
97
- print_log("No Work Requirements to cancel")
97
+ print_info("No Work Requirements to cancel")
98
98
 
99
99
  if ARGS_PARSER.follow:
100
100
  follow_ids(work_requirement_ids)
101
101
 
102
102
  else:
103
- print_log("No Work Requirements to cancel")
103
+ print_info("No Work Requirements to cancel")
104
104
 
105
105
 
106
106
  def _cancel_work_requirements_by_name_or_id(names_or_ids: List[str]):
@@ -148,7 +148,7 @@ def _cancel_work_requirements_by_name_or_id(names_or_ids: List[str]):
148
148
 
149
149
  work_requirement_summaries.append(work_requirement_summary)
150
150
  if work_requirement_summary.status == WorkRequirementStatus.CANCELLING:
151
- print_log(f"Work Requirement '{name_or_id}' is already cancelling")
151
+ print_info(f"Work Requirement '{name_or_id}' is already cancelling")
152
152
  else:
153
153
  if not confirmed(
154
154
  f"Cancel Work Requirement '{name_or_id}'"
@@ -159,7 +159,7 @@ def _cancel_work_requirements_by_name_or_id(names_or_ids: List[str]):
159
159
  CLIENT.work_client.cancel_work_requirement_by_id(
160
160
  work_requirement_summary.id, ARGS_PARSER.abort
161
161
  )
162
- print_log(
162
+ print_info(
163
163
  f"Cancelled Work Requirement '{name_or_id}'"
164
164
  f"{'' if not ARGS_PARSER.abort else ' and aborted all allocated tasks'}"
165
165
  )
@@ -8,7 +8,7 @@ from yellowdog_cli.utils.check_imports import check_cloudwizard_imports
8
8
  from yellowdog_cli.utils.cloudwizard_aws import AWSConfig
9
9
  from yellowdog_cli.utils.cloudwizard_azure import AzureConfig
10
10
  from yellowdog_cli.utils.cloudwizard_gcp import GCPConfig
11
- from yellowdog_cli.utils.printing import print_error, print_log, print_warning
11
+ from yellowdog_cli.utils.printing import print_error, print_info, print_warning
12
12
  from yellowdog_cli.utils.wrapper import ARGS_PARSER, CLIENT, main_wrapper
13
13
 
14
14
 
@@ -21,7 +21,7 @@ def main():
21
21
  check_cloudwizard_imports()
22
22
 
23
23
  if ARGS_PARSER.cloud_provider.lower() in ["aws", "amazon"]:
24
- print_log(f"YellowDog automated cloud provider setup/teardown for 'AWS'")
24
+ print_info(f"YellowDog automated cloud provider setup/teardown for 'AWS'")
25
25
  cloud_provider_config = AWSConfig(
26
26
  client=CLIENT,
27
27
  region_name=ARGS_PARSER.region_name,
@@ -30,7 +30,7 @@ def main():
30
30
  )
31
31
 
32
32
  elif ARGS_PARSER.cloud_provider.lower() in ["gcp", "gce", "google"]:
33
- print_log(f"YellowDog automated cloud provider setup/teardown for 'GCP'")
33
+ print_info(f"YellowDog automated cloud provider setup/teardown for 'GCP'")
34
34
  if ARGS_PARSER.credentials_file is None:
35
35
  print_error(
36
36
  "Credentials file ('--credentials-file') must be supplied for GCP"
@@ -43,7 +43,7 @@ def main():
43
43
  )
44
44
 
45
45
  elif ARGS_PARSER.cloud_provider.lower() in ["azure", "microsoft"]:
46
- print_log(f"YellowDog automated cloud provider setup/teardown for 'Azure'")
46
+ print_info(f"YellowDog automated cloud provider setup/teardown for 'Azure'")
47
47
  cloud_provider_config = AzureConfig(
48
48
  client=CLIENT,
49
49
  instance_type=ARGS_PARSER.instance_type,
yellowdog_cli/compare.py CHANGED
@@ -27,7 +27,7 @@ from yellowdog_client.model import (
27
27
  from yellowdog_cli.utils.entity_utils import get_worker_pool_by_id
28
28
  from yellowdog_cli.utils.printing import (
29
29
  indent,
30
- print_log,
30
+ print_info,
31
31
  print_table_core,
32
32
  print_warning,
33
33
  )
@@ -134,7 +134,7 @@ class MatchReport:
134
134
  match_str = "MAYBE MATCHING"
135
135
  else:
136
136
  match_str = "NON-MATCHING"
137
- print_log(
137
+ print_info(
138
138
  f"Detailed comparison report for {match_str} ({self.worker_pool_status}) Worker Pool "
139
139
  f"'{self.worker_pool_name}' ({self.worker_pool_id})",
140
140
  override_quiet=True,
@@ -634,7 +634,7 @@ def _compare_task_group(task_group: TaskGroup, worker_pools: WorkerPools):
634
634
  """
635
635
  Compare a Task Group.
636
636
  """
637
- print_log(
637
+ print_info(
638
638
  f"Comparing Task Group '{task_group.name}' ({task_group.id})",
639
639
  override_quiet=True,
640
640
  )
@@ -645,7 +645,7 @@ def _compare_task_group(task_group: TaskGroup, worker_pools: WorkerPools):
645
645
 
646
646
  if len(match_reports) > 1:
647
647
  # Summary report
648
- print_log("Summary of Worker Pool matches:", override_quiet=True)
648
+ print_info("Summary of Worker Pool matches:", override_quiet=True)
649
649
  header_row = [
650
650
  "",
651
651
  "Worker Pool Name",
@@ -675,7 +675,7 @@ def _compare_task_group(task_group: TaskGroup, worker_pools: WorkerPools):
675
675
  for match_report in match_reports:
676
676
  match_report.print_detailed_report()
677
677
 
678
- print_log("Task Group comparison complete")
678
+ print_info("Task Group comparison complete")
679
679
 
680
680
 
681
681
  @main_wrapper
@@ -700,7 +700,7 @@ def main():
700
700
  # Work requirement
701
701
  elif get_ydid_type(ARGS_PARSER.wr_or_tg_id) == YDIDType.WORK_REQUIREMENT:
702
702
  work_requirement = _get_work_requirement_by_id(ARGS_PARSER.wr_or_tg_id)
703
- print_log(
703
+ print_info(
704
704
  f"Comparing all Task Groups in Work Requirement '{work_requirement.name}' "
705
705
  f"({work_requirement.id})",
706
706
  override_quiet=True,