-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRepCRec_runner.py
36 lines (27 loc) · 993 Bytes
/
RepCRec_runner.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
'''
CSCI-GA 2434 Advanced Database Systems Final Project
Replicated Concurrency Control and Recovery
Team:
Ren Yi--ry708@nyu.edu
Yanqiu Wu--yw1370@nyu.edu
Running instructions
1. With input file: python RepCRec_runner.py <input_file_name>
2. From stdin:
1) cat <input_file_name> | python RepCRec_runner.py
2) python RepCRec_runner.py < <input_file_name>
3) echo -e <instruction_string> | python RepCRec_runner.py
Note: <instructions_string> need to be separated by '\n'. For example:
"begin(T1)\nbegin(T2)\nW(T1,x1,101)\nW(T2,x2,202)\nW(T1,x2,102)\nW(T2,x1,201)\nend(T1)\ndump()"
'''
import argparse, sys
from RepCRec import Workflow
workflow = Workflow()
# input file
if sys.stdin.isatty():
parser = argparse.ArgumentParser('RepCRec')
parser.add_argument('file_name', type=str, help="Path to sample test file")
args = parser.parse_args()
workflow.file_name = args.file_name
else: # input from stdin
workflow.stdin = sys.stdin.readlines()
workflow.run()