Exemplo n.º 1
0
def parse_show_arguments():
    """
    Parse the commandline options for showing running jobs
    :return obj args: parsed arguments
    """
    parser = ArgumentParser(
        prog="jobrunner show",
        description='Show information about running jobs'
    )
    return parse_arguments(parser)
Exemplo n.º 2
0
def parse_youtube_dl_arguments(args=None):
    """
    Parse the commandline options for posting a job that
    downloads videos from YouTube to the local disk of the
    conductor running the flow
    :param list args: Args to pass to the arg parser.
    Will use argv if none specified.
    :return obj args: parsed arguments
    """
    parser = flow_parser(
        prog="jobrunner post youtube_dl",
        description='Post a job that downloads videos from YouTube')
    parser.add_argument('channels_file',
                        help="Path to a file containing a list of channels to "
                        "download the videos of")
    return parse_arguments(parser, args=args)
Exemplo n.º 3
0
def parse_webserver_arguments(args=None):
    """
    Parse the commandline options for posting a job that
    runs a simple HTTP webserver
    :param list args: Args to pass to the arg parser.
    Will use argv if none specified.
    :return obj args: parsed arguments
    """
    parser = flow_parser(
        prog="jobrunner post simple_http_webserver",
        description='Post a job that runs a simple HTTP webserver')
    parser.add_argument(
        '--port',
        '-p',
        type=int,
        default=8080,
        help="The port to use to run the webserver on. Defaults to 8080")
    return parse_arguments(parser, args=args)
Exemplo n.º 4
0
    def test_parse_arguments_returns_arguments(self):
        ret = parse_arguments(self.parser)

        self.assertEqual(ret, self.parser.parse_args.return_value)
Exemplo n.º 5
0
    def test_parse_arguments_sets_up_logging(self):
        parse_arguments(self.parser)

        self.setup_logging.assert_called_once_with(
            debug=self.parser.parse_args.return_value.verbose)
Exemplo n.º 6
0
    def test_parse_arguments_parses_passed_args(self):
        expected_args = ['these', '--are', 'some_args']
        parse_arguments(self.parser, args=expected_args)

        self.parser.parse_args.assert_called_once_with(args=expected_args)
Exemplo n.º 7
0
    def test_parse_arguments_parses_arguments(self):
        parse_arguments(self.parser)

        self.parser.parse_args.assert_called_once_with(args=None)
Exemplo n.º 8
0
    def test_parse_arguments_adds_arguments(self):
        parse_arguments(self.parser)

        expected_calls = [call('--verbose', '-v', action='store_true')]
        self.assertEqual(self.parser.add_argument.mock_calls, expected_calls)