Commit 7abf656f authored by Andrew McNab's avatar Andrew McNab
Browse files

Import updated DIRACbenchmark.py

parent 07832295
...@@ -10,7 +10,18 @@ ...@@ -10,7 +10,18 @@
This file (DIRACbenchmark.py) is intended to be the ultimate upstream This file (DIRACbenchmark.py) is intended to be the ultimate upstream
shared by different users of the DIRAC Benchmark 2012 (DB12). The shared by different users of the DIRAC Benchmark 2012 (DB12). The
canonical version can be found at https://github.com/????? canonical version can be found at https://github.com/DIRACGrid/DB12
This script can either be imported or run from the command line:
./DIRACbenchmark.py [NUMBER]
where NUMBER is 'single', 'wholenode', 'jobslot' or a number, and
gives the number of benchmark processes to run in parallel. If
NUMBER is not given, then a single process is run. 'Wholenode'
and 'jobslot' cause the number of processes to be taken from
$MACHINEFEATURES/total_cpu or $JOBFEATURES/allocated_cpu
respectively.
""" """
import os import os
...@@ -103,7 +114,7 @@ def wholenodeDiracBenchmark( instances = None, iterations = 1 ): ...@@ -103,7 +114,7 @@ def wholenodeDiracBenchmark( instances = None, iterations = 1 ):
# Try $MACHINEFEATURES first if not given by caller # Try $MACHINEFEATURES first if not given by caller
if not instances and 'MACHINEFEATURES' in os.environ: if not instances and 'MACHINEFEATURES' in os.environ:
try: try:
instances = int( urllib2.urlopen( os.environ['MACHINEFEATURES'] + '/total_cpu' ).read() ) instances = int( urllib.urlopen( os.environ['MACHINEFEATURES'] + '/total_cpu' ).read() )
except: except:
pass pass
...@@ -124,7 +135,7 @@ def jobslotDiracBenchmark( instances = None, iterations = 1 ): ...@@ -124,7 +135,7 @@ def jobslotDiracBenchmark( instances = None, iterations = 1 ):
# Try $JOBFEATURES first if not given by caller # Try $JOBFEATURES first if not given by caller
if not instances and 'JOBFEATURES' in os.environ: if not instances and 'JOBFEATURES' in os.environ:
try: try:
instances = int( urllib2.urlopen( os.environ['JOBFEATURES'] + '/allocated_cpu' ).read() ) instances = int( urllib.urlopen( os.environ['JOBFEATURES'] + '/allocated_cpu' ).read() )
except: except:
pass pass
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment