Skip to content

Commit

Permalink
New raw_dispatch command
Browse files Browse the repository at this point in the history
  • Loading branch information
pholica committed Mar 15, 2024
1 parent f582320 commit 5cbd95a
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion enge/tesar/basecommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 2 additions & 0 deletions enge/tesar/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion enge/tesar/dispatch/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ def add_arguments(self, parser):
parser.add_argument('message')

def __call__(self):
print(self.arguments.message)
print(self.args.message)
Empty file.
21 changes: 21 additions & 0 deletions enge/tesar/raw_dispatch/command.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 5cbd95a

Please sign in to comment.