ActivitySim / activitysim

An Open Platform for Activity-Based Travel Modeling
https://activitysim.github.io
BSD 3-Clause "New" or "Revised" License
189 stars 96 forks source link

Benchmarking failure with fresh new install #831

Open i-am-sijia opened 3 months ago

i-am-sijia commented 3 months ago

Describe the bug With a fresh new installation of ActivitySim, Benchmarking run fails in the compile mode (probably also fails in sharrow and legacy mode). We tested this a few times on different machines, having the same error. Log file is attached.

activitysim.log

It was all working earlier last week, so something must have happened in the past week or two that have broken this. Hypotheses:

  1. could be some updated version of dependencies
  2. could be code changes we made in the past 1-2 weeks, if any
  3. could be data and config changes we made in the past 1-2 weeks, if any

Since it crashed in input checker, item 2 and 3 are maybe less likely.

To Reproduce Steps to reproduce the behavior:

  1. Installation
  2. Benchmarking

Expected behavior Run should not fail.

Screenshots

12/03/2024 10:53:36.278 - WARNING - activitysim.abm.models.input_checker - Encountered 0 errors and 4 warnings in table households
12/03/2024 10:53:36.278 - WARNING - activitysim.abm.models.input_checker - Encountered 0 errors and 3 warnings in table persons
12/03/2024 10:53:36.278 - WARNING - activitysim.abm.models.input_checker - Encountered 0 errors and 2 warnings in table land_use
12/03/2024 10:53:36.278 - INFO - activitysim.abm.models.input_checker - Encountered 0 errors and 0 warnings in table example_hwy_data
12/03/2024 10:53:36.278 - ERROR - root - ===== ERROR IN input_checker =====
12/03/2024 10:53:36.278 - ERROR - root - list index out of range
Traceback (most recent call last):
  File "C:\Users\USAP093587\workspace\ActivitySim\activitysim\core\workflow\steps.py", line 46, in wrapper
    return func(*args, **kwargs)
  File "C:\Users\USAP093587\workspace\ActivitySim\activitysim\abm\models\input_checker.py", line 453, in input_checker
    input_check_failure = report_errors(
  File "C:\Users\USAP093587\workspace\ActivitySim\activitysim\abm\models\input_checker.py", line 314, in report_errors
    + str(warn.message)
IndexError: list index out of range
12/03/2024 10:53:36.297 - ERROR - root - ===== / =====
12/03/2024 10:53:36.297 - NOTIFY - activitysim.core.workflow.runner -  time to execute run.input_checker UNTIL ERROR : 12.353 seconds
12/03/2024 10:53:36.297 - INFO - activitysim.core.tracing - Time to execute all models until this error : 12.386 seconds (0.2 minutes)
12/03/2024 10:53:36.297 - ERROR - activitysim.cli.run - activitysim run encountered an unrecoverable error
Traceback (most recent call last):
  File "C:\Users\USAP093587\workspace\ActivitySim\activitysim\cli\run.py", line 396, in run
    state.run(
  File "C:\Users\USAP093587\workspace\ActivitySim\activitysim\core\workflow\runner.py", line 173, in __call__
    self.by_name(model)
  File "C:\Users\USAP093587\workspace\ActivitySim\activitysim\core\workflow\runner.py", line 350, in by_name
    self._obj._context = run_named_step(
  File "C:\Users\USAP093587\workspace\ActivitySim\activitysim\core\workflow\steps.py", line 83, in run_named_step
    step_func(context, **kwargs)
  File "C:\Users\USAP093587\workspace\ActivitySim\activitysim\core\workflow\steps.py", line 367, in run_step
    outcome = error_logging(wrapped_func)(state, *args, **kwargs)
  File "C:\Users\USAP093587\workspace\ActivitySim\activitysim\core\workflow\steps.py", line 46, in wrapper
    return func(*args, **kwargs)
  File "C:\Users\USAP093587\workspace\ActivitySim\activitysim\abm\models\input_checker.py", line 453, in input_checker
    input_check_failure = report_errors(
  File "C:\Users\USAP093587\workspace\ActivitySim\activitysim\abm\models\input_checker.py", line 314, in report_errors
    + str(warn.message)
IndexError: list index out of range

Additional context Add any other context about the problem here. @lachlan-git please provide additional context and debugging if available.

lachlan-git commented 3 months ago

Issue Caused by update in pandera package.

The pandera 0.18.3 changed textual format of warning/error messages, causing parsing errors in activitysim\activitysim\abm\models\input_checker.py.

FIX: pandera forced <0.18.1 in environment file, to ensure data checking warning/error messages are parsed correctly

NOTE: pydantic was also frozen to 2.6.0 to avoid future errors.

jpn-- commented 3 months ago

It appears this crash is a result of a failure in the parsing of the error message emitted from pandera. It seems our parsing is done based on fairly detailed re-formatting of the error message. But the essence of the problem isn't anything wrong with pandera emitting the error or ActivitySim catching it, it's just failing in reformatting the message for the error log.

Rather than pinning to a fixed pandera version, should we just allow ActivitySim to fall back to sending pandara's raw error message to our own log? And then we can also perhaps fix out code so the error message parse/reformat isn't so fragile.

jpn-- commented 3 months ago

As they have the most knowledge about why it was written the way it was, I am assigning @dhensle or his designee from RSG to fix the input checker error message parsing so that it is compatible with pandera >= 0.18.1, and in the meantime we will pin to the compatible version of pandera. This update is not urgent but should not be forgotten.