Checks if cpu_count is implemented

On rare occasions, usually on win32, cpu_count will raise a NotImplemented error.  If psutil is installed we will use this to get the correct count, otherwise we default to 4
This commit is contained in:
Ilan
2015-08-04 16:28:19 +02:00
parent 25dcec4572
commit ae8745ab39
2 changed files with 23 additions and 9 deletions
+1 -7
View File
@@ -22,12 +22,6 @@ from multiprocessing import Queue, Event, Process, Value, current_process
# external
import arrow
# optional
try:
import psutil
except ImportError:
psutil = None
# Django
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
@@ -37,7 +31,7 @@ from django import db
import signing
import tasks
from django_q.conf import Conf, redis_client, logger
from django_q.conf import Conf, redis_client, logger, psutil
from django_q.models import Task, Success, Schedule
from django_q.monitor import Status, Stat