示例#1
0
def output(data, **kwargs):
    '''

    Show profile data for returners that would normally show a highstate output.

        salt globhere state.sls something --out=profile

    Attempt to output the returns of state.sls and state.highstate as a table of
    names, modules and durations that looks somewhat like the following:

        name                mod.fun                duration (ms)
        --------------------------------------------------------
        I-fail-unless-stmt  other.function               -1.0000
        old-minion-config   grains.list_present           1.1200
        salt-data           group.present                48.3800
        /etc/salt/minion    file.managed                 63.1450


    To get the above appearance, use settings something like these:
      out.table.separate_rows: False
      out.table.justify: left
      out.table.delim: '  '
      out.table.prefix: ''
      out.table.suffix: ''
    '''

    rows = _find_durations(data)

    kwargs['opts'] = __opts__
    kwargs['rows_key'] = 'rows'
    kwargs['labels_key'] = 'labels'

    to_show = {'labels': ['name', 'mod.fun', 'duration (ms)'], 'rows': rows}

    return table_out.output(to_show, **kwargs)
示例#2
0
 def test_output(self):
     ret = table_out.output(self.data)
     self.assertEqual(ret,
                      ('    -----------------------------------------\n'
                       '    |              Food             | Price |\n'
                       '    -----------------------------------------\n'
                       '    |  яйца, бекон, колбаса и спам  |  5.99 |\n'
                       '    -----------------------------------------\n'
                       '    | спам, спам, спам, яйца и спам |  3.99 |\n'
                       '    -----------------------------------------'))
示例#3
0
def output(data, **kwargs):
    """
    Display the profiling data in a table format.
    """

    rows = _find_durations(data)

    kwargs["opts"] = __opts__
    kwargs["rows_key"] = "rows"
    kwargs["labels_key"] = "labels"

    to_show = {"labels": ["name", "mod.fun", "duration (ms)"], "rows": rows}

    return table_out.output(to_show, **kwargs)
示例#4
0
def output(data, **kwargs):
    '''
    Display the profiling data in a table format.
    '''

    rows = _find_durations(data)

    kwargs['opts'] = __opts__
    kwargs['rows_key'] = 'rows'
    kwargs['labels_key'] = 'labels'

    to_show = {'labels': ['name', 'mod.fun', 'duration (ms)'], 'rows': rows}

    return table_out.output(to_show, **kwargs)