From 5cbd95a5b1028a5814437415cb7eeecf1877efb3 Mon Sep 17 00:00:00 2001 From: Pavel Holica Date: Fri, 15 Mar 2024 08:37:49 +0100 Subject: [PATCH] New raw_dispatch command --- enge/tesar/basecommand.py | 2 +- enge/tesar/cli.py | 2 ++ enge/tesar/dispatch/command.py | 2 +- enge/tesar/raw_dispatch/__init__.py | 0 enge/tesar/raw_dispatch/command.py | 21 +++++++++++++++++++++ 5 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 enge/tesar/raw_dispatch/__init__.py create mode 100644 enge/tesar/raw_dispatch/command.py diff --git a/enge/tesar/basecommand.py b/enge/tesar/basecommand.py index 4a39321..14439ee 100644 --- a/enge/tesar/basecommand.py +++ b/enge/tesar/basecommand.py @@ -18,7 +18,7 @@ def add_arguments(self, parser): def __init__(self, arguments): LOGGER.debug(f'Command "{self.command_name}" is being run with arguments: {arguments}') - self.arguments = arguments + self.args = arguments @abc.abstractmethod def __call__(self): diff --git a/enge/tesar/cli.py b/enge/tesar/cli.py index a25db55..9624aef 100644 --- a/enge/tesar/cli.py +++ b/enge/tesar/cli.py @@ -2,11 +2,13 @@ import logging from .dispatch.command import DispatchCommand +from .raw_dispatch.command import RawDispatchCommand def main_parser(): parser = argparse.ArgumentParser() subparsers = parser.add_subparsers(required=True) DispatchCommand.add_command(subparsers) + RawDispatchCommand.add_command(subparsers) verbosity = parser.add_mutually_exclusive_group() verbosity.add_argument( '-d', '--debug', diff --git a/enge/tesar/dispatch/command.py b/enge/tesar/dispatch/command.py index 6956288..070c805 100644 --- a/enge/tesar/dispatch/command.py +++ b/enge/tesar/dispatch/command.py @@ -8,4 +8,4 @@ def add_arguments(self, parser): parser.add_argument('message') def __call__(self): - print(self.arguments.message) + print(self.args.message) diff --git a/enge/tesar/raw_dispatch/__init__.py b/enge/tesar/raw_dispatch/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/enge/tesar/raw_dispatch/command.py b/enge/tesar/raw_dispatch/command.py new file mode 100644 index 0000000..6f5ccdf --- /dev/null +++ b/enge/tesar/raw_dispatch/command.py @@ -0,0 +1,21 @@ +from ..basecommand import BaseCommand +from ..tfrequest import TFRequest + +class RawDispatchCommand(BaseCommand): + command_name = 'raw_dispatch' + + @classmethod + def add_arguments(self, parser): + parser.add_argument('--git_url', default=None) + parser.add_argument('--git_branch', default=None) # use commit id as default + parser.add_argument('--git_path', default=None) + parser.add_argument('--plan_name', default=None) + parser.add_argument('--plan_filter', default=None) + parser.add_argument('--test_filter', default=None) + + def __call__(self): + tf_kwargs = {} + for arg in ('git_url', 'git_branch', 'git_path', 'plan_name', 'plan_filter', 'test_filter'): + tf_kwargs[arg] = getattr(self.args, arg) + request = TFRequest(**tf_kwargs) + print(self.args)