nemo-evaluator-launcher 0.1.0rc9__py3-none-any.whl → 0.1.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.

Potentially problematic release.


This version of nemo-evaluator-launcher might be problematic. Click here for more details.

@@ -14,8 +14,11 @@
14
14
  # limitations under the License.
15
15
  #
16
16
  import json
17
+ from collections import defaultdict
17
18
  from dataclasses import dataclass
18
19
 
20
+ from simple_parsing import field
21
+
19
22
  from nemo_evaluator_launcher.api.functional import get_tasks_list
20
23
 
21
24
 
@@ -23,6 +26,12 @@ from nemo_evaluator_launcher.api.functional import get_tasks_list
23
26
  class Cmd:
24
27
  """List command configuration."""
25
28
 
29
+ json: bool = field(
30
+ default=False,
31
+ action="store_true",
32
+ help="Print output as JSON instead of table format",
33
+ )
34
+
26
35
  def execute(self) -> None:
27
36
  # TODO(dfridman): modify `get_tasks_list` to return a list of dicts in the first place
28
37
  data = get_tasks_list()
@@ -31,4 +40,95 @@ class Cmd:
31
40
  for task_data in data:
32
41
  assert len(task_data) == len(headers)
33
42
  supported_benchmarks.append(dict(zip(headers, task_data)))
34
- print(json.dumps(supported_benchmarks, indent=2))
43
+
44
+ if self.json:
45
+ print(json.dumps({"tasks": supported_benchmarks}, indent=2))
46
+ else:
47
+ self._print_table(supported_benchmarks)
48
+
49
+ def _print_table(self, tasks: list[dict]) -> None:
50
+ """Print tasks grouped by harness and container in table format."""
51
+ if not tasks:
52
+ print("No tasks found.")
53
+ return
54
+
55
+ # Group tasks by harness and container
56
+ grouped = defaultdict(lambda: defaultdict(list))
57
+ for task in tasks:
58
+ harness = task["harness"]
59
+ container = task["container"]
60
+ grouped[harness][container].append(task)
61
+
62
+ # Print grouped tables
63
+ for i, (harness, containers) in enumerate(grouped.items()):
64
+ if i > 0:
65
+ print() # Extra spacing between harnesses
66
+
67
+ for j, (container, container_tasks) in enumerate(containers.items()):
68
+ if j > 0:
69
+ print() # Spacing between containers
70
+
71
+ # Prepare task table first to get column widths
72
+ task_headers = ["task", "endpoint_type"]
73
+ rows = []
74
+ for task in container_tasks:
75
+ rows.append([task["task"], task["endpoint_type"]])
76
+
77
+ # Sort tasks alphabetically for better readability
78
+ rows.sort(key=lambda x: x[0])
79
+
80
+ # Calculate column widths with some padding
81
+ widths = [
82
+ max(len(task_headers[i]), max(len(str(row[i])) for row in rows)) + 2
83
+ for i in range(len(task_headers))
84
+ ]
85
+
86
+ # Calculate minimum table width based on task columns
87
+ min_table_width = sum(widths) + len(widths) + 1
88
+
89
+ # Calculate required width for header content
90
+ harness_line = f"harness: {harness}"
91
+ container_line = f"container: {container}"
92
+ header_content_width = (
93
+ max(len(harness_line), len(container_line)) + 4
94
+ ) # +4 for "| " and " |"
95
+
96
+ # Use the larger of the two widths
97
+ table_width = max(min_table_width, header_content_width)
98
+
99
+ # Print combined header with harness and container info
100
+ print("=" * table_width)
101
+ print(f"{harness_line}")
102
+ print(f"{container_line}")
103
+
104
+ # Adjust column widths to fill the full table width
105
+ available_width = table_width
106
+ # Give more space to the first column (task names can be long)
107
+ adjusted_widths = [
108
+ max(
109
+ widths[0], available_width * 2 // 3
110
+ ), # 2/3 of available width for task
111
+ 0, # Will be calculated as remainder
112
+ ]
113
+ adjusted_widths[1] = (
114
+ available_width - adjusted_widths[0]
115
+ ) # Remainder for endpoint_type
116
+
117
+ # Print task table header separator
118
+ print(" " * table_width)
119
+ header_row = f"{task_headers[0]:<{adjusted_widths[0]}}{task_headers[1]:<{adjusted_widths[1]}}"
120
+ print(header_row)
121
+ print("-" * table_width)
122
+
123
+ # Print task rows
124
+ for row in rows:
125
+ data_row = f"{str(row[0]):<{adjusted_widths[0]}}{str(row[1]):<{adjusted_widths[1]}}"
126
+ print(data_row)
127
+
128
+ print("-" * table_width)
129
+ # Show task count
130
+ task_count = len(rows)
131
+ print(f" {task_count} task{'s' if task_count != 1 else ''} available")
132
+ print("=" * table_width)
133
+
134
+ print()
@@ -70,6 +70,9 @@ def create_parser() -> ArgumentParser:
70
70
  ls_parser = subparsers.add_parser(
71
71
  "ls", help="List resources", description="List tasks or runs"
72
72
  )
