MCPcopy Create free account
hub / github.com/celery/celery / it

Function it

t/benchmarks/bench_worker.py:47–64  ·  view source on GitHub ↗
(_, n)

Source from the content-addressed store, hash-verified

45
46@app.task(cur=0, time_start=None, queue='bench.worker', bare=True)
47def it(_, n):
48 # use internal counter, as ordering can be skewed
49 # by previous runs, or the broker.
50 i = it.cur
51 if i and not i % 5000:
52 print(f'({i} so far: {tdiff(it.subt)}s)', file=sys.stderr)
53 it.subt = time.monotonic()
54 if not i:
55 it.subt = it.time_start = time.monotonic()
56 elif i > n - 2:
57 total = tdiff(it.time_start)
58 print(f'({i} so far: {tdiff(it.subt)}s)', file=sys.stderr)
59 print('-- process {} tasks: {}s total, {} tasks/s'.format(
60 n, total, n / (total + .0),
61 ))
62 import os
63 os._exit(0)
64 it.cur += 1
65
66
67def bench_apply(n=DEFAULT_ITS):

Callers

nothing calls this directly

Calls 2

tdiffFunction · 0.85
formatMethod · 0.45

Tested by

no test coverage detected