def _workers_count(): cpu_count = 0 try: cpu_count = len(os.sched_getaffinity(0)) except AttributeError: cpu_count = os.cpu_count() return cpu_count * 4