Files
mongo/buildscripts/resmokelib/plugin.py
Tianyu Wang 78ea5eafd4 SERVER-81354: Only set tracer provider once in resmoke (#28125)
GitOrigin-RevId: 6b0522714e750c58546e5d977a9425f81c42ce71
2024-10-22 15:02:45 +00:00

36 lines
985 B
Python

"""Interface for creating a resmoke plugin."""
import abc
class Subcommand(object):
"""A resmoke subcommand to execute."""
def execute(self):
"""Execute the subcommand."""
raise NotImplementedError("execute must be implemented by Subcommand subclasses")
class PluginInterface(abc.ABC):
"""Subcommand/plugin interface."""
def add_subcommand(self, subparsers):
"""
Add parser options for this plugin.
:param subparsers: argparse subparsers
"""
raise NotImplementedError()
def parse(self, subcommand, parser, parsed_args, should_configure_otel=True, **kwargs):
"""
Resolve command-line options to a Subcommand or None.
:param subcommand: equivalent to parsed_args.command
:param parser: parser used
:param parsed_args: output of parsing
:param kwargs: additional args
:return: None or a Subcommand
"""
raise NotImplementedError()