Merge pull request #40 from status-im/saveConfig
Save config file and git info in results folder for reproducibility
This commit is contained in:
commit
08ba135da8
|
@ -82,6 +82,9 @@ successCondition = 0.9
|
|||
# If True, print diagnostics when the block is not available
|
||||
diagnostics = False
|
||||
|
||||
# True to save git diff and git commit
|
||||
saveGit = False
|
||||
|
||||
def nextShape():
|
||||
for run, fr, class1ratio, chi, vpn1, vpn2, blockSize, nn, netDegree, bwUplinkProd, bwUplink1, bwUplink2 in itertools.product(
|
||||
runs, failureRates, class1ratios, chis, validatorsPerNode1, validatorsPerNode2, blockSizes, numberNodes, netDegrees, bwUplinksProd, bwUplinks1, bwUplinks2):
|
||||
|
|
14
study.py
14
study.py
|
@ -2,6 +2,7 @@
|
|||
|
||||
import time, sys, random, copy
|
||||
import importlib
|
||||
import subprocess
|
||||
from joblib import Parallel, delayed
|
||||
from DAS import *
|
||||
|
||||
|
@ -63,6 +64,19 @@ def study():
|
|||
now = datetime.now()
|
||||
execID = now.strftime("%Y-%m-%d_%H-%M-%S_")+str(random.randint(100,999))
|
||||
|
||||
# save config and code state for reproducibility
|
||||
if not os.path.exists("results"):
|
||||
os.makedirs("results")
|
||||
dir = "results/"+execID
|
||||
if not os.path.exists(dir):
|
||||
os.makedirs(dir)
|
||||
if config.saveGit:
|
||||
with open(dir+"/git.diff", 'w') as f:
|
||||
subprocess.run(["git", "diff"], stdout=f)
|
||||
with open(dir+"/git.describe", 'w') as f:
|
||||
subprocess.run(["git", "describe", "--always"], stdout=f)
|
||||
subprocess.run(["cp", sys.argv[1], dir+"/"])
|
||||
|
||||
logger.info("Starting simulations:", extra=format)
|
||||
start = time.time()
|
||||
results = Parallel(config.numJobs)(delayed(runOnce)(config, shape ,execID) for shape in config.nextShape())
|
||||
|
|
Loading…
Reference in New Issue