Ejemplo n.º 1
0
def init_argument_parser(parser, defaults):
    """Initialize argument parser with prometheus parameters."""
    add_parser_argument(parser,
                        'prometheus_gateway_netloc',
                        defaults,
                        'localhost:9091',
                        help='Location of the prometheus gateway to push to.')
Ejemplo n.º 2
0
def init_argument_parser(parser, defaults):
  """Initialize argument parser with stackdriver parameters."""
  add_parser_argument(
      parser, 'stackdriver_project', defaults, None,
      help='stackdriver project to manage metrics in')
  add_parser_argument(
      parser, 'stackdriver_credentials', defaults, None,
      help='stackdriver project to manage metrics in')
Ejemplo n.º 3
0
    def add_bom_parser_args(parser, defaults):
        """Adds arguments shared with creating boms."""
        if hasattr(parser, 'added_gce_image_project'):
            return
        parser.added_gce_image_project = True

        add_parser_argument(parser,
                            'publish_gce_image_project',
                            defaults,
                            None,
                            help='Project to publish images to.')
Ejemplo n.º 4
0
 def init_argument_parser(parser, defaults):
   """Init argparser with metrics-related options."""
   in_memory_metrics.init_argument_parser(parser, defaults)
   prometheus_metrics.init_argument_parser(parser, defaults)
   stackdriver_metrics.init_argument_parser(parser, defaults)
   add_parser_argument(
       parser, 'metric_name_scope', defaults, 'buildtool',
       help='scope prefix for metrics generated by this tool')
   add_parser_argument(
       parser, 'monitoring_enabled', defaults, False, type=bool,
       help='Enable monitoring to stackdriver.')
   add_parser_argument(
       parser, 'monitoring_flush_frequency', defaults, 5,
       help='Frequency at which to push metrics in seconds.')
   add_parser_argument(
       parser, 'monitoring_system', defaults, 'file',
       choices=['file', 'prometheus', 'stackdriver'],
       help='Where to store metrics.')
Ejemplo n.º 5
0
 def add_argument(parser, name, defaults, default_value, **kwargs):
     """See buildtool.util.add_argument."""
     add_parser_argument(parser, name, defaults, default_value, **kwargs)
Ejemplo n.º 6
0
def init_standard_parser(parser, defaults):
    """Init argparser with command-independent options.

  Args:
    parser: [argparse.Parser]
    defaults: [dict]  Default value overrides keyed by option name.
  """
    parser.add_argument(
        'components',
        nargs='*',
        default=defaults.get('components', None),
        help='Restrict commands to these components or repository names')

    add_parser_argument(
        parser,
        'default_args_file',
        defaults,
        None,
        help='path to YAML file containing default command-line options')

    add_parser_argument(parser,
                        'log_level',
                        defaults,
                        'info',
                        choices=STANDARD_LOG_LEVELS.keys(),
                        help='Set the logging level')
    add_parser_argument(
        parser,
        'root_path',
        defaults,
        'build_source',
        help='Path to directory to put source code to build in.')
    add_parser_argument(parser,
                        'scratch_dir',
                        defaults,
                        'scratch',
                        help='Directory to write working files.')
    add_parser_argument(parser,
                        'logs_dir',
                        defaults,
                        None,
                        help='Override director to write logfiles.'
                        ' The default is <scratch_dir>/log.')
    add_parser_argument(parser,
                        'build_number',
                        defaults,
                        '{:%Y%m%d%H%M%S}'.format(datetime.datetime.utcnow()),
                        help='Build number is used when generating artifacts.')
    add_parser_argument(
        parser,
        'one_at_a_time',
        defaults,
        False,
        action='store_true',
        help='Do not perform applicable concurrency, for debugging.')