activitysim icon indicating copy to clipboard operation
activitysim copied to clipboard

shadow_pricing.yaml required when work and school location models aren't being run.

Open JoeJimFlood opened this issue 11 months ago • 0 comments

Describe the bug SANDAG's visitor and airport access models do not run work or school location as the former is for non-residents of San Diego spending the day in the area and the latter is just for trips to or from the airports. However, the recent 1.3 upgrade requires that a shadow_pricing.yaml file be present even if no model components using shadow pricing are being run. Adding blank shadow_pricing.yaml files to configs is a sufficient workaround, but this is not ideal.

I suspect that adding a conditional statement to check if work or school location is being run before this block of code would fix the issue, but I won't be able to test this for a few weeks.

To Reproduce Steps to reproduce the behavior:

  1. Set up an ActivitySim model that does not include work or school location in the model steps.
  2. Ensure that there is no file called "shadow_pricing.yaml" in the configs.
  3. Run the model. It should crash early on due to the file not being there.

Expected behavior If work and school location are both not being run, then the model should work if there is no shadow_pricing.yaml file as it is not needed.

Screenshots Error message with traceback:

Traceback (most recent call last):
  File "\\JUPITER\ABM\user\jflo\repos\asim132\activitysim\cli\run.py", line 388, in run
    mp_tasks.run_multiprocess(state, injectables)
  File "\\JUPITER\ABM\user\jflo\repos\asim132\activitysim\core\mp_tasks.py", line 1634, in run_multiprocess
    shared_data_buffers.update(allocate_shared_shadow_pricing_buffers(state))
  File "\\JUPITER\ABM\user\jflo\repos\asim132\activitysim\core\mp_tasks.py", line 1234, in allocate_shared_shadow_pricing_buffers
    shadow_pricing_info = state.get_injectable("shadow_pricing_info", None)
  File "\\JUPITER\ABM\user\jflo\repos\asim132\activitysim\core\workflow\state.py", line 791, in get
    result = self._LOADABLE_OBJECTS[key](self._context)
  File "\\JUPITER\ABM\user\jflo\repos\asim132\activitysim\core\workflow\steps.py", line 367, in run_step
    outcome = error_logging(wrapped_func)(state, *args, **kwargs)
  File "\\JUPITER\ABM\user\jflo\repos\asim132\activitysim\core\workflow\steps.py", line 46, in wrapper
    return func(*args, **kwargs)
  File "\\JUPITER\ABM\user\jflo\repos\asim132\activitysim\abm\tables\shadow_pricing.py", line 1546, in shadow_pricing_info
    return get_shadow_pricing_info(state)
  File "\\JUPITER\ABM\user\jflo\repos\asim132\activitysim\abm\tables\shadow_pricing.py", line 1465, in get_shadow_pricing_info
    shadow_settings = ShadowPriceSettings.read_settings_file(
  File "\\JUPITER\ABM\user\jflo\repos\asim132\activitysim\core\configuration\base.py", line 98, in read_settings_file
    return filesystem.read_settings_file(
  File "\\JUPITER\ABM\user\jflo\repos\asim132\activitysim\core\configuration\filesystem.py", line 824, in read_settings_file
    raise SettingsFileNotFoundError(file_name, configs_dir_list)
activitysim.core.exceptions.SettingsFileNotFoundError: "Settings file 'shadow_pricing.yaml' not found in (WindowsPath('abm/src/asim/configs/visitor'), WindowsPath('abm/src/asim/configs/common'))"

JoeJimFlood avatar Dec 18 '24 19:12 JoeJimFlood