Skip to content

Commit

Permalink
add time measure for feature matrix query
Browse files Browse the repository at this point in the history
  • Loading branch information
xu-hao committed Jul 18, 2020
1 parent e346e31 commit 0ad9379
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion features/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
import json
import os
from itertools import product
from .features import features, lookUpFeatureClass, features_dict
import inflection
import numpy as np
import time
from .features import features, lookUpFeatureClass, features_dict
from tx.functional.maybe import Nothing, Just
import logging

Expand Down Expand Up @@ -190,6 +191,16 @@ def add_eps(a):

MAX_ENTRIES_PER_ROW = int(os.environ.get("MAX_ENTRIES_PER_ROW", "1664"))

def timeit(method):
def timed(*args, **kw):
ts = time.time()
result = method(*args, **kw)
te = time.time()
logger.info(f"{method.__name__} {args} {kw} {te - ts}s")
return result
return timed

@timeit
def select_feature_matrix(conn, table_name, year, cohort_features, feature_a, feature_b):
table = tables[table_name]

Expand Down

0 comments on commit 0ad9379

Please sign in to comment.