-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
27 lines (23 loc) · 958 Bytes
/
run.py
File metadata and controls
27 lines (23 loc) · 958 Bytes
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
import argparse
from database import Pipeline, Session
from server import run_extract_task, run_transfer_task, run_transform_task
session = Session()
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("pipeline_id", type=int)
parser.add_argument("--extract", action="store_true")
parser.add_argument("--transform", action="store_true")
parser.add_argument("--transfer", action="store_true")
args = parser.parse_args()
pipeline = session.query(Pipeline).get(args.pipeline_id)
if args.extract:
thread = run_extract_task(pipeline)
thread.join()
if args.transform:
thread = run_transform_task(pipeline)
thread.join()
if args.transfer:
thread = run_transfer_task(pipeline)
thread.join()
if not args.extract and not args.transform and not args.transfer:
raise ValueError("Need to specify --extract or --transform or --transfer")