73
+ # Add arguments from `ls tasks` so that they work with `ls` as default alias
74
+ ls_parser.add_arguments(ls_tasks.Cmd, dest="tasks_alias")
75
+
73
76
  ls_sub = ls_parser.add_subparsers(dest="ls_command", required=False)
74
77
 
75
78
  # ls tasks (default)
@@ -126,12 +129,10 @@ def main() -> None:
126
129
  # Dispatch nested ls subcommands
127
130
  if args.ls_command is None or args.ls_command == "tasks":
128
131
  # Default to tasks when no subcommand specified
129
- if hasattr(args, "tasks"):
130
- args.tasks.execute()
132
+ if hasattr(args, "tasks_alias"):
133
+ args.tasks_alias.execute()
131
134
  else:
132
- # Create default tasks command if not specified
133
- tasks_cmd = ls_tasks.Cmd()
134
- tasks_cmd.execute()
135
+ args.tasks.execute()
135
136
  elif args.ls_command == "runs":
136
137
  args.runs.execute()
137
138
  elif args.command == "export":
@@ -16,8 +16,8 @@
16
16
  # Below is the _next_ version that will be published, not the currently published one.
17
17
  MAJOR = 0
18
18
  MINOR = 1
19
- PATCH = 0
20
- PRE_RELEASE = "rc9"
19
+ PATCH = 1
20
+ PRE_RELEASE = ""
21
21
 
22
22
  # Use the following formatting: (major, minor, patch, pre-release)
23
23
  VERSION = (MAJOR, MINOR, PATCH, PRE_RELEASE)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nemo-evaluator-launcher
3
- Version: 0.1.0rc9
3
+ Version: 0.1.1
4
4
  Summary: Launcher for the evaluations provided by NeMo Evaluator containers with different runtime backends
5
5
  Author: NVIDIA
6
6
  Author-email: nemo-toolkit@nvidia.com
@@ -1,5 +1,5 @@
1
1
  nemo_evaluator_launcher/__init__.py,sha256=2F703fttLaIyMHoVD54rptHMXt4AWnplHDrwWJ3e3PM,1930
2
- nemo_evaluator_launcher/package_info.py,sha256=KLjWJDLBpMYstxsDlVH-531ITGnE0n3a8uUZjECEtgE,1583
2
+ nemo_evaluator_launcher/package_info.py,sha256=ge5Px1iAlNRX0GGWoCf58FwsJrEYBkZc1DqeCTYgur4,1580
3
3
  nemo_evaluator_launcher/api/__init__.py,sha256=U9q_MJK2vRsFaymanhyy0nD1SNAZQZC8oY45RXPX7ac,1024
4
4
  nemo_evaluator_launcher/api/functional.py,sha256=DbsM2nwSdUZFtP5Se4aACg4K8EHF0b2xsXX_VgItP8w,26711
5
5
  nemo_evaluator_launcher/api/types.py,sha256=RXr_QoKdhejj1T9-HybSjd4KTxJmSv0bE0uLUFtF7Zc,3269
@@ -9,8 +9,8 @@ nemo_evaluator_launcher/cli/export.py,sha256=lROUm4mTM67an0M9OrgoJB3txhebgyi6c9Y
9
9
  nemo_evaluator_launcher/cli/info.py,sha256=HUWQiVTyxVWDDkvcT-leosus3aa8Nq0Xl77xSTLqPss,3958
10
10
  nemo_evaluator_launcher/cli/kill.py,sha256=AzqD5WachyI1mVIa1D1PgtR0yRo2VQcKSxATOE8OrPQ,1253
