def test_rng_access(): configs_dir = os.path.join(os.path.dirname(__file__), 'configs') orca.add_injectable("configs_dir", configs_dir) output_dir = os.path.join(os.path.dirname(__file__), 'output') orca.add_injectable("output_dir", output_dir) data_dir = os.path.join(os.path.dirname(__file__), 'data') orca.add_injectable("data_dir", data_dir) inject_settings(configs_dir, households_sample_size=HOUSEHOLDS_SAMPLE_SIZE) orca.clear_cache() pipeline.set_rn_generator_base_seed(0) pipeline.open_pipeline() with pytest.raises(RuntimeError) as excinfo: pipeline.set_rn_generator_base_seed(0) assert "call set_rn_generator_base_seed before the first step" in str( excinfo.value) rng = pipeline.get_rn_generator() pipeline.close_pipeline() orca.clear_cache()
def test_full_run2(): configs_dir = os.path.join(os.path.dirname(__file__), 'configs2') orca.add_injectable("configs_dir", configs_dir) data_dir = os.path.join(os.path.dirname(__file__), 'data2') orca.add_injectable("data_dir", data_dir) output_dir = os.path.join(os.path.dirname(__file__), 'output') orca.add_injectable("output_dir", output_dir) orca.clear_cache() tracing.config_logger() _MODELS = [ 'input_pre_processor', 'setup_data_structures', 'initial_seed_balancing', 'meta_control_factoring', 'final_seed_balancing', 'integerize_final_seed_weights', 'sub_balancing.geography = DISTRICT', 'sub_balancing.geography = TRACT', 'sub_balancing.geography=TAZ', 'expand_households', 'summarize', 'write_results' ] pipeline.run(models=_MODELS, resume_after=None) assert isinstance(pipeline.get_table('expanded_household_ids'), pd.DataFrame) assert os.path.exists(os.path.join(output_dir, 'summary_DISTRICT.csv')) # tables will no longer be available after pipeline is closed pipeline.close_pipeline() orca.clear_cache()
def test_mp_run(): mp_configs_dir = os.path.join(os.path.dirname(__file__), 'configs_mp') configs_dir = os.path.join(os.path.dirname(__file__), 'configs') inject.add_injectable('configs_dir', [mp_configs_dir, configs_dir]) output_dir = os.path.join(os.path.dirname(__file__), 'output') inject.add_injectable("output_dir", output_dir) data_dir = os.path.join(os.path.dirname(__file__), 'data') inject.add_injectable("data_dir", data_dir) tracing.config_logger() run_list = mp_tasks.get_run_list() mp_tasks.print_run_list(run_list) # do this after config.handle_standard_args, as command line args may override injectables injectables = ['data_dir', 'configs_dir', 'output_dir'] injectables = {k: inject.get_injectable(k) for k in injectables} # pipeline.run(models=run_list['models'], resume_after=run_list['resume_after']) mp_tasks.run_multiprocess(run_list, injectables) pipeline.open_pipeline('_') regress_mini_auto() pipeline.close_pipeline()
def test_pipeline_checkpoint_drop(): setup() _MODELS = [ 'step1', '_step2', '_step_add_col.table_name=table2;column_name=c2', '_step_forget_tab.table_name=table2', 'step3', 'step_forget_tab.table_name=table3', ] pipeline.run(models=_MODELS, resume_after=None) checkpoints = pipeline.get_checkpoints() print "checkpoints\n", checkpoints pipeline.get_table("table1") with pytest.raises(RuntimeError) as excinfo: pipeline.get_table("table2") assert "never checkpointed" in str(excinfo.value) # can't get a dropped table from current checkpoint with pytest.raises(RuntimeError) as excinfo: pipeline.get_table("table3") assert "was dropped" in str(excinfo.value) # ensure that we can still get table3 from a checkpoint at which it existed pipeline.get_table("table3", checkpoint_name="step3") pipeline.close_pipeline() close_handlers()
def test_full_run1(): _MODELS = [ 'input_pre_processor', 'setup_data_structures', 'initial_seed_balancing', 'meta_control_factoring', 'final_seed_balancing', 'integerize_final_seed_weights', 'sub_balancing.geography=TRACT', 'sub_balancing.geography=TAZ', 'expand_households', 'summarize', 'write_tables', 'write_synthetic_population', ] pipeline.run(models=_MODELS, resume_after=None) expanded_household_ids = pipeline.get_table('expanded_household_ids') assert isinstance(expanded_household_ids, pd.DataFrame) taz_hh_counts = expanded_household_ids.groupby('TAZ').size() assert len(taz_hh_counts) == TAZ_COUNT assert taz_hh_counts.loc[100] == TAZ_100_HH_COUNT # output_tables action: skip output_dir = inject.get_injectable('output_dir') assert not os.path.exists(os.path.join(output_dir, 'households.csv')) assert os.path.exists(os.path.join(output_dir, 'summary_DISTRICT_1.csv')) # tables will no longer be available after pipeline is closed pipeline.close_pipeline() inject.clear_cache()
def test_full_run2_repop_replace(): # Note: tests are run in alphabetical order. # This tests expects to find the pipeline h5 file from # test_full_run1 in the output folder _MODELS = [ 'input_pre_processor.table_list=repop_input_table_list;repop', 'repop_setup_data_structures', 'initial_seed_balancing.final=true;repop', 'integerize_final_seed_weights.repop', 'repop_balancing', 'expand_households.repop;replace', 'write_synthetic_population.repop', 'write_tables.repop', ] pipeline.run(models=_MODELS, resume_after='summarize') expanded_household_ids = pipeline.get_table('expanded_household_ids') assert isinstance(expanded_household_ids, pd.DataFrame) taz_hh_counts = expanded_household_ids.groupby('TAZ').size() assert len(taz_hh_counts) == TAZ_COUNT assert taz_hh_counts.loc[100] == TAZ_100_HH_REPOP_COUNT # tables will no longer be available after pipeline is closed pipeline.close_pipeline() inject.clear_cache()
def test_balancer_step(): setup_working_dir('example_balance', inherit=True) pipeline.run(['balance_trips', 'write_tables']) pipeline.close_pipeline()
def test_mp_run(): mp_configs_dir = os.path.join(os.path.dirname(__file__), 'configs_mp') configs_dir = os.path.join(os.path.dirname(__file__), 'configs') inject.add_injectable('configs_dir', [mp_configs_dir, configs_dir]) output_dir = os.path.join(os.path.dirname(__file__), 'output') inject.add_injectable("output_dir", output_dir) data_dir = os.path.join(os.path.dirname(__file__), 'data') inject.add_injectable("data_dir", data_dir) tracing.config_logger() run_list = mp_tasks.get_run_list() mp_tasks.print_run_list(run_list) # do this after config.handle_standard_args, as command line args may override injectables injectables = ['data_dir', 'configs_dir', 'output_dir'] injectables = {k: inject.get_injectable(k) for k in injectables} # pipeline.run(models=run_list['models'], resume_after=run_list['resume_after']) mp_tasks.run_multiprocess(run_list, injectables) pipeline.open_pipeline('_') regress_mini_auto() pipeline.close_pipeline()
def run(args): """ Run bca4abm. Specify a project folder using the '--working_dir' option, or point to the config, data, and output folders directly with '--config', '--data', and '--output'. """ if args.working_dir and os.path.exists(args.working_dir): os.chdir(args.working_dir) if args.config: inject.add_injectable('configs_dir', args.config) if args.data: inject.add_injectable('data_dir', args.data) if args.output: inject.add_injectable('output_dir', args.output) for injectable in ['configs_dir', 'data_dir', 'output_dir']: try: dir_path = inject.get_injectable(injectable) except RuntimeError: sys.exit('Error: please specify either a --working_dir ' "containing 'configs', 'data', and 'output' folders " 'or all three of --config, --data, and --output') if not os.path.exists(dir_path): sys.exit("Could not find %s '%s'" % (injectable, os.path.abspath(dir_path))) if args.pipeline: inject.add_injectable('pipeline_file_name', args.pipeline) if args.resume: override_setting('resume_after', args.resume) tracing.config_logger() tracing.delete_csv_files() # only modifies output_dir warnings.simplefilter('always') logging.captureWarnings(capture=True) t0 = tracing.print_elapsed_time() # If you provide a resume_after argument to pipeline.run # the pipeline manager will attempt to load checkpointed tables from the checkpoint store # and resume pipeline processing on the next submodel step after the specified checkpoint resume_after = setting('resume_after', None) if resume_after: print('resume_after: %s' % resume_after) pipeline.run(models=setting('models'), resume_after=resume_after) # tables will no longer be available after pipeline is closed pipeline.close_pipeline() t0 = tracing.print_elapsed_time('all models', t0)
def run(run_list, injectables=None): if run_list['multiprocess']: logger.info("run multiprocess simulation") mp_tasks.run_multiprocess(run_list, injectables) else: logger.info("run single process simulation") pipeline.run(models=run_list['models'], resume_after=run_list['resume_after']) pipeline.close_pipeline() mem.log_global_hwm()
def run(run_list, injectables=None): if run_list['multiprocess']: logger.info("run multiprocess simulation") mp_tasks.run_multiprocess(run_list, injectables) else: logger.info("run single process simulation") pipeline.run(models=run_list['models'], resume_after=run_list['resume_after']) pipeline.close_pipeline() chunk.log_write_hwm()
def test_full_run5_singleton(): # should wrk with only one hh if SKIP_FULL_RUN: return tour_count = full_run(trace_hh_id=HH_ID, households_sample_size=1) regress() pipeline.close_pipeline()
def test_mini_pipeline_run2(): # the important thing here is that we should get # exactly the same results as for test_mini_pipeline_run # when we restart pipeline configs_dir = os.path.join(os.path.dirname(__file__), 'configs') setup_dirs(configs_dir) inject_settings(configs_dir, households_sample_size=HOUSEHOLDS_SAMPLE_SIZE) # should be able to get this BEFORE pipeline is opened checkpoints_df = pipeline.get_checkpoints() prev_checkpoint_count = len(checkpoints_df.index) # print "checkpoints_df\n", checkpoints_df[['checkpoint_name']] assert prev_checkpoint_count == 8 pipeline.open_pipeline('auto_ownership_simulate') regress_mini_auto() # try to run a model already in pipeline with pytest.raises(RuntimeError) as excinfo: pipeline.run_model('auto_ownership_simulate') assert "run model 'auto_ownership_simulate' more than once" in str( excinfo.value) # and these new ones pipeline.run_model('cdap_simulate') pipeline.run_model('mandatory_tour_frequency') regress_mini_mtf() # should be able to get this before pipeline is closed (from existing open store) checkpoints_df = pipeline.get_checkpoints() assert len(checkpoints_df.index) == prev_checkpoint_count # - write list of override_hh_ids to override_hh_ids.csv in data for use in next test num_hh_ids = 10 hh_ids = pipeline.get_table("households").head(num_hh_ids).index.values hh_ids = pd.DataFrame({'household_id': hh_ids}) data_dir = inject.get_injectable('data_dir') hh_ids.to_csv(os.path.join(data_dir, 'override_hh_ids.csv'), index=False, header=True) pipeline.close_pipeline() inject.clear_cache() close_handlers()
def test_zero_chunk_size(): settings = inject_settings(chunk_size=0) inject.clear_cache() tracing.config_logger() MODELS = settings['models'] pipeline.run(models=MODELS, resume_after='aggregate_od_processor') pipeline.close_pipeline()
def test_full_run4_stability(): # hh should get the same result with different sample size if SKIP_FULL_RUN: return tour_count = full_run(trace_hh_id=HH_ID, households_sample_size=HOUSEHOLDS_SAMPLE_SIZE+10) regress() pipeline.close_pipeline()
def test_full_run5_singleton(): # should wrk with only one hh if SKIP_FULL_RUN: return tour_count = full_run(trace_hh_id=HH_ID, households_sample_size=1) regress() pipeline.close_pipeline()
def test_full_run4_stability(): # hh should get the same result with different sample size if SKIP_FULL_RUN: return tour_count = full_run(trace_hh_id=HH_ID, households_sample_size=HOUSEHOLDS_SAMPLE_SIZE - 10) regress() pipeline.close_pipeline()
def test_full_run2(): # resume_after should successfully load tours table and replicate results if SKIP_FULL_RUN: return tour_count = full_run(resume_after='non_mandatory_tour_scheduling', trace_hh_id=HH_ID) assert(tour_count == EXPECT_TOUR_COUNT) regress() pipeline.close_pipeline()
def test_rng_access(): setup_dirs() inject.add_injectable('rng_base_seed', 0) pipeline.open_pipeline() rng = pipeline.get_rn_generator() assert isinstance(rng, random.Random) pipeline.close_pipeline() inject.clear_cache()
def run(args): """ Run the models. Specify a project folder using the '--working_dir' option, or point to the config, data, and output folders directly with '--config', '--data', and '--output'. Both '--config' and '--data' can be specified multiple times. Directories listed first take precedence. """ from activitysim import abm # register injectables tracing.config_logger(basic=True) handle_standard_args(args) # possibly update injectables tracing.config_logger( basic=False) # update using possibly new logging configs config.filter_warnings() logging.captureWarnings(capture=True) log_settings() t0 = tracing.print_elapsed_time() # If you provide a resume_after argument to pipeline.run # the pipeline manager will attempt to load checkpointed tables from the checkpoint store # and resume pipeline processing on the next submodel step after the specified checkpoint resume_after = config.setting('resume_after', None) # cleanup if not resuming if not resume_after: cleanup_output_files() elif config.setting('cleanup_trace_files_on_resume', False): tracing.delete_trace_files() if config.setting('multiprocess', False): logger.info('run multiprocess simulation') from activitysim.core import mp_tasks run_list = mp_tasks.get_run_list() injectables = {k: inject.get_injectable(k) for k in INJECTABLES} mp_tasks.run_multiprocess(run_list, injectables) else: logger.info('run single process simulation') pipeline.run(models=config.setting('models'), resume_after=resume_after) pipeline.close_pipeline() chunk.log_write_hwm() tracing.print_elapsed_time('all models', t0)
def test_mini_pipeline_run2(): # the important thing here is that we should get # exactly the same results as for test_mini_pipeline_run # when we restart pipeline configs_dir = os.path.join(os.path.dirname(__file__), 'configs') setup_dirs(configs_dir) inject_settings(configs_dir, households_sample_size=HOUSEHOLDS_SAMPLE_SIZE) # should be able to get this BEFORE pipeline is opened checkpoints_df = pipeline.get_checkpoints() prev_checkpoint_count = len(checkpoints_df.index) # print "checkpoints_df\n", checkpoints_df[['checkpoint_name']] assert prev_checkpoint_count == 8 pipeline.open_pipeline('auto_ownership_simulate') regress_mini_auto() # try to run a model already in pipeline with pytest.raises(RuntimeError) as excinfo: pipeline.run_model('auto_ownership_simulate') assert "run model 'auto_ownership_simulate' more than once" in str(excinfo.value) # and these new ones pipeline.run_model('cdap_simulate') pipeline.run_model('mandatory_tour_frequency') regress_mini_mtf() # should be able to get this before pipeline is closed (from existing open store) checkpoints_df = pipeline.get_checkpoints() assert len(checkpoints_df.index) == prev_checkpoint_count # - write list of override_hh_ids to override_hh_ids.csv in data for use in next test num_hh_ids = 10 hh_ids = pipeline.get_table("households").head(num_hh_ids).index.values hh_ids = pd.DataFrame({'household_id': hh_ids}) data_dir = inject.get_injectable('data_dir') hh_ids.to_csv(os.path.join(data_dir, 'override_hh_ids.csv'), index=False, header=True) pipeline.close_pipeline() inject.clear_cache() close_handlers()
def test_full_run1(): MODELS = [ 'demographics_processor', 'person_trips_processor', 'auto_ownership_processor', 'physical_activity_processor', 'aggregate_trips_processor', 'link_daily_processor', 'link_processor', 'finalize_abm_results', 'write_data_dictionary', 'write_tables' ] # MODELS = setting('models') run_abm(MODELS, chunk_size=None, trace_hh_id=None, trace_od=None) regress_abm() pipeline.close_pipeline()
def test_run_4step(): settings = inject_settings(chunk_size=None, trace_hh_id=None, trace_od=None) inject.clear_cache() tracing.config_logger() MODELS = settings['models'] pipeline.run(models=MODELS, resume_after=None) pipeline.close_pipeline()
def test_full_run1(): if SKIP_FULL_RUN: return tour_count = full_run(trace_hh_id=HH_ID, check_for_variability=True, households_sample_size=HOUSEHOLDS_SAMPLE_SIZE) print("tour_count", tour_count) assert(tour_count == EXPECT_TOUR_COUNT) regress() pipeline.close_pipeline()
def test_full_run3_with_chunks(): # should get the same result with different chunk size if SKIP_FULL_RUN: return tour_count = full_run(trace_hh_id=HH_ID, households_sample_size=HOUSEHOLDS_SAMPLE_SIZE, chunk_size=500000) assert(tour_count == EXPECT_TOUR_COUNT) regress() pipeline.close_pipeline()
def test_rng_access(): configs_dir = os.path.join(os.path.dirname(__file__), 'configs') setup_dirs(configs_dir) inject.add_injectable('rng_base_seed', 0) pipeline.open_pipeline() rng = pipeline.get_rn_generator() assert isinstance(rng, random.Random) pipeline.close_pipeline() inject.clear_cache()
def test_full_run5_singleton(): # should work with only one hh # run with minimum chunk size to drive potential chunking errors in models # where choosers has multiple rows that all have to be included in the same chunk if SKIP_FULL_RUN: return tour_count = full_run(trace_hh_id=HH_ID, households_sample_size=1, chunk_size=1) regress() pipeline.close_pipeline()
def test_pipeline_run(): orca.orca._INJECTABLES.pop('skim_dict', None) orca.orca._INJECTABLES.pop('skim_stack', None) configs_dir = os.path.join(os.path.dirname(__file__), 'configs') orca.add_injectable("configs_dir", configs_dir) output_dir = os.path.join(os.path.dirname(__file__), 'output') orca.add_injectable("output_dir", output_dir) data_dir = os.path.join(os.path.dirname(__file__), 'data') orca.add_injectable("data_dir", data_dir) orca.clear_cache() tracing.config_logger() _MODELS = [ 'step1', ] pipeline.run(models=_MODELS, resume_after=None) table1 = pipeline.get_table("table1").column1 # test that model arg is passed to step pipeline.run_model('step2.table_name=table2') table2 = pipeline.get_table("table2").column1 # try to get a non-existant table with pytest.raises(RuntimeError) as excinfo: pipeline.get_table("bogus") assert "not in checkpointed tables" in str(excinfo.value) # try to get an existing table from a non-existant checkpoint with pytest.raises(RuntimeError) as excinfo: pipeline.get_table("table1", checkpoint_name="bogus") assert "not in checkpoints" in str(excinfo.value) pipeline.close_pipeline() orca.clear_cache() close_handlers()
def test_mini_pipeline_run(): setup_dirs() inject_settings(households_sample_size=HOUSEHOLDS_SAMPLE_SIZE, write_skim_cache=True ) _MODELS = [ 'initialize_landuse', 'compute_accessibility', 'initialize_households', 'school_location', 'workplace_location', 'auto_ownership_simulate' ] pipeline.run(models=_MODELS, resume_after=None) regress_mini_auto() pipeline.run_model('cdap_simulate') pipeline.run_model('mandatory_tour_frequency') regress_mini_mtf() regress_mini_location_choice_logsums() # try to get a non-existant table with pytest.raises(RuntimeError) as excinfo: pipeline.get_table("bogus") assert "never checkpointed" in str(excinfo.value) # try to get an existing table from a non-existant checkpoint with pytest.raises(RuntimeError) as excinfo: pipeline.get_table("households", checkpoint_name="bogus") assert "not in checkpoints" in str(excinfo.value) # should create optional workplace_location_sample table workplace_location_sample_df = pipeline.get_table("workplace_location_sample") assert 'mode_choice_logsum' in workplace_location_sample_df pipeline.close_pipeline() inject.clear_cache() close_handlers()
def test_mp_run(): mp_configs_dir = os.path.join(os.path.dirname(__file__), 'configs_mp') setup_dirs(ancillary_configs_dir=mp_configs_dir) run_list = mp_tasks.get_run_list() mp_tasks.print_run_list(run_list) # do this after config.handle_standard_args, as command line args may override injectables injectables = ['data_dir', 'configs_dir', 'output_dir'] injectables = {k: inject.get_injectable(k) for k in injectables} # pipeline.run(models=run_list['models'], resume_after=run_list['resume_after']) mp_tasks.run_multiprocess(run_list, injectables) pipeline.open_pipeline('_') regress_mini_auto() pipeline.close_pipeline()
def test_mp_run(): setup_dirs() # Debugging ---------------------- run_list = mp_tasks.get_run_list() mp_tasks.print_run_list(run_list) # -------------------------------- # do this after config.handle_standard_args, as command line args # may override injectables injectables = ["data_dir", "configs_dir", "output_dir"] injectables = {k: inject.get_injectable(k) for k in injectables} mp_tasks.run_multiprocess(injectables) pipeline.open_pipeline("_") regress() pipeline.close_pipeline()
def test_full_run1(): configs_dir = os.path.join(os.path.dirname(__file__), 'configs') orca.add_injectable("configs_dir", configs_dir) # data_dir = os.path.join(os.path.dirname(__file__), 'data') data_dir = os.path.join(os.path.dirname(__file__), '..', '..', 'example', 'data') orca.add_injectable("data_dir", data_dir) # scenarios_dir = os.path.join(os.path.dirname(__file__), 'scenarios') scenarios_dir = os.path.join(os.path.dirname(__file__), '..', '..', 'example', 'scenarios') orca.add_injectable("scenarios_dir", scenarios_dir) output_dir = os.path.join(os.path.dirname(__file__), 'output') orca.add_injectable("output_dir", output_dir) orca.clear_cache() tracing.config_logger() # run list from settings file is dict with list of 'steps' and optional 'resume_after' run_list = setting('run_list') assert 'steps' in run_list, "Did not find steps in run_list" # list of steps and possible resume_after in run_list steps = run_list.get('steps') pipeline.run(models=steps, resume_after=None) # geo_crosswalk = pipeline.get_table('geo_crosswalk') # assert geo_crosswalk.index.name == 'TAZ' # assert 'FAF4' in geo_crosswalk.columns # assert 'FIPS' in geo_crosswalk.columns # assert os.path.exists(os.path.join(output_dir, 'naics_set.csv')) # tables will no longer be available after pipeline is closed pipeline.close_pipeline() orca.clear_cache()
def test_mini_pipeline_run(): configs_dir = os.path.join(os.path.dirname(__file__), 'configs') setup_dirs(configs_dir) inject_settings(configs_dir, households_sample_size=HOUSEHOLDS_SAMPLE_SIZE, # use_shadow_pricing=True ) _MODELS = [ 'initialize_landuse', 'compute_accessibility', 'initialize_households', 'school_location', 'workplace_location', 'auto_ownership_simulate' ] pipeline.run(models=_MODELS, resume_after=None) regress_mini_auto() pipeline.run_model('cdap_simulate') pipeline.run_model('mandatory_tour_frequency') regress_mini_mtf() # try to get a non-existant table with pytest.raises(RuntimeError) as excinfo: pipeline.get_table("bogus") assert "never checkpointed" in str(excinfo.value) # try to get an existing table from a non-existant checkpoint with pytest.raises(RuntimeError) as excinfo: pipeline.get_table("households", checkpoint_name="bogus") assert "not in checkpoints" in str(excinfo.value) pipeline.close_pipeline() inject.clear_cache() close_handlers()
def test_full_run_3_zone(): tour_count = full_run(configs_dir=[ example_path('configs_3_zone'), mtc_example_path('configs') ], data_dir=example_path('data_3'), trace_hh_id=HH_ID_3_ZONE, check_for_variability=True, households_sample_size=HOUSEHOLDS_SAMPLE_SIZE_3_ZONE, two_zone=False) print("tour_count", tour_count) assert(tour_count == EXPECT_3_ZONE_TOUR_COUNT), \ "EXPECT_3_ZONE_TOUR_COUNT %s but got tour_count %s" % (EXPECT_3_ZONE_TOUR_COUNT, tour_count) regress_3_zone() pipeline.close_pipeline()
def test_load_cached_accessibility(): inject.clear_cache() inject.reinject_decorated_tables() data_dir = [ os.path.join(os.path.dirname(__file__), 'data'), example_path('data') ] setup_dirs(data_dir=data_dir) # # add OPTIONAL ceched table accessibility to input_table_list # activitysim.abm.tables.land_use.accessibility() will load this table if listed here # presumably independently calculated outside activitysim or a cached copy created during a previous run # settings = config.read_settings_file('settings.yaml', mandatory=True) input_table_list = settings.get('input_table_list') input_table_list.append({ 'tablename': 'accessibility', 'filename': 'cached_accessibility.csv', 'index_col': 'zone_id' }) inject_settings(households_sample_size=HOUSEHOLDS_SAMPLE_SIZE, input_table_list=input_table_list) _MODELS = [ 'initialize_landuse', # 'compute_accessibility', # we load accessibility table ordinarily created by compute_accessibility 'initialize_households', ] pipeline.run(models=_MODELS, resume_after=None) accessibility_df = pipeline.get_table("accessibility") assert 'auPkRetail' in accessibility_df pipeline.close_pipeline() inject.clear_cache() close_handlers()
def run(): config.handle_standard_args() # specify None for a pseudo random base seed # inject.add_injectable('rng_base_seed', 0) tracing.config_logger() config.filter_warnings() tracing.delete_csv_files() # If you provide a resume_after argument to pipeline.run # the pipeline manager will attempt to load checkpointed tables from the checkpoint store # and resume pipeline processing on the next submodel step after the specified checkpoint resume_after = setting('resume_after', None) if resume_after: print("resume_after", resume_after) pipeline.run(models=setting('models'), resume_after=resume_after) # tables will no longer be available after pipeline is closed pipeline.close_pipeline()