Skip to content

Commit

Permalink
Fix flow id format issues (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
d-shree authored Nov 16, 2023
1 parent cef89e6 commit c499bd4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
5 changes: 1 addition & 4 deletions skit_calls/calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from skit_calls import constants as const
from skit_calls.data import mutators, query
from skit_calls.data.model import Turn
from skit_calls.utils import convert_str_to_int_list

def save_turns_in_memory(stream: Iterable[Dict[str, Any]]) -> pd.DataFrame:
return pd.DataFrame(list(stream))
Expand Down Expand Up @@ -146,11 +145,9 @@ def sample(
:rtype: str
"""
start_time = time.time()
logger.info(f"Flow ids: {flow_ids}")
flow_ids = convert_str_to_int_list(flow_ids)
random_id_limit = min(30*call_quantity, 75000)
all_call_ids = []
org_ids = convert_str_to_int_list(org_ids)
logger.info(f"Flow ids: {flow_ids}")
for flow_id in flow_ids:
flow_id_list = []
flow_id_list.append(flow_id)
Expand Down
11 changes: 9 additions & 2 deletions skit_calls/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from skit_calls import calls
from skit_calls import constants as const
from skit_calls import utils
from skit_calls.utils import configure_logger, process_ids_to_int


def to_datetime(date_string: Optional[str]) -> datetime:
Expand Down Expand Up @@ -282,6 +282,13 @@ def random_sample_calls(args: argparse.Namespace) -> Union[str, pd.DataFrame]:
args.start_date, args.end_date = process_date_filters(
args.start_date, args.end_date, timezone=args.timezone
)

args.flow_ids = process_ids_to_int(args.flow_ids)
args.org_ids = process_ids_to_int(args.org_ids)

logger.info(f"args.flow_id {args.flow_ids}")
logger.info(f"args.org_ids {args.org_ids}")

validate_date_ranges(args.start_date, args.end_date)
start = time.time()
maybe_df = calls.sample(
Expand Down Expand Up @@ -313,7 +320,7 @@ def random_sample_calls(args: argparse.Namespace) -> Union[str, pd.DataFrame]:


def cmd_to_str(args: argparse.Namespace) -> str:
utils.configure_logger(args.verbose)
configure_logger(args.verbose)

maybe_df = None
if args.command == "sample":
Expand Down
4 changes: 2 additions & 2 deletions skit_calls/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ def optimal_paging_params(total_count: int, page_size: int, delay: int) -> Tuple
page_size //= 1.8
return int(page_size), delay

def convert_str_to_int_list(str_values):
def process_ids_to_int(str_values):
int_list = []
if str_values and len(str_values[0])>0:
if str_values and isinstance(str_values[0], str):
str_list = str_values[0].strip("[]").split(',')
int_list = [int(value) for value in str_list]
return int_list

0 comments on commit c499bd4

Please sign in to comment.