diff --git a/.github/workflows/branch-docs.yml b/.github/workflows/branch-docs.yml index 7a4ab1f1c..6447d047d 100644 --- a/.github/workflows/branch-docs.yml +++ b/.github/workflows/branch-docs.yml @@ -15,7 +15,7 @@ jobs: run: shell: bash -l {0} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # get all tags, lets setuptools_scm do its thing diff --git a/.github/workflows/build_installer.yml b/.github/workflows/build_installer.yml index e6efa4814..cea4feca6 100644 --- a/.github/workflows/build_installer.yml +++ b/.github/workflows/build_installer.yml @@ -26,7 +26,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - uses: conda-incubator/setup-miniconda@v3 with: @@ -47,7 +47,7 @@ jobs: shell: bash - name: Upload installer to Github artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: path: build/Activitysim-${{ inputs.version }}-${{ matrix.OS_NAME }}-${{ matrix.ARCH }}* name: Activitysim-${{ inputs.version }}-${{ matrix.OS_NAME }}-${{ matrix.ARCH }} diff --git a/.github/workflows/core_tests.yml b/.github/workflows/core_tests.yml index 134242cd6..8339dfbbe 100644 --- a/.github/workflows/core_tests.yml +++ b/.github/workflows/core_tests.yml @@ -26,13 +26,11 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Mambaforge + - name: Setup Miniforge uses: conda-incubator/setup-miniconda@v3 with: - miniforge-variant: Mambaforge miniforge-version: latest activate-environment: asim-test - use-mamba: true python-version: ${{ matrix.python-version }} - name: Set cache date for year and month @@ -46,7 +44,7 @@ jobs: - name: Update environment run: | - mamba env update -n asim-test -f conda-environments/github-actions-tests.yml + conda env update -n asim-test -f conda-environments/github-actions-tests.yml if: steps.cache.outputs.cache-hit != 'true' - name: Install activitysim @@ -58,8 +56,8 @@ jobs: - name: Conda checkup run: | - mamba info -a - mamba list + conda info -a + conda list - name: Lint with Black run: | @@ -111,13 +109,11 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Mambaforge + - name: Setup Miniforge uses: conda-incubator/setup-miniconda@v3 with: - miniforge-variant: Mambaforge miniforge-version: latest activate-environment: asim-test - use-mamba: true python-version: ${{ matrix.python-version }} - name: Set cache date for year and month @@ -131,7 +127,7 @@ jobs: - name: Update environment run: | - mamba env update -n asim-test -f conda-environments/github-actions-tests.yml + conda env update -n asim-test -f conda-environments/github-actions-tests.yml if: steps.cache.outputs.cache-hit != 'true' - name: Install activitysim @@ -143,8 +139,8 @@ jobs: - name: Conda checkup run: | - mamba info -a - mamba list + conda info -a + conda list - name: Lint with Black run: | @@ -194,13 +190,11 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Mambaforge + - name: Setup Miniforge uses: conda-incubator/setup-miniconda@v3 with: - miniforge-variant: Mambaforge miniforge-version: latest activate-environment: asim-test - use-mamba: true python-version: ${{ env.python-version }} - name: Set cache date for year and month @@ -214,7 +208,7 @@ jobs: - name: Update environment run: | - mamba env update -n asim-test -f conda-environments/github-actions-tests.yml + conda env update -n asim-test -f conda-environments/github-actions-tests.yml if: steps.cache.outputs.cache-hit != 'true' - name: Install activitysim @@ -226,8 +220,8 @@ jobs: - name: Conda checkup run: | - mamba info -a - mamba list + conda info -a + conda list # TODO: Cache sharrow compiled flows? The contents of __pycache__ appear to # be ignored, so this is not working as expected right now @@ -282,13 +276,11 @@ jobs: - name: Checkout ActivitySim uses: actions/checkout@v4 - - name: Setup Mambaforge + - name: Setup Miniforge uses: conda-incubator/setup-miniconda@v3 with: - miniforge-variant: Mambaforge miniforge-version: latest activate-environment: asim-test - use-mamba: true python-version: ${{ env.python-version }} - name: Set cache date for year and month @@ -304,7 +296,7 @@ jobs: - name: Update environment run: | - mamba env update -n asim-test -f conda-environments/github-actions-tests.yml + conda env update -n asim-test -f conda-environments/github-actions-tests.yml if: steps.cache.outputs.cache-hit != 'true' - name: Install activitysim @@ -316,8 +308,8 @@ jobs: - name: Conda checkup run: | - mamba info -a - mamba list + conda info -a + conda list - name: Checkout Example uses: actions/checkout@v4 @@ -345,13 +337,11 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Mambaforge + - name: Setup Miniforge uses: conda-incubator/setup-miniconda@v3 with: - miniforge-variant: Mambaforge miniforge-version: latest activate-environment: asim-test - use-mamba: true python-version: ${{ env.python-version }} - name: Set cache date for year and month @@ -365,7 +355,7 @@ jobs: - name: Update environment run: | - mamba env update -n asim-test -f conda-environments/github-actions-tests.yml + conda env update -n asim-test -f conda-environments/github-actions-tests.yml if: steps.cache.outputs.cache-hit != 'true' - name: Install activitysim @@ -377,8 +367,8 @@ jobs: - name: Conda checkup run: | - mamba info -a - mamba list + conda info -a + conda list - name: Test Random Seed Generation run: | @@ -392,18 +382,16 @@ jobs: defaults: run: shell: bash -l {0} - name: estimation_mode_test + name: Estimation Mode Unit Tests runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Setup Mambaforge + - name: Setup Miniforge uses: conda-incubator/setup-miniconda@v3 with: - miniforge-variant: Mambaforge miniforge-version: latest activate-environment: asim-test - use-mamba: true python-version: ${{ env.python-version }} - name: Set cache date for year and month @@ -417,7 +405,7 @@ jobs: - name: Update environment run: | - mamba env update -n asim-test -f conda-environments/github-actions-tests.yml + conda env update -n asim-test -f conda-environments/github-actions-tests.yml if: steps.cache.outputs.cache-hit != 'true' - name: Install Larch @@ -432,8 +420,8 @@ jobs: - name: Conda checkup run: | - mamba info -a - mamba list + conda info -a + conda list - name: Test Estimation Mode run: | @@ -452,15 +440,13 @@ jobs: with: fetch-depth: 0 # get all tags, lets setuptools_scm do its thing - name: Set up Python 3.10 - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: "3.10" - name: Install dependencies uses: conda-incubator/setup-miniconda@v3 with: - miniforge-variant: Mambaforge miniforge-version: latest - use-mamba: true environment-file: conda-environments/docbuild.yml python-version: "3.10" activate-environment: docbuild diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 2a0ef70c3..10652bba4 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -13,10 +13,10 @@ jobs: runs-on: ubuntu-latest if: github.repository == 'ActivitySim/activitysim' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 name: Install Python with: python-version: "3.10" @@ -39,7 +39,7 @@ jobs: else echo "✅ Looks good" fi - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: releases path: dist @@ -48,11 +48,11 @@ jobs: needs: build-artifacts runs-on: ubuntu-latest steps: - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 name: Install Python with: python-version: "3.10" - - uses: actions/download-artifact@v4.1.7 + - uses: actions/download-artifact@v4 with: name: releases path: dist @@ -84,13 +84,13 @@ jobs: run: shell: bash -l {0} steps: - - uses: actions/checkout@v3 - - uses: actions/download-artifact@v4.1.7 + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 with: name: releases path: dist - name: Set up Python 3.10 - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: "3.10" - name: Install dependencies @@ -132,7 +132,7 @@ jobs: if: github.event_name == 'release' runs-on: ubuntu-latest steps: - - uses: actions/download-artifact@v4.1.7 + - uses: actions/download-artifact@v4 with: name: releases path: dist diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml index b4dbced25..bbcd938b3 100644 --- a/.github/workflows/test-deploy.yml +++ b/.github/workflows/test-deploy.yml @@ -12,10 +12,10 @@ jobs: build-artifacts: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 name: Install Python with: python-version: "3.10" @@ -43,7 +43,7 @@ jobs: else echo "✅ Looks good" fi - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: releases path: dist @@ -52,11 +52,11 @@ jobs: needs: build-artifacts runs-on: ubuntu-latest steps: - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 name: Install Python with: python-version: "3.10" - - uses: actions/download-artifact@v4.1.7 + - uses: actions/download-artifact@v4 with: name: releases path: dist diff --git a/activitysim/abm/models/util/logsums.py b/activitysim/abm/models/util/logsums.py index a13b34344..f9e4208f0 100644 --- a/activitysim/abm/models/util/logsums.py +++ b/activitysim/abm/models/util/logsums.py @@ -167,7 +167,10 @@ def compute_location_choice_logsums( ) nest_spec = config.get_logit_model_settings(logsum_settings) - nest_spec = simulate.eval_nest_coefficients(nest_spec, coefficients, trace_label) + if nest_spec is not None: # nest_spec is None for MNL + nest_spec = simulate.eval_nest_coefficients( + nest_spec, coefficients, trace_label + ) locals_dict = {} # model_constants can appear in expressions diff --git a/activitysim/core/configuration/filesystem.py b/activitysim/core/configuration/filesystem.py index b55f0c496..704e179a1 100644 --- a/activitysim/core/configuration/filesystem.py +++ b/activitysim/core/configuration/filesystem.py @@ -134,6 +134,18 @@ def _parse_arg(name, x): return self + def parse_settings(self, settings): + def _parse_setting(name, x): + v = getattr(settings, x, None) + if v is not None: + setattr(self, name, v) + + _parse_setting("cache_dir", "cache_dir") + _parse_setting("sharrow_cache_dir", "sharrow_cache_dir") + _parse_setting("profile_dir", "profile_dir") + _parse_setting("pipeline_file_name", "pipeline_file_name") + return + def get_working_subdir(self, subdir) -> Path: if self.working_dir: return self.working_dir.joinpath(subdir) diff --git a/activitysim/core/mp_tasks.py b/activitysim/core/mp_tasks.py index db92be1da..7d31134bc 100644 --- a/activitysim/core/mp_tasks.py +++ b/activitysim/core/mp_tasks.py @@ -887,6 +887,7 @@ def setup_injectables_and_logging(injectables, locutor: bool = True) -> workflow state = workflow.State() state = state.initialize_filesystem(**injectables) state.settings = injectables.get("settings", Settings()) + state.filesystem.parse_settings(state.settings) # register abm steps and other abm-specific injectables # by default, assume we are running activitysim.abm diff --git a/activitysim/core/workflow/state.py b/activitysim/core/workflow/state.py index f21810bb5..dd8153460 100644 --- a/activitysim/core/workflow/state.py +++ b/activitysim/core/workflow/state.py @@ -478,15 +478,12 @@ def load_settings(self) -> State: include_stack=False, ) - # the settings can redefine the cache directories. - cache_dir = raw_settings.pop("cache_dir", None) - if cache_dir: - if self.filesystem.cache_dir != cache_dir: - logger.warning(f"settings file changes cache_dir to {cache_dir}") - self.filesystem.cache_dir = cache_dir settings_class = self.__class__.settings.member_type self.settings: Settings = settings_class.model_validate(raw_settings) + # need to parse any filesystem settings set in the settings file itself + self.filesystem.parse_settings(self.settings) + extra_settings = set(self.settings.__dict__) - set(settings_class.__fields__) if extra_settings: diff --git a/docs/users-guide/example_performance.md b/docs/users-guide/example_performance.md index a1d694dd3..4e1c2bf29 100644 --- a/docs/users-guide/example_performance.md +++ b/docs/users-guide/example_performance.md @@ -219,7 +219,7 @@ See more complete results and discussion | write tables | 8.1 | 7.9 | 7.8 | 7.7 | 7.3 | 7.5 | | Total Runtime | 309.5 | 211.4 | 186.2 | 182.4 | 177.3 | 180 | -### Single Process, Sharrow Disabled +### Multiprocessing, Sharrow Disabled The following performance metrics were collected for the SANDAG example model, running on a Windows server with 24 cores and 500GB of RAM (same as the results above), diff --git a/docs/users-guide/modelsetup.rst b/docs/users-guide/modelsetup.rst index 9cd2c01ff..3ba8c650a 100644 --- a/docs/users-guide/modelsetup.rst +++ b/docs/users-guide/modelsetup.rst @@ -156,7 +156,7 @@ This method is recommended for ActivitySim users who also wish to customize the 2. Create a conda environment (basically a Python install just for this project) using mambaforge prompt or conda prompt depending on the package manager you use (on Windows) or the terminal (macOS or Linux):: - mamba create -n asim python=3.9 activitysim -c conda-forge --override-channels + mamba create -n asim python=3.10 activitysim -c conda-forge --override-channels This command will create the environment and install all the dependencies required for running ActivitySim. It is only necessary to create the environment @@ -164,7 +164,7 @@ once per machine, you do not need to (re)create the environment for each session If you would also like to install other tools or optional dependencies, it is possible to do so by adding additional libraries to this command. For example:: - mamba create -n asim python=3.9 activitysim jupyterlab larch -c conda-forge --override-channels + mamba create -n asim python=3.10 activitysim jupyterlab larch -c conda-forge --override-channels This example installs a specific version of Python, version 3.9. A similar approach can be used to install specific versions of other libraries as well,