-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-lots.py
55 lines (44 loc) · 1.35 KB
/
run-lots.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env python
import os
import sys
import subprocess
outputDir = 'output6'
if not os.path.exists(outputDir):
os.mkdir(outputDir)
def runWithTimeout(cmd):
print(' '.join(cmd))
try:
subprocess.run(cmd, timeout=60)
except:
print('timed out after 60s')
args = [
['--voronoi', ['yes', 'no']],
['--subtract', ['no']]
]
def processArgsHelper(currentCommand, args, callback):
if len(args) == 0:
print('_'.join(currentCommand))
callback(currentCommand)
return currentCommand
if isinstance(args[0][0], list):
for arg in args[0]:
processArgsHelper(currentCommand + arg, args[1:], callback)
else:
(arg, values) = args[0]
for value in values:
processArgsHelper(currentCommand + [arg, value], args[1:], callback)
def processArgs(callback):
return processArgsHelper([], args, callback)
numIterations = 1
for file in sys.argv[1:]:
for i in range(numIterations):
def processFileCallback(argArray):
cmd = ['node', 'lace-maker2.js', file, '--holeSize', '0.04', '--butt', 'no'] + argArray + [
'--outputTemplate', '%s/{{basePath}}-%s-%s.svg' % (outputDir, '_'.join(argArray), i)]
runWithTimeout(cmd)
# print(i)
processArgs(processFileCallback)
# runWithTimeout(cmd)
# cmd = ['node', 'voronoi4.js', file, '--butt', 'no',
# '--outputTemplate', 'output/{{basePath}}-delaunay-%s.svg' % i]
# runWithTimeout(cmd)