Beispiel #1
0
    def __init__(self, run_tracker, settings):
        super().__init__(run_tracker, settings)

        # We eagerly validate that our output accepts raw bytes.
        settings.outfile.write(b'')

        for key, value in settings.label_format.items():
            if key not in WorkUnitLabel.keys():
                self.emit(
                    '*** Got invalid key {} for --reporting-console-label-format. Expected one of {}\n'
                    .format(key, WorkUnitLabel.keys()))
            if value not in LabelFormat.keys():
                self.emit(
                    '*** Got invalid value {} for --reporting-console-label-format. Expected one of {}\n'
                    .format(value, LabelFormat.keys()))
        for key, value in settings.tool_output_format.items():
            if key not in WorkUnitLabel.keys():
                self.emit(
                    '*** Got invalid key {} for --reporting-console-tool-output-format. Expected one of {}\n'
                    .format(key, WorkUnitLabel.keys()))
            if value not in ToolOutputFormat.keys():
                self.emit(
                    '*** Got invalid value {} for --reporting-console-tool-output-format. Expected one of {}\n'
                    .format(value, ToolOutputFormat.keys()))

        # Mix in the new settings with the defaults.
        self.LABEL_FORMATTING.update(settings.label_format.items())
        self.TOOL_OUTPUT_FORMATTING.update(settings.tool_output_format.items())
Beispiel #2
0
 def register_options(cls, register):
   super(Reporting, cls).register_options(register)
   register('--invalidation-report', type=bool,
            help='Write a formatted report on the invalid objects to the specified path.')
   register('--reports-dir', advanced=True, metavar='<dir>',
            default=os.path.join(register.bootstrap.pants_workdir, 'reports'),
            help='Write reports to this dir.')
   register('--template-dir', advanced=True, metavar='<dir>', default=None,
            help='Find templates for rendering in this dir.')
   register('--console-label-format', advanced=True, type=dict,
            default=PlainTextReporter.LABEL_FORMATTING,
            help='Controls the printing of workunit labels to the console.  Workunit types are '
                 '{workunits}.  Possible formatting values are {formats}'.format(
              workunits=list(WorkUnitLabel.keys()), formats=list(LabelFormat.keys())))
   register('--console-tool-output-format', advanced=True, type=dict,
            default=PlainTextReporter.TOOL_OUTPUT_FORMATTING,
            help='Controls the printing of workunit tool output to the console. Workunit types are '
                 '{workunits}.  Possible formatting values are {formats}'.format(
              workunits=list(WorkUnitLabel.keys()), formats=list(ToolOutputFormat.keys())))
   register('--zipkin-endpoint', advanced=True, default=None,
             help='The full HTTP URL of a zipkin server to which traces should be posted. '
                  'No traces will be made if this is not set.')
   register('--zipkin-trace-id', advanced=True, default=None,
             help='The overall 64 or 128-bit ID of the trace. '
                  'Set if Pants trace should be a part of larger trace '
                  'for systems that invoke Pants. If zipkin-trace-id '
                  'and zipkin-parent-id are not set, a trace_id value is randomly generated for a '
                  'Zipkin trace')
   register('--zipkin-parent-id', advanced=True, default=None,
             help='The 64-bit ID for a parent span that invokes Pants. '
                  'zipkin-trace-id and zipkin-parent-id must both either be set or not set '
                  'when run Pants command')
Beispiel #3
0
 def register_options(cls, register):
   super(Reporting, cls).register_options(register)
   register('--invalidation-report', default=False, action='store_true',
            help='Write a formatted report on the invalid objects to the specified path.')
   register('--reports-dir', advanced=True, metavar='<dir>',
            default=os.path.join(register.bootstrap.pants_workdir, 'reports'),
            help='Write reports to this dir.')
   register('--template-dir', advanced=True, metavar='<dir>', default=None,
            help='Find templates for rendering in this dir.')
   register('--console-label-format', advanced=True, type=dict,
            default=PlainTextReporter.LABEL_FORMATTING,
            help='Controls the printing of workunit labels to the console.  Workunit types are '
                 '{workunits}.  Possible formatting values are {formats}'.format(
              workunits=WorkUnitLabel.keys(), formats=LabelFormat.keys()))
   register('--console-tool-output-format', advanced=True, type=dict,
            default=PlainTextReporter.TOOL_OUTPUT_FORMATTING,
            help='Controls the printing of workunit tool output to the console. Workunit types are '
                 '{workunits}.  Possible formatting values are {formats}'.format(
              workunits=WorkUnitLabel.keys(), formats=ToolOutputFormat.keys()))
