From f231a14827d81cb2ad3b84fc1c12b83aa4e6d11d Mon Sep 17 00:00:00 2001 From: yz Date: Mon, 14 Nov 2022 13:24:22 +0800 Subject: [PATCH] add sysargv --- src/data_loader.py | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/data_loader.py b/src/data_loader.py index 10f472e..521d914 100644 --- a/src/data_loader.py +++ b/src/data_loader.py @@ -191,8 +191,8 @@ def run_pool_dates_by_code_init_n_group(typ='mink', code_gp_amt=10, date_gp_amt= code_list = all_code_dict[code_init] if typ == 'mink': # logger.info('Running mink') - print(date_list) - print(code_list) + logger.info(date_list) + logger.info(code_list) run_pool_add_by_datelist_codeinit( 'mink', date_list, code_list, if_check) @@ -210,15 +210,21 @@ if __name__ == '__main__': tic = time.perf_counter() - typ = 'mink' - st_d = '20220104' - en_d = '20221031' - if_check = 0 - split_code_into_howmany_groups_no = 10 - split_date_into_howmany_groups = 5 - - logger.info( - f"Going to run {typ} from {st_d} to {en_d} with if_check dupliactes={if_check} in {running_which_env}, plz check if this info is correct.\n\n\n\n") + if len(sys.argv)>1: + typ,st_d,en_d,if_check,split_code_into_howmany_groups_no,split_date_into_howmany_groups = sys.argv[1:] + if_check=int(if_check) + split_code_into_howmany_groups_no = int(split_code_into_howmany_groups_no) + split_date_into_howmany_groups=int(split_date_into_howmany_groups) + else: + typ = 'mink' + st_d = '20210104' + en_d = '20211231' + if_check = 0 + split_code_into_howmany_groups_no = 5 + split_date_into_howmany_groups = 20 + + logger.warning( + f"Going to run *{typ}* from {st_d} to {en_d} with if_check dupliactes={if_check} in *{running_which_env}*, plz check if this info is correct.\n\n\n\n") run_pool_dates_by_code_init_n_group(typ=typ, code_gp_amt=split_code_into_howmany_groups_no, date_gp_amt=split_date_into_howmany_groups, start_date=st_d, end_date=en_d, if_check=if_check, code_dict_by='group') # run_pool_dates_by_code_init_n_group(typ='mink',group_amount=5)