How to use the carbonate.sync.run_batch function in carbonate

To help you get started, we’ve selected a few carbonate examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github graphite-project / carbonate / carbonate / cli.py View on Github external
old_mpath = old_metric.replace('.', '/') + "." + "wsp"
        new_mpath = new_metric.replace('.', '/') + "." + "wsp"

        metrics_to_sync.append((old_mpath, new_mpath))

        if total_metrics % batch_size == 0:
            print "* Running batch %s-%s" \
                  % (total_metrics-batch_size+1, total_metrics)
            run_batch(metrics_to_sync, remote,
                      args.storage_dir, args.rsync_options)
            metrics_to_sync = []

    if len(metrics_to_sync) > 0:
        print "* Running batch %s-%s" \
              % (total_metrics-len(metrics_to_sync)+1, total_metrics)
        run_batch(metrics_to_sync, remote,
                  args.storage_dir, args.rsync_options)

    elapsed = (time() - start)

    print ""
    print "* Sync Report"
    print "  ========================================"
    print "  Total metrics synced: %s" % total_metrics
    print "  Total time: %ss" % elapsed
github graphite-project / carbonate / carbonate / cli.py View on Github external
old_mpath = old_metric.replace('.', '/') + "." + "wsp"
        new_mpath = new_metric.replace('.', '/') + "." + "wsp"

        metrics_to_sync.append((old_mpath, new_mpath))

        if total_metrics % batch_size == 0:
            print "* Running batch %s-%s" \
                  % (total_metrics-batch_size+1, total_metrics)
            run_batch(metrics_to_sync, remote,
                      args.storage_dir, args.rsync_options)
            metrics_to_sync = []

    if len(metrics_to_sync) > 0:
        print "* Running batch %s-%s" \
              % (total_metrics-len(metrics_to_sync)+1, total_metrics)
        run_batch(metrics_to_sync, remote,
                  args.storage_dir, args.rsync_options)

    elapsed = (time() - start)

    print ""
    print "* Sync Report"
    print "  ========================================"
    print "  Total metrics synced: %s" % total_metrics
    print "  Total time: %ss" % elapsed