yellowdog-python-examples 7.11.3__tar.gz → 7.11.4__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 (77) hide show
  1. {yellowdog_python_examples-7.11.3/yellowdog_python_examples.egg-info → yellowdog_python_examples-7.11.4}/PKG-INFO +1 -1
  2. yellowdog_python_examples-7.11.4/yd_commands/__init__.py +1 -0
  3. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/list.py +45 -16
  4. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/load_resources.py +1 -1
  5. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/printing.py +9 -23
  6. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4/yellowdog_python_examples.egg-info}/PKG-INFO +1 -1
  7. yellowdog_python_examples-7.11.3/yd_commands/__init__.py +0 -1
  8. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/LICENSE +0 -0
  9. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/PYPI_README.md +0 -0
  10. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/README.md +0 -0
  11. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/pyproject.toml +0 -0
  12. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/requirements.txt +0 -0
  13. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/setup.cfg +0 -0
  14. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/setup.py +0 -0
  15. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/tests/test_create_remove.py +0 -0
  16. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/tests/test_demos.py +0 -0
  17. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/tests/test_dryruns.py +0 -0
  18. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/tests/test_entrypoints.py +0 -0
  19. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/tests/test_gui.py +0 -0
  20. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/tests/test_list.py +0 -0
  21. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/tests/test_objects.py +0 -0
  22. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/tests/test_variable_processing.py +0 -0
  23. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/abort.py +0 -0
  24. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/admin.py +0 -0
  25. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/args.py +0 -0
  26. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/boost.py +0 -0
  27. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/cancel.py +0 -0
  28. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/check_imports.py +0 -0
  29. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/cloudwizard.py +0 -0
  30. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/cloudwizard_aws.py +0 -0
  31. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/cloudwizard_aws_types.py +0 -0
  32. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/cloudwizard_azure.py +0 -0
  33. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/cloudwizard_common.py +0 -0
  34. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/cloudwizard_gcp.py +0 -0
  35. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/compact_json.py +0 -0
  36. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/config_types.py +0 -0
  37. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/create.py +0 -0
  38. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/csv_data.py +0 -0
  39. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/delete.py +0 -0
  40. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/download.py +0 -0
  41. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/follow.py +0 -0
  42. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/follow_utils.py +0 -0
  43. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/format_json.py +0 -0
  44. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/hold.py +0 -0
  45. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/id_utils.py +0 -0
  46. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/instantiate.py +0 -0
  47. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/interactive.py +0 -0
  48. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/items.py +0 -0
  49. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/jsonnet2json.py +0 -0
  50. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/load_config.py +0 -0
  51. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/object_utilities.py +0 -0
  52. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/property_names.py +0 -0
  53. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/provision.py +0 -0
  54. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/provision_utils.py +0 -0
  55. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/remove.py +0 -0
  56. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/resize.py +0 -0
  57. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/settings.py +0 -0
  58. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/show.py +0 -0
  59. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/shutdown.py +0 -0
  60. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/start.py +0 -0
  61. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/start_hold_common.py +0 -0
  62. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/submit.py +0 -0
  63. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/submit_utils.py +0 -0
  64. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/terminate.py +0 -0
  65. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/type_check.py +0 -0
  66. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/upload.py +0 -0
  67. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/upload_utils.py +0 -0
  68. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/utils.py +0 -0
  69. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/validate_properties.py +0 -0
  70. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/variables.py +0 -0
  71. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/version.py +0 -0
  72. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yd_commands/wrapper.py +0 -0
  73. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yellowdog_python_examples.egg-info/SOURCES.txt +0 -0
  74. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yellowdog_python_examples.egg-info/dependency_links.txt +0 -0
  75. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yellowdog_python_examples.egg-info/entry_points.txt +0 -0
  76. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/yellowdog_python_examples.egg-info/requires.txt +0 -0
  77. {yellowdog_python_examples-7.11.3 → yellowdog_python_examples-7.11.4}/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.11.3
