cool-easter-32542
09/22/2023, 11:42 AMSubsystem in #10889 to provide a streaming workunit handler, but the code did not initially register the Subsystem via SubsystemRule. I added the Subsystem as a streaming workunit handler using --streaming-workunits-handlers='+["pants.reporting.metrics.MetricsReporting"]' and got the following error message:
16:27:00.81 [ERROR] No such options scope: pants-metrics
Traceback (most recent call last):
File "/Users/tdyas/TC/pants/src/python/pants/option/parser_hierarchy.py", line 73, in get_parser_by_scope
return self._parser_by_scope[scope]
KeyError: 'pants-metrics'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/tdyas/TC/pants/src/python/pants/bin/daemon_pants_runner.py", line 148, in single_daemonized_run
return runner.run(start_time)
File "/Users/tdyas/TC/pants/src/python/pants/bin/local_pants_runner.py", line 259, in run
callbacks = Subsystem.get_streaming_workunit_callbacks(streaming_handlers)
File "/Users/tdyas/TC/pants/src/python/pants/option/subsystem.py", line 247, in get_streaming_workunit_callbacks
subsystem = subsystem_class.global_instance()
File "/Users/tdyas/TC/pants/src/python/pants/option/subsystem.py", line 157, in global_instance
return cls._instance_for_scope(cls.options_scope) # type: ignore[arg-type] # MyPy is treating cls.options_scope as a Callable, rather than `str`
File "/Users/tdyas/TC/pants/src/python/pants/option/subsystem.py", line 182, in _instance_for_scope
cls._scoped_instances[key] = cls(scope, cls._options.for_scope(scope))
File "/Users/tdyas/TC/pants/src/python/pants/util/memo.py", line 123, in memoize
result = func(*args, **kwargs)
File "/Users/tdyas/TC/pants/src/python/pants/option/options.py", line 425, in for_scope
values = self._parser_hierarchy.get_parser_by_scope(scope).parse_args(parse_args_request)
File "/Users/tdyas/TC/pants/src/python/pants/option/parser_hierarchy.py", line 75, in get_parser_by_scope
raise Config.ConfigValidationError(f"No such options scope: {scope}")
pants.option.config.Config.ConfigValidationError: No such options scope: pants-metrics
A better error message would have highlighted that the Subsystem had not been registered and then how to register it.
pantsbuild/pantscool-easter-32542
09/22/2023, 11:42 AM