11
11
  nemo_evaluator_launcher/cli/ls_runs.py,sha256=Ttgj7QR1iUmWwB_QGZwcnu1Z9wMJ2BenZMjFhqD9jwM,3788
12
- nemo_evaluator_launcher/cli/ls_tasks.py,sha256=acP3BXGMZhM3k6t-Xnp2-E-o2YE7Zzy1cm_feMe2tQQ,1319
13
- nemo_evaluator_launcher/cli/main.py,sha256=lUOWPZ6c7zVvbcl8QMTLlcp9FGxSN9ko5MZR0_g40lU,4926
12
+ nemo_evaluator_launcher/cli/ls_tasks.py,sha256=TMj78z4ree6uVuwTI2jEDMRuUc-A0tRq2RB-wfHBwds,5223
13
+ nemo_evaluator_launcher/cli/main.py,sha256=JgzHsfalEg1aK_v0h2EuzTIG14JgxLzfixmguW4Zkfg,4976
14
14
  nemo_evaluator_launcher/cli/run.py,sha256=X5UIdLy7mIpU-lQm6qBHqPX4IesIUriXg6uNYMz5HI8,5270
15
15
  nemo_evaluator_launcher/cli/status.py,sha256=AY8AKIKcBqKgkeRItnzB5Jh5jQS4GvtsVnieL4zASlQ,4138
16
16
  nemo_evaluator_launcher/cli/version.py,sha256=puMwIvkmfD3HESjftdTSP6T3Nc8J4cbz8uXWHJcTemY,2030
@@ -49,9 +49,9 @@ nemo_evaluator_launcher/exporters/registry.py,sha256=XsPTv_SBAFjcErO6BJ3OHqs3EvX
49
49
  nemo_evaluator_launcher/exporters/utils.py,sha256=uXH4b-Hk7_FQyLOjMRB0b3zK-Ksb2rGlSdc-oECfGHI,24756
50
50
  nemo_evaluator_launcher/exporters/wandb.py,sha256=xdaPNw0QM0jZo20UERbViy_vFT-HgbLYzTgmWaev_kk,13430
51
51
  nemo_evaluator_launcher/resources/mapping.toml,sha256=uOg4Y-gDXXskbbba2vuwJ5FLJ3W0kSZz7Fap_nJnFQc,11322
52
- nemo_evaluator_launcher-0.1.0rc9.dist-info/licenses/LICENSE,sha256=DyGb0fqHPZAsd_uXHA0DGcOCqsvrNsImuLC0Ts4s1zI,23413
53
- nemo_evaluator_launcher-0.1.0rc9.dist-info/METADATA,sha256=yS2uFRw3gyj_Gv6_vizKfEexFBPCNPVQyBLessX2f6k,28717
54
- nemo_evaluator_launcher-0.1.0rc9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
55
- nemo_evaluator_launcher-0.1.0rc9.dist-info/entry_points.txt,sha256=64z1T5GKSB9PW1fCENQuor6X6eqH1rcfg0NQGfKrEy8,130
56
- nemo_evaluator_launcher-0.1.0rc9.dist-info/top_level.txt,sha256=5PvawNm9TXKqPRjZita1xPOtFiMOipcoRf50FI1iY3s,24
57
- nemo_evaluator_launcher-0.1.0rc9.dist-info/RECORD,,
52
+ nemo_evaluator_launcher-0.1.1.dist-info/licenses/LICENSE,sha256=DyGb0fqHPZAsd_uXHA0DGcOCqsvrNsImuLC0Ts4s1zI,23413
53
+ nemo_evaluator_launcher-0.1.1.dist-info/METADATA,sha256=O_KXwNWNpchWPgyNyZavb_kKYC7gPK8-b1b3axlztf8,28714
54
+ nemo_evaluator_launcher-0.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
55
+ nemo_evaluator_launcher-0.1.1.dist-info/entry_points.txt,sha256=64z1T5GKSB9PW1fCENQuor6X6eqH1rcfg0NQGfKrEy8,130
56
+ nemo_evaluator_launcher-0.1.1.dist-info/top_level.txt,sha256=5PvawNm9TXKqPRjZita1xPOtFiMOipcoRf50FI1iY3s,24
57
+ nemo_evaluator_launcher-0.1.1.dist-info/RECORD,,