-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathcompute_feat.py
More file actions
26 lines (19 loc) · 813 Bytes
/
compute_feat.py
File metadata and controls
26 lines (19 loc) · 813 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
import os
import glob
import argparse
from tqdm import tqdm
import concurrent.futures
from library import process_feat_for
parser=argparse.ArgumentParser(description='Execute Feat computation Pipeline')
parser.add_argument('--workers', type=int, help='max cpu worker to be used', default=2)
parser.add_argument('--customer', type=str, help='customer name as per path', required=True)
args = parser.parse_args()
customer=args.customer
workers=args.workers
files=glob.glob(f"./Processed/{customer}/*/*.csv")
#Making parent directory
parent_dir=f"./Features/{customer}"
os.makedirs(parent_dir,exist_ok=True)
with concurrent.futures.ThreadPoolExecutor(max_workers=workers) as executor:
results=list(tqdm(executor.map(lambda e:process_feat_for(e,parent_dir), files),total=len(files)))
print("Completed")