3
+ Version: 7.11.4
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
@@ -0,0 +1 @@
1
+ __version__ = "7.11.4"
@@ -32,6 +32,7 @@ from yellowdog_client.model import (
32
32
  NamespaceStorageConfiguration,
33
33
  Node,
34
34
  NodeSearch,
35
+ NodeStatus,
35
36
  ObjectDetail,
36
37
  Task,
37
38
  TaskGroup,
@@ -39,6 +40,7 @@ from yellowdog_client.model import (
39
40
  WorkerPool,
40
41
  WorkerPoolStatus,
41
42
  WorkerPoolSummary,
43
+ WorkerStatus,
42
44
  WorkRequirementStatus,
43
45
  WorkRequirementSummary,
44
46
  )
@@ -67,7 +69,7 @@ from yd_commands.wrapper import ARGS_PARSER, CLIENT, CONFIG_COMMON, main_wrapper
67
69
  @main_wrapper
68
70
  def main():
69
71
  if not check_for_valid_option():
70
- raise Exception("Please choose a single, valid listing type")
72
+ raise Exception("Please choose a (single) listing type")
71
73
 
72
74
  # Always use interactive mode for selections
73
75
  ARGS_PARSER.interactive = True
@@ -265,16 +267,15 @@ def list_worker_pools():
265
267
 
266
268
  if ARGS_PARSER.nodes or ARGS_PARSER.workers:
267
269
  print_log(
268
- "Please select the Worker Pool for which to list "
269
- f"{'Nodes' if ARGS_PARSER.nodes else 'all Workers'}"
270
+ "Please select the Worker Pool(s) for which to list "
271
+ f"{'Nodes' if ARGS_PARSER.nodes else 'Workers'}"
270
272
  )
271
- worker_pool_summary = select(
273
+ worker_pool_summaries = select(
272
274
  CLIENT,
273
275
  sorted_objects(worker_pool_summaries),
274
276
  showing_all=showing_all,
275
- single_result=True,
276
277
  )
277
- list_nodes(worker_pool_summary[0])
278
+ list_nodes(worker_pool_summaries)
278
279
  return
279
280
 
280
281
  if ARGS_PARSER.details:
@@ -376,23 +377,36 @@ def list_instances(compute_requirement: ComputeRequirement):
376
377
  print_numbered_object_list(CLIENT, instances)
377
378
 
378
379
 
379
- def list_nodes(worker_pool_summary: WorkerPoolSummary):
380
+ def list_nodes(worker_pool_summaries: List[WorkerPoolSummary]):
380
381
  """
381
- List the nodes in a Worker Pool.
382
+ List the Nodes in a list of Worker Pools.
382
383
  """
383
- nodes_search = NodeSearch(worker_pool_summary.id)
384
- search_client = CLIENT.worker_pool_client.get_nodes(search=nodes_search)
385
- nodes: List[Node] = search_client.list_all()
384
+ nodes_all: List[Node] = []
385
+ for worker_pool_summary in worker_pool_summaries:
386
+ nodes_search = NodeSearch(
387
+ worker_pool_summary.id,
388
+ statuses=[NodeStatus.RUNNING] if ARGS_PARSER.active_only else None,
389
+ )
390
+ search_client = CLIENT.worker_pool_client.get_nodes(search=nodes_search)
391
+ nodes: List[Node] = search_client.list_all()
392
+ for node in nodes:
393
+ node.worker_pool_name = worker_pool_summary.name
394
+ nodes_all += nodes
395
+
396
+ if len(nodes_all) == 0:
397
+ print_log("No Nodes to display")
398
+ return
386
399
 
387
400
  if ARGS_PARSER.workers:
388
- list_workers(nodes)
401
+ list_workers(nodes_all)
389
402
  return
390
403
 
391
404
  if ARGS_PARSER.details:
392
- for node in select(CLIENT, nodes):
405
+ for node in select(CLIENT, nodes_all):
406
+ delattr(node, "worker_pool_name")
393
407
  print_yd_object(node)
394
408
  else:
395
- print_numbered_object_list(CLIENT, nodes)
409
+ print_numbered_object_list(CLIENT, nodes_all)
396
410
 
397
411
 
398
412
  def list_workers(nodes: List[Node]):
@@ -402,16 +416,31 @@ def list_workers(nodes: List[Node]):
402
416
  workers_all: List[Worker] = []
403
417
  for node in nodes:
404
418
  for worker in node.workers:
419
+ if ARGS_PARSER.active_only:
420
+ if worker.status not in [
421
+ WorkerStatus.SLEEPING,
422
+ WorkerStatus.DOING_TASK,
423
+ WorkerStatus.FOUND,
424
+ ]:
425
+ continue
405
426
  # Add extra info to the Worker object
406
- worker.workerTag = node.details.workerTag
407
- worker.taskTypes = node.details.supportedTaskTypes
427
+ worker.worker_tag = node.details.workerTag
428
+ worker.task_types = node.details.supportedTaskTypes
429
+ worker.worker_pool_name = node.worker_pool_name
408
430
  workers_all.append(worker)
409
431
 
432
+ if len(workers_all) == 0:
433
+ print_log("No Workers to display")
434
+ return
435
+
410
436
  if not ARGS_PARSER.details:
411
437
  print_numbered_object_list(CLIENT, workers_all)
412
438
  return
413
439
 
414
440
  for worker in select(CLIENT, workers_all):
441
+ delattr(worker, "worker_tag")
442
+ delattr(worker, "task_types")
443
+ delattr(worker, "worker_pool_name")
415
444
  print_yd_object(worker)
416
445
 
417
446
 
@@ -2,7 +2,7 @@
2
2
  Load data for resource creation/update/removal requests.
3
3
  """
4
4
 
5
- from sys import argv, exit
5
+ from sys import exit
6
6
  from typing import Dict, List
7
7
 
8
8
  from yd_commands.args import ARGS_PARSER
@@ -34,8 +34,6 @@ from yellowdog_client.model import (
34
34
  MachineImageFamilySummary,
35
35
  NamespacePolicy,
36
36
  Node,
37
- NodeStatus,
38
- NodeSummary,
39
37
  ObjectDetail,
40
38
  ObjectPath,
41
39
  ProvisionedWorkerPool,
@@ -43,7 +41,6 @@ from yellowdog_client.model import (
43
41
  Task,
44
42
  TaskGroup,
45
43
  Worker,
46
- WorkerPool,
47
44
  WorkerPoolSummary,
48
45
  WorkRequirement,
49
46
  WorkRequirementSummary,
@@ -351,32 +348,16 @@ def worker_pool_table(
351
348
  "Worker Pool Name",
352
349
  "Type",
353
350
  "Status",
354
- "Min/Run/Max",
355
351
  "ID",
356
352
  ]
357
353
  table = []
358
354
  for index, worker_pool_summary in enumerate(worker_pool_summaries):
359
- worker_pool: WorkerPool = client.worker_pool_client.get_worker_pool_by_id(
360
- worker_pool_summary.id
361
- )
362
- try:
363
- min_nodes = str(worker_pool.properties.minNodes)
364
- except:
365
- min_nodes = "_"
366
- try:
367
- max_nodes = str(worker_pool.properties.maxNodes)
368
- except:
369
- max_nodes = "_"
370
- node_summary: NodeSummary = worker_pool.nodeSummary
371
- nodes_running = node_summary.statusCounts[NodeStatus.RUNNING]
372
-
373
355
  table.append(
374
356
  [
375
357
  index + 1,
376
358
  worker_pool_summary.name,
377
359
  f"{worker_pool_summary.type.split('.')[-1:][0].replace('WorkerPool', '')}",
378
360
  f"{worker_pool_summary.status}",
379
- f"{min_nodes}/{nodes_running}/{max_nodes}",
380
361
  worker_pool_summary.id,
381
362
  ]
382
363
  )
@@ -544,6 +525,7 @@ def nodes_table(
544
525
  ) -> (List[str], List[str]):
545
526
  headers = [
546
527
  "#",
528
+ "Worker Pool Name",
547
529
  "Provider",
548
530
  "RAM",
549
531
  "vCPUs",
@@ -560,6 +542,7 @@ def nodes_table(
560
542
  table.append(
561
543
  [
562
544
  index + 1,
545
+ node.worker_pool_name,
563
546
  node.details.provider,
564
547
  node.details.ram,
565
548
  node.details.vcpus,
@@ -578,6 +561,7 @@ def workers_table(
578
561
  ) -> (List[str], List[str]):
579
562
  headers = [
580
563
  "#",
564
+ "Worker Pool Name",
581
565
  "Task Types",
582
566
  "Worker Tag",
583
567
  "Status",
@@ -590,8 +574,9 @@ def workers_table(
590
574
  table.append(
591
575
  [
592
576
  index + 1,
593
- ", ".join(worker.taskTypes),
594
- worker.workerTag,
577
+ worker.worker_pool_name,
578
+ ", ".join(worker.task_types),
579
+ worker.worker_tag,
595
580
  worker.status,
596
581
  worker.claimCount,
597
582
  worker.exclusive,
@@ -816,10 +801,11 @@ def sorted_objects(
816
801
  return sorted(objects, key=lambda x: x.instanceType, reverse=reverse)
817
802
 
818
803
  if isinstance(objects[0], Node):
819
- return sorted(objects, key=lambda x: str(x.status), reverse=reverse)
804
+ # Note: worker_pool property is added dynamically in yd_list
805
+ return sorted(objects, key=lambda x: str(x.worker_pool_name), reverse=reverse)
820
806
 
821
807
  if isinstance(objects[0], Worker):
822
- return sorted(objects, key=lambda x: str(x.id), reverse=reverse)
808
+ return sorted(objects, key=lambda x: str(x.worker_pool_name), reverse=reverse)
823
809
 
824
810
  if isinstance(objects[0], AWSAvailabilityZone):
825
811
  return sorted(objects)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: yellowdog-python-examples
3
- Version: 7.11.3
3
+ Version: 7.11.4
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.11.3"