Scripting worker¶
Worker is a service over event loop that tracks and schedules outstanding queries, you can see the statistics or schedule new queries. It also contains information about specified worker count and process rank.
- worker.pid¶
Current worker process PID (number).
- worker.stats()¶
Return table of statistics. See member descriptions in
worker_stats. A few fields are added, mainly from POSIXgetrusage():usertimeandsystime– CPU time used, in secondspagefaults– the number of hard page faults, i.e. those that required I/O activityswaps– the number of times the process was “swapped” out of main memory; unused on Linuxcsw– the number of context switches, both voluntary and involuntaryrss– current memory usage in bytes, including whole cache (resident set size)
Example:
print(worker.stats().concurrent)