def main():
    """
    Generate the files
    """
    http_mobile_apps = get_mobile_apps_flow_graph(limit=50000, period=7200)
    http_mw = get_mediawiki_flow_graph(limit=50000, period=3600)
    http_pandora = get_pandora_flow_graph(limit=250000, period=3600)
    http_celery_tasks = get_celery_tasks_flow_graph(limit=50000, period=3600)

    # generate TSV files
    with open('output/http_mobile_apps.tsv', 'wt') as handler:
        handler.write('# HTTP requests sent to MediaWiki from Mobile Apps\n')
        handler.writelines(format_tsv_lines(http_mobile_apps))

    with open('output/http_mediawiki.tsv', 'wt') as handler:
        handler.write('# HTTP requests sent to MediaWiki\n')
        handler.writelines(format_tsv_lines(http_mw))

    with open('output/http_pandora.tsv', 'wt') as handler:
        handler.write('# HTTP requests sent to Pandora services\n')
        handler.writelines(format_tsv_lines(http_pandora))

    with open('output/http_celery.tsv', 'wt') as handler:
        handler.write('# HTTP requests sent to MediaWiki by Celery\n')
        handler.writelines(format_tsv_lines(http_celery_tasks))

    # generate GraphViz file
    with open('output/http_mediawiki_pandora.gv', 'wt') as handler:
        handler.writelines(format_graphviz_lines(
            http_mobile_apps + http_mw + http_pandora + http_celery_tasks))
예제 #2
0
def main():
    logger = logging.getLogger(__name__)
    graph = get_flow(period=7200, limit=10000)  # last two hours

    logger.info('Saving to TSV...')
    with open('output/database.tsv', 'wt') as fp:
        fp.writelines(format_tsv_lines(graph))

    logger.info('Saving to GV...')
    with open('output/database.gv', 'wt') as fp:
        fp.writelines(format_graphviz_lines(graph))

    logger.info('Done')
예제 #3
0
def main():
    """
    Generate the files
    """
    portability_metrics = get_flow_graph(limit=1000, period=86400)

    # generate TSV files
    with open('output/portability_metrics.tsv', 'wt') as handler:
        handler.write('# Portability metrics\n')
        handler.writelines(format_tsv_lines(portability_metrics))

    # generate GraphViz file
    with open('output/portability_metrics.gv', 'wt') as handler:
        handler.writelines(format_graphviz_lines(portability_metrics))
예제 #4
0
def main():
    """
    Generate the files
    """
    solr = get_solr_flow_graph(limit=10000, period=3600)

    # generate TSV files
    with open('output/solr.tsv', 'wt') as handler:
        handler.write('# Solr requests\n')
        handler.writelines(format_tsv_lines(solr))

    # generate GraphViz file
    with open('output/solr.gv', 'wt') as handler:
        handler.writelines(format_graphviz_lines(solr))
예제 #5
0
def test_format_lines():
    lines = [
        {
            'source': 'foo',
            'edge': 'select',
            'target': 'bar',
        },
        {
            'source': 'foo2',
            'edge': 'select',
            'target': 'bar',
            'value': 0.5,
            'metadata': 'test'
        },
    ]

    assert ''.join(format_tsv_lines(
        lines)) == 'foo\tselect\tbar\nfoo2\tselect\tbar\t0.5000\ttest\n'