-
Notifications
You must be signed in to change notification settings - Fork 1
/
batch.py
executable file
·37 lines (28 loc) · 949 Bytes
/
batch.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
#!/usr/bin/env python
import os
import sys
import json
from os.path import abspath, basename, dirname, exists, join
from subprocess import call
from collections import OrderedDict
# path
OPT_WKS = abspath(dirname(__file__))
OPT_CMD = join(OPT_WKS, "workflow.py")
# main
if __name__ == "__main__":
if len(sys.argv) < 3 :
sys.exit("Usage: %s <list> <product> <opts>" % sys.argv[0])
pn = sys.argv[1]
tag = sys.argv[2]
with open(pn, "r") as f:
hashes = [l.strip().split(",")[0] for l in f]
for h in hashes:
if len(sys.argv) == 4 and sys.argv[3] == "-v":
cmd = ["python", OPT_CMD, "both", tag, h, "-v"]
else:
cmd = ["python", OPT_CMD, "both", tag, h]
print "=== %s ===" % h
call(cmd)
if len(sys.argv) == 4 and sys.argv[3] == "-a":
continue
raw_input("\nPress enter for next sample\n")