Beispiel #4
0
  def __init__(self, run_tracker, settings):
    Reporter.__init__(self, run_tracker, settings)
    for key, value in settings.label_format.items():
      if key not in WorkUnitLabel.keys():
        self.emit('*** Got invalid key {} for --reporting-console-label-format. Expected one of {}\n'
                  .format(key, WorkUnitLabel.keys()))
      if value not in LabelFormat.keys():
        self.emit('*** Got invalid value {} for --reporting-console-label-format. Expected one of {}\n'
                  .format(value, LabelFormat.keys()))
    for key, value in settings.tool_output_format.items():
      if key not in WorkUnitLabel.keys():
        self.emit('*** Got invalid key {} for --reporting-console-tool-output-format. Expected one of {}\n'
                  .format(key, WorkUnitLabel.keys()))
      if value not in ToolOutputFormat.keys():
        self.emit('*** Got invalid value {} for --reporting-console-tool-output-format. Expected one of {}\n'
                  .format(value, ToolOutputFormat.keys()))

    # Mix in the new settings with the defaults.
    self.LABEL_FORMATTING.update(settings.label_format.items())
    self.TOOL_OUTPUT_FORMATTING.update(settings.tool_output_format.items())
Beispiel #5
0
 def register_options(cls, register):
     super(Reporting, cls).register_options(register)
     register(
         '--invalidation-report',
         type=bool,
         help=
         'Write a formatted report on the invalid objects to the specified path.'
     )
     register('--reports-dir',
              advanced=True,
              metavar='<dir>',
              default=os.path.join(register.bootstrap.pants_workdir,
                                   'reports'),
              help='Write reports to this dir.')
     register('--template-dir',
              advanced=True,
              metavar='<dir>',
              default=None,
              help='Find templates for rendering in this dir.')
     register(
         '--console-label-format',
         advanced=True,
         type=dict,
         default=PlainTextReporter.LABEL_FORMATTING,
         help=
         'Controls the printing of workunit labels to the console.  Workunit types are '
         '{workunits}.  Possible formatting values are {formats}'.format(
             workunits=list(WorkUnitLabel.keys()),
             formats=list(LabelFormat.keys())))
     register(
         '--console-tool-output-format',
         advanced=True,
         type=dict,
         default=PlainTextReporter.TOOL_OUTPUT_FORMATTING,
         help=
         'Controls the printing of workunit tool output to the console. Workunit types are '
         '{workunits}.  Possible formatting values are {formats}'.format(
             workunits=list(WorkUnitLabel.keys()),
             formats=list(ToolOutputFormat.keys())))
Beispiel #6
0
 def register_options(cls, register):
   super().register_options(register)
   register('--invalidation-report', type=bool,
            help='Write a formatted report on the invalid objects to the specified path.')
   register('--reports-dir', advanced=True, metavar='<dir>',
            default=os.path.join(register.bootstrap.pants_workdir, 'reports'),
            help='Write reports to this dir.')
   register('--template-dir', advanced=True, metavar='<dir>', default=None,
            help='Find templates for rendering in this dir.')
   register('--console-label-format', advanced=True, type=dict,
            default=PlainTextReporter.LABEL_FORMATTING,
            help='Controls the printing of workunit labels to the console.  Workunit types are '
                 '{workunits}.  Possible formatting values are {formats}'.format(
              workunits=list(WorkUnitLabel.keys()), formats=list(LabelFormat.keys())))
   register('--console-tool-output-format', advanced=True, type=dict,
            default=PlainTextReporter.TOOL_OUTPUT_FORMATTING,
            help='Controls the printing of workunit tool output to the console. Workunit types are '
                 '{workunits}.  Possible formatting values are {formats}'.format(
              workunits=list(WorkUnitLabel.keys()), formats=list(ToolOutputFormat.keys())))
   register('--zipkin-endpoint', advanced=True, default=None,
             help='The full HTTP URL of a zipkin server to which traces should be posted. '
                  'No traces will be made if this is not set.')
   register('--zipkin-trace-id', advanced=True, default=None,
             help='The overall 64 or 128-bit ID of the trace (the format is 16-character or '
                  '32-character hex string). Set if the Pants trace should be a part of a larger '
                  'trace for systems that invoke Pants. If flags zipkin-trace-id and '
                  'zipkin-parent-id are not set, a trace_id value is randomly generated '
                  'for a Zipkin trace.')
   register('--zipkin-parent-id', advanced=True, default=None,
             help='The 64-bit ID for a parent span that invokes Pants (the format is 16-character '
                  'hex string). Flags zipkin-trace-id and zipkin-parent-id must both either be set '
                  'or not set when running a Pants command.')
   register('--zipkin-sample-rate', advanced=True, default=100.0,
             help='Rate at which to sample Zipkin traces. Value 0.0 - 100.0.')
   register('--zipkin-trace-v2', advanced=True, type=bool, default=False,
             help='If enabled, the zipkin spans are tracked for v2 engine execution progress.')
   register('--zipkin-service-name-prefix', advanced=True, default='pants',
     help='The prefix for service name for Zipkin spans.')
  def __init__(self, run_tracker, settings):
    super(PlainTextReporter, self).__init__(run_tracker, settings)

    # We eagerly validate that our output accepts raw bytes.
    settings.outfile.write(b'')

    for key, value in settings.label_format.items():
      if key not in WorkUnitLabel.keys():
        self.emit('*** Got invalid key {} for --reporting-console-label-format. Expected one of {}\n'
                  .format(key, WorkUnitLabel.keys()))
      if value not in LabelFormat.keys():
        self.emit('*** Got invalid value {} for --reporting-console-label-format. Expected one of {}\n'
                  .format(value, LabelFormat.keys()))
    for key, value in settings.tool_output_format.items():
      if key not in WorkUnitLabel.keys():
        self.emit('*** Got invalid key {} for --reporting-console-tool-output-format. Expected one of {}\n'
                  .format(key, WorkUnitLabel.keys()))
      if value not in ToolOutputFormat.keys():
        self.emit('*** Got invalid value {} for --reporting-console-tool-output-format. Expected one of {}\n'
                  .format(value, ToolOutputFormat.keys()))

    # Mix in the new settings with the defaults.
    self.LABEL_FORMATTING.update(settings.label_format.items())
    self.TOOL_OUTPUT_FORMATTING.update(settings.tool_output_format.items())
Beispiel #8
0
 def register_options(cls, register):
   super(Reporting, cls).register_options(register)
   register('--invalidation-report', type=bool,
            help='Write a formatted report on the invalid objects to the specified path.')
   register('--reports-dir', advanced=True, metavar='<dir>',
            default=os.path.join(register.bootstrap.pants_workdir, 'reports'),
            help='Write reports to this dir.')
   register('--template-dir', advanced=True, metavar='<dir>', default=None,
            help='Find templates for rendering in this dir.')
   register('--console-label-format', advanced=True, type=dict,
            default=PlainTextReporter.LABEL_FORMATTING,
            help='Controls the printing of workunit labels to the console.  Workunit types are '
                 '{workunits}.  Possible formatting values are {formats}'.format(
              workunits=list(WorkUnitLabel.keys()), formats=list(LabelFormat.keys())))
   register('--console-tool-output-format', advanced=True, type=dict,
            default=PlainTextReporter.TOOL_OUTPUT_FORMATTING,
            help='Controls the printing of workunit tool output to the console. Workunit types are '
                 '{workunits}.  Possible formatting values are {formats}'.format(
              workunits=list(WorkUnitLabel.keys()), formats=list(ToolOutputFormat.keys())))
   register('--zipkin-endpoint', advanced=True, default=None,
             help='The full HTTP URL of a zipkin server to which traces should be posted. '
                  'No traces will be made if this is not set.')
   register('--zipkin-trace-id', advanced=True, default=None,
             help='The overall 64 or 128-bit ID of the trace (the format is 16-character or '
                  '32-character hex string). Set if the Pants trace should be a part of a larger '
                  'trace for systems that invoke Pants. If flags zipkin-trace-id and '
                  'zipkin-parent-id are not set, a trace_id value is randomly generated '
                  'for a Zipkin trace.')
   register('--zipkin-parent-id', advanced=True, default=None,
             help='The 64-bit ID for a parent span that invokes Pants (the format is 16-character '
                  'hex string). Flags zipkin-trace-id and zipkin-parent-id must both either be set '
                  'or not set when running a Pants command.')
   register('--zipkin-sample-rate', advanced=True, default=100.0,
             help='Rate at which to sample Zipkin traces. Value 0.0 - 100.0.')
   register('--zipkin-trace-v2', advanced=True, type=bool, default=False,
             help='If enabled, the zipkin spans are tracked for v2 engine execution progress.')
Beispiel #9
0
 def register_options(cls, register):
     super().register_options(register)
     register(
         "--invalidation-report",
         type=bool,
         help=
         "Write a formatted report on the invalid objects to the specified path.",
     )
     register(
         "--reports-dir",
         advanced=True,
         metavar="<dir>",
         default=os.path.join(register.bootstrap.pants_workdir, "reports"),
         help="Write reports to this dir.",
     )
     register(
         "--template-dir",
         advanced=True,
         metavar="<dir>",
         default=None,
         help="Find templates for rendering in this dir.",
     )
     register(
         "--console-label-format",
         advanced=True,
         type=dict,
         default=PlainTextReporter.LABEL_FORMATTING,
         help=
         "Controls the printing of workunit labels to the console.  Workunit types are "
         "{workunits}.  Possible formatting values are {formats}".format(
             workunits=list(WorkUnitLabel.keys()),
             formats=list(LabelFormat.keys())),
     )
     register(
         "--console-tool-output-format",
         advanced=True,
         type=dict,
         default=PlainTextReporter.TOOL_OUTPUT_FORMATTING,
         help=
         "Controls the printing of workunit tool output to the console. Workunit types are "
         "{workunits}.  Possible formatting values are {formats}".format(
             workunits=list(WorkUnitLabel.keys()),
             formats=list(ToolOutputFormat.keys())),
     )
     register(
         "--zipkin-endpoint",
         advanced=True,
         default=None,
         help=
         "The full HTTP URL of a zipkin server to which traces should be posted. "
         "No traces will be made if this is not set.",
     )
     register(
         "--zipkin-trace-id",
         advanced=True,
         default=None,
         help=
         "The overall 64 or 128-bit ID of the trace (the format is 16-character or "
         "32-character hex string). Set if the Pants trace should be a part of a larger "
         "trace for systems that invoke Pants. If flags zipkin-trace-id and "
         "zipkin-parent-id are not set, a trace_id value is randomly generated "
         "for a Zipkin trace.",
     )
     register(
         "--zipkin-parent-id",
         advanced=True,
         default=None,
         help=
         "The 64-bit ID for a parent span that invokes Pants (the format is 16-character "
         "hex string). Flags zipkin-trace-id and zipkin-parent-id must both either be set "
         "or not set when running a Pants command.",
     )
     register(
         "--zipkin-sample-rate",
         advanced=True,
         default=100.0,
         help="Rate at which to sample Zipkin traces. Value 0.0 - 100.0.",
     )
     register(
         "--zipkin-trace-v2",
         advanced=True,
         type=bool,
         default=False,
         help=
         "If enabled, the zipkin spans are tracked for v2 engine execution progress.",
     )
     register(
         "--zipkin-service-name-prefix",
         advanced=True,
         default="pants",
         help="The prefix for service name for Zipkin spans.",
     )
     register(
         "--zipkin-max-span-batch-size",
         advanced=True,
         type=int,
         default=100,
         help=
         "Spans in a Zipkin trace are sent to the Zipkin server in batches."
         "zipkin-max-span-batch-size sets the max size of one batch.",
     )