Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content
Snippets Groups Projects
Commit dec7f617 authored by ulrich_y's avatar ulrich_y
Browse files

Make createrun.py more PEP compliant (#6 & #17)

parent ac1f74c8
No related branches found
No related tags found
No related merge requests found
...@@ -7,12 +7,13 @@ import argparse ...@@ -7,12 +7,13 @@ import argparse
import sys import sys
import re import re
def parsestat(s): def parsestat(s):
return int(s. return int(s.
replace("k","000"). replace("k","000").
replace("M","000000"). replace("M","000000").
replace("G","000000000") replace("G","000000000"))
)
def getref(): def getref():
try: try:
...@@ -107,10 +108,10 @@ def create_menu( ...@@ -107,10 +108,10 @@ def create_menu(
) )
header = ( header = (
"## Generated at %s by %s\n" "## Generated at %s by %s\n"
+ "# git version: %s (%s)\n" "# git version: %s (%s)\n"
+ "# To re-generate, run python %s \\\n" "# To re-generate, run python %s \\\n"
) % ( ) % (
datetime.now().strftime("%H:%M on %B %d %Y"), os.environ['USER'], datetime.now().strftime("%H:%M on %B %d %Y"), os.environ['USER'],
getbranch(), getref(), sys.argv[0] getbranch(), getref(), sys.argv[0]
) + " \\\n".join( ) + " \\\n".join(
...@@ -119,19 +120,21 @@ def create_menu( ...@@ -119,19 +120,21 @@ def create_menu(
menu = "\n\nconf %s/%s-%s.conf" % (folder, whichbase, flavour) menu = "\n\nconf %s/%s-%s.conf" % (folder, whichbase, flavour)
config = ("\n\n# specify the program to run relative to `pwd`\n" config = ("\n\n# specify the program to run relative to `pwd`\n"
+ "binary=%s\n\n" "binary=%s\n\n"
+ "# specify the output folder\n" "# specify the output folder\n"
+ "folder=%s/\n\n" "folder=%s/\n\n"
+ "# Specify the variables nenter_ad, itmx_ad, nenter and itmx\n" "# Specify the variables nenter_ad, itmx_ad, nenter and itmx\n"
+ "# for each piece you want to run.\n" "# for each piece you want to run.\n"
+ "declare -A STAT=(\n") % (binary, folder) "declare -A STAT=(\n") % (binary, folder)
for part,stat in stats.iteritems(): for part,stat in stats.iteritems():
config += ' ["%s%s"]="%d\\n%d\\n%d\\n%d"\n' % ( config += ' ["%s%s"]="%d\\n%d\\n%d\\n%d"\n' % (
whichbase, part, stat[0], stat[1], stat[2], stat[3] whichbase, part, stat[0], stat[1], stat[2], stat[3]
) )
if stat[0] < stat[1] or stat[2] < stat[3]: if stat[0] < stat[1] or stat[2] < stat[3]:
print "Warning! In part %s, calls and itmx might be swapped!" % part print "Warning! In part %s, calls and itmx might be swapped!" % (
part
)
n = stat[4] if len(stat) == 5 else len(seeds) n = stat[4] if len(stat) == 5 else len(seeds)
xiloop = ( xiloop = (
...@@ -144,7 +147,8 @@ def create_menu( ...@@ -144,7 +147,8 @@ def create_menu(
for xi in (xicuts if xiloop else [1.]): for xi in (xicuts if xiloop else [1.]):
totalstat[0] += n*(stat[1] + stat[3]) # iterations totalstat[0] += n*(stat[1] + stat[3]) # iterations
totalstat[1] += 1000*n*(stat[0]*stat[1] + stat[2]*stat[3]) # iterations # iterations
totalstat[1] += 1000*n*(stat[0]*stat[1] + stat[2]*stat[3])
menu += "\n\n" menu += "\n\n"
menu += '\n'.join( menu += '\n'.join(
"run %d %f %s%s %s 0" % (seed, xi, whichbase, part, flavour) "run %d %f %s%s %s 0" % (seed, xi, whichbase, part, flavour)
...@@ -175,6 +179,7 @@ def create_menu( ...@@ -175,6 +179,7 @@ def create_menu(
folder folder
) )
def interogate(args={}): def interogate(args={}):
specs = inspect.getargspec(create_menu) specs = inspect.getargspec(create_menu)
defaults = dict(zip(specs.args, specs.defaults)) defaults = dict(zip(specs.args, specs.defaults))
...@@ -193,11 +198,12 @@ def interogate(args={}): ...@@ -193,11 +198,12 @@ def interogate(args={}):
ask('whichbase', "What type of process") ask('whichbase', "What type of process")
ask('flavour', "Which flavour combination") ask('flavour', "Which flavour combination")
ask('seeds', "How many / which seeds", ask('seeds', "How many / which seeds",
parser=lambda x: int(x) if ',' not in x else [int(i) for i in x.split(',')] parser=lambda x: (
) int(x) if ',' not in x else [int(i) for i in x.split(',')]
))
ask('xicuts', "Which xi cuts", ask('xicuts', "Which xi cuts",
parser=lambda x: [float(i) for i in x.split(',')] parser=lambda x: [float(i) for i in x.split(',')]
) )
defaults['folder'] = args['whichbase'] + args['flavour'] defaults['folder'] = args['whichbase'] + args['flavour']
ask('folder', "Where to store data") ask('folder', "Where to store data")
ask('binary', "Which binary to run") ask('binary', "Which binary to run")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment