Skip to content

Commit

Permalink
Merge branch 'main' into location_choice_logsum_est_mode
Browse files Browse the repository at this point in the history
  • Loading branch information
jpn-- authored Dec 13, 2024
2 parents 4bc5296 + 171f172 commit bde106f
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 67 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/branch-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build_installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: conda-incubator/setup-miniconda@v3
with:
Expand All @@ -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 }}
Expand Down
66 changes: 26 additions & 40 deletions .github/workflows/core_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -58,8 +56,8 @@ jobs:
- name: Conda checkup
run: |
mamba info -a
mamba list
conda info -a
conda list
- name: Lint with Black
run: |
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -143,8 +139,8 @@ jobs:
- name: Conda checkup
run: |
mamba info -a
mamba list
conda info -a
conda list
- name: Lint with Black
run: |
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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: |
Expand All @@ -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
Expand All @@ -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
Expand All @@ -432,8 +420,8 @@ jobs:
- name: Conda checkup
run: |
mamba info -a
mamba list
conda info -a
conda list
- name: Test Estimation Mode
run: |
Expand All @@ -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
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
5 changes: 4 additions & 1 deletion activitysim/abm/models/util/logsums.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions activitysim/core/configuration/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions activitysim/core/mp_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit bde106f

Please sign in to comment.