Skip to content
Permalink
Browse files

Merge branch 'master' of http://www.oddjack.com/?certs=serv-inc/sacred into serv…

…-inc-master

Changed behavior to first try old way of getting CPU info and then fallback to py-cpuinfo, since the latter takes ~1sec.

# Conflicts:
#	requirements.txt
  • Loading branch information...
Qwlouse committed May 6, 2018
2 parents 4edb636 + 4a31432 commit e347f6dae02ca4fc9fd73fb96248ac07f8e5fd47
Showing with 17 additions and 25 deletions.
  1. +2 −1 dev-requirements.txt
  2. +10 −8 requirements.txt
  3. +2 −14 sacred/host_info.py
  4. +2 −1 setup.py
  5. +1 −1 tox.ini
@@ -12,6 +12,7 @@ numpy==1.11.3
pandas==0.19.2
pbr==1.10.0
py==1.4.32
py-cpuinfo==4.0
pymongo==3.4.0
pytest==3.0.5
python-dateutil==2.6.0
@@ -23,4 +24,4 @@ smmap2==2.0.1
SQLAlchemy==1.1.4
tinydb==3.2.1
tinydb-serialization==1.0.3
wrapt==1.10.8
wrapt==1.10.8
@@ -1,8 +1,10 @@
docopt==0.6.2
jsonpickle==0.9.3
mock==2.0.0
munch==2.0.4
pbr==1.10.0
py==1.4.32
pytest==3.0.5
wrapt==1.10.8
docopt>=0.6.2
jsonpickle>=0.9.3
mock>=2.0.0
munch>=2.0.4
pbr>=1.10.0
py>=1.4.32
py-cpuinfo>=4.0
pytest>=3.0.5
six>=1.10.0
wrapt>=1.10.8
@@ -5,9 +5,9 @@

import os
import platform
import re
import subprocess
import xml.etree.ElementTree as ET
import cpuinfo
from sacred.utils import optional_kwargs_decorator, FileNotFoundError
from sacred.settings import SETTINGS

@@ -90,19 +90,7 @@ def _python_version():

@host_info_getter(name='cpu')
def _cpu():
if platform.system() == "Windows":
return platform.processor().strip()
elif platform.system() == "Darwin":
os.environ['PATH'] += ':/usr/sbin'
command = ["sysctl", "-n", "machdep.cpu.brand_string"]
return subprocess.check_output(command).decode().strip()
elif platform.system() == "Linux":
command = ["cat", "/proc/cpuinfo"]
all_info = subprocess.check_output(command).decode()
model_pattern = re.compile("^\s*model name\s*:")
for line in all_info.split("\n"):
if model_pattern.match(line):
return model_pattern.sub("", line, 1).strip()
return cpuinfo.get_cpu_info()['brand']


@host_info_getter(name='gpus')
@@ -42,7 +42,8 @@
'docopt>=0.3, <1.0',
'jsonpickle>=0.7.2, <1.0',
'munch>=2.0.2, <3.0',
'wrapt>=1.0, <2.0'
'wrapt>=1.0, <2.0',
'py-cpuinfo>=4.0'
],
tests_require=[
'mock>=0.8, <3.0',
@@ -4,7 +4,7 @@
# and then run "tox" from this directory.

[tox]
envlist = py27, py34, py35, flake8
envlist = py27, py35, py36, flake8
# py32 does not work because of the 'wrapt' dependency
# py33 is not supported by newer versions of numpy

0 comments on commit e347f6d

Please sign in to comment.
You can’t perform that action at this time.