Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow multiple Lawrencium runs #48

Open
wants to merge 186 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
186 commits
Select commit Hold shift + click to select a range
4d10084
use absolute path for separate output locations
zneedell Apr 1, 2024
7a29e8e
update scratch location
zneedell Apr 1, 2024
b9fe334
fixes
zneedell Apr 1, 2024
6b6626c
fixes
zneedell Apr 1, 2024
ed7019e
point asim_pre to right output directory
zneedell Apr 2, 2024
9157536
fix path for asim docker vols
zneedell Apr 2, 2024
11752cb
output loc fixes
zneedell Apr 3, 2024
ef60f5e
logging
zneedell Apr 3, 2024
e713bf9
taz column fixes
zneedell Apr 3, 2024
0069685
docker mount fixes
zneedell Apr 3, 2024
19465be
bugfix
zneedell Apr 3, 2024
76bc6a1
bugfix
zneedell Apr 3, 2024
54eb0ab
move asim files to correct location
zneedell Apr 4, 2024
eab7196
allow adding alternate current_stage.yaml file path as argument to ru…
zneedell Apr 4, 2024
ba24429
pass args via job runner script
zneedell Apr 4, 2024
17d1a62
bugfixes
zneedell Apr 4, 2024
0f7ab2e
bugfixes
zneedell Apr 4, 2024
e242b84
correct beam mutable loc
zneedell Apr 4, 2024
f3fc2c9
correct beam mutable loc
zneedell Apr 4, 2024
b87bcec
catch logging errors
zneedell Apr 5, 2024
4a68327
fix path for beam postprocessor
zneedell Apr 8, 2024
e1e8d3f
fix path for beam output moving
zneedell Apr 11, 2024
14ef49b
fix path for beam output moving
zneedell Apr 11, 2024
5ba8e91
fix path for beam output moving
zneedell Apr 12, 2024
98b283b
fix path for beam output moving
zneedell Apr 12, 2024
b18a708
pass full state to function
zneedell Apr 12, 2024
9ad26e9
make sure working_dir is defined
zneedell Apr 12, 2024
9987cd6
seattle configs
zneedell Apr 15, 2024
286f780
seattle configs
zneedell Apr 15, 2024
dda5904
fix to getopts
zneedell Apr 15, 2024
93300ef
fix to state.year
zneedell Apr 15, 2024
bf682cb
fix to creating skims
zneedell Apr 15, 2024
b544a1e
fix to creating skims
zneedell Apr 15, 2024
73c8a85
fix to creating skims
zneedell Apr 15, 2024
1fc111a
fix to creating skims
zneedell Apr 15, 2024
cac0fdd
fix to creating skims
zneedell Apr 16, 2024
6ee4c37
lawrencium fixes
zneedell Apr 16, 2024
61a9322
fix skims loc
zneedell Apr 27, 2024
62739cf
switch back to state.year for asim out file name
zneedell Apr 29, 2024
96e35de
update upload shell script
zneedell Apr 30, 2024
cf21f1e
update upload shell script
zneedell Apr 30, 2024
e7ecd30
update upload shell script
zneedell Apr 30, 2024
81d9e93
null config
zneedell May 17, 2024
ceded89
null config update
zneedell May 17, 2024
c6d69cb
copy atlas files over to mutable loc
zneedell Jun 12, 2024
2bd285e
stop clearing plans between years
zneedell Jun 12, 2024
24a37d8
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 12, 2024
39d3312
atlas fixes
zneedell Jun 12, 2024
eaf253d
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 12, 2024
481b13a
urbansim fixes
zneedell Jun 14, 2024
921fc36
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 14, 2024
d97539d
urbansim fixes
zneedell Jun 14, 2024
5f67330
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 14, 2024
e826af7
urbansim fixes
zneedell Jun 14, 2024
f5e6961
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 14, 2024
0fe5025
urbansim fixes
zneedell Jun 14, 2024
17b2eca
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 14, 2024
0e46621
urbansim fixes
zneedell Jun 14, 2024
7f7aff8
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 14, 2024
3e1897c
bugfix
zneedell Jun 14, 2024
ede0ba8
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 14, 2024
d5e558e
bugfix
zneedell Jun 14, 2024
9f9a965
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 14, 2024
5ac3853
bugfix
zneedell Jun 14, 2024
a2bf70f
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 14, 2024
81c52c4
bugfix
zneedell Jun 14, 2024
debc956
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 14, 2024
498c272
fixes for usim output loc
zneedell Jun 17, 2024
34f0b1e
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 17, 2024
7170d52
bugfix
zneedell Jun 17, 2024
e6f7618
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 17, 2024
3eaf71a
mutable configs loc
zneedell Jun 17, 2024
83cde71
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 17, 2024
3b48aca
mutable configs loc
zneedell Jun 17, 2024
e5fbc8a
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 17, 2024
6d64fe4
include initial step for atlas
zneedell Jun 18, 2024
ce43853
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 18, 2024
5318631
include initial step for atlas
zneedell Jun 18, 2024
2bf4b57
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 18, 2024
104e3b1
fixes
zneedell Jun 18, 2024
6387bd3
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 18, 2024
66e2c38
fixes
zneedell Jun 18, 2024
ae9fd2f
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 18, 2024
fa12eb2
fixes
zneedell Jun 18, 2024
37b41a3
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 18, 2024
5267388
fixes
zneedell Jun 18, 2024
798eabe
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 18, 2024
7e47ce8
fixes
zneedell Jun 18, 2024
bb75b6e
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 18, 2024
d351e3d
fixes
zneedell Jun 18, 2024
1ee346e
fixes
zneedell Jun 18, 2024
f4a6e95
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 18, 2024
5f061c9
fixes
zneedell Jun 18, 2024
722458a
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 18, 2024
16b5895
fixes
zneedell Jun 18, 2024
57dde5d
fixes
zneedell Jun 18, 2024
37bfab4
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 18, 2024
3674e26
fixes
zneedell Jun 19, 2024
b6eb08d
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 19, 2024
4c0b5ab
fixes
zneedell Jun 19, 2024
b30a5f9
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 19, 2024
cf94a7d
fixes
zneedell Jun 19, 2024
fc07c3e
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 19, 2024
f4b5dbe
fixes
zneedell Jun 19, 2024
e65c5ec
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 19, 2024
88e7525
fixes
zneedell Jun 19, 2024
46f317b
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 19, 2024
b85e0b8
fixes
zneedell Jun 19, 2024
1f6c9d9
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 19, 2024
f48e00d
fixes
zneedell Jun 19, 2024
bb14f47
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 19, 2024
a0d876a
fixes
zneedell Jun 19, 2024
cdc8f13
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 19, 2024
446f72d
fixes
zneedell Jun 19, 2024
e8af1ca
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 19, 2024
50e437f
fixes
zneedell Jun 19, 2024
1432703
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 19, 2024
24d771a
fixes
zneedell Jun 19, 2024
3e246ec
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 19, 2024
be76ded
fixes
zneedell Jun 19, 2024
da2b447
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 19, 2024
859ff83
fixes
zneedell Jun 19, 2024
85d8591
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 19, 2024
0a9d23f
fixes
zneedell Jun 19, 2024
809e6ba
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 19, 2024
ac86cde
fixes
zneedell Jun 19, 2024
e251a42
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 19, 2024
1c40689
fixes
zneedell Jun 19, 2024
17b7daf
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 19, 2024
b036686
fixes
zneedell Jun 20, 2024
5e7c59f
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 20, 2024
ccdcfa0
fixes
zneedell Jun 20, 2024
d54638f
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 20, 2024
8a6fd0e
fixes
zneedell Jun 20, 2024
47af510
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 20, 2024
b72984c
fixes
zneedell Jun 20, 2024
7c038fa
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 20, 2024
5a72751
fixes
zneedell Jun 20, 2024
614e882
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 20, 2024
1b38523
fixes
zneedell Jun 20, 2024
503480c
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 20, 2024
69fa231
fixes
zneedell Jun 20, 2024
b224a27
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 20, 2024
ec2cf93
fixes
zneedell Jun 20, 2024
7d94060
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 20, 2024
1012e88
fixes
zneedell Jun 20, 2024
c8b39cc
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 20, 2024
ae79b45
fixes
zneedell Jun 20, 2024
b0f6e16
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 20, 2024
456d487
fixes
zneedell Jun 21, 2024
2d0b734
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 21, 2024
dafca08
fixes
zneedell Jun 24, 2024
79d8ef2
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 24, 2024
a7b3a44
fixes
zneedell Jun 24, 2024
2d8c2c2
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 24, 2024
c3b690b
ugggghhhh!
zneedell Jun 24, 2024
394c673
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 24, 2024
aae76b3
~ fixes
zneedell Jun 24, 2024
57e2563
~ fixes
zneedell Jun 25, 2024
6c1805a
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 25, 2024
5c3eed6
float to int
zneedell Jun 26, 2024
108be51
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 26, 2024
af5ccc0
float to int
zneedell Jun 27, 2024
35b5227
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 27, 2024
8852199
atlas input loc fix
zneedell Jun 27, 2024
ed21d5d
atlas input loc fix
zneedell Jun 27, 2024
141e28f
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 27, 2024
fc60085
atlas input loc fix
zneedell Jun 28, 2024
fb449cd
Merge branch 'copy-working-directory' of https://github.com/LBNL-UCB-…
zneedell Jun 28, 2024
1e6b304
updates
zneedell Jul 1, 2024
a72173f
fix for just asim/beam runs
zneedell Jul 9, 2024
c92553d
Merge remote-tracking branch 'lbl/copy-working-directory' into copy-w…
zneedell Jul 9, 2024
fb5fdf7
fix for just asim/beam runs
zneedell Jul 9, 2024
9bdccfa
fix for just asim/beam runs
zneedell Jul 9, 2024
5f808ea
fix for just asim/beam runs
zneedell Jul 9, 2024
3545aa7
pandas version fix
zneedell Jul 9, 2024
be4662c
pandas version fix
zneedell Jul 9, 2024
fefc324
pandas version fix (ugly)
zneedell Jul 9, 2024
dac4bc1
preprocessor ptype fix (ugh)
zneedell Jul 9, 2024
24b2dc0
beam postprocessor bug fix
zneedell Jul 11, 2024
05d8f7e
Update lawrencium-setup.md
zneedell Jul 22, 2024
2534db6
pick up in the middle of replanning
zneedell Jul 23, 2024
0e7c0dd
Merge remote-tracking branch 'lbl/copy-working-directory' into copy-w…
zneedell Jul 23, 2024
5028631
bug
zneedell Jul 23, 2024
b3b6086
bug
zneedell Jul 23, 2024
2bfcc26
bug
zneedell Jul 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion hpc/job.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@ module load python/3.8.8
#pip install --user geopandas
export PYTHONPATH=`python -m site --user-site`:$PYTHONPATH
cd /global/scratch/users/$USER/sources/PILATES
python run.py -v
echo "$1"



python run.py -c "$1" -S "$2"

20 changes: 18 additions & 2 deletions hpc/job_runner.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
#!/bin/bash


RANDOM_PART="$(tr -dc A-Z0-9 </dev/urandom | head -c 8)"
DATETIME="$(date "+%Y.%m.%d-%H.%M.%S")"
JOB_NAME="$RANDOM_PART.$DATETIME"

settings_file="settings.yaml"
stage_file="current_stage_${JOB_NAME}.yaml"
while getopts :c:s: name
do
case $name in
c) cflag=1
settings_file="$OPTARG";;
s) sflag=1
stage_file="$OPTARG";;
?) printf "Usage: %s: [-c settings/config file loc] [-s stage file loc] args\n" $0
exit 2;;
esac
done


PARTITION="lr7"
QOS="lr_normal"
NUM_CPUS=50
MEMORY_LIMIT="240"
MEMORY_LIMIT="250"
ACCOUNT="pc_beamcore"
JOB_LOG_FILE_PATH="/global/scratch/users/$USER/pilates_logs/log_${DATETIME}_${RANDOM_PART}.log"
EXPECTED_EXECUTION_DURATION="2-00:00:00"
Expand All @@ -23,6 +39,6 @@ sbatch --partition="$PARTITION" \
--job-name="$JOB_NAME" \
--output="$JOB_LOG_FILE_PATH" \
--time="$EXPECTED_EXECUTION_DURATION" \
job.sh
job.sh "$settings_file" "$stage_file"

echo $JOB_LOG_FILE_PATH
16 changes: 12 additions & 4 deletions lawrencium-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,21 @@
cd /global/scratch/users/$USER
mkdir sources
cd sources
git clone --branch atlas-v2 https://github.com/LBNL-UCB-STI/PILATES.git
git clone --branch copy-woorking-directory https://github.com/LBNL-UCB-STI/PILATES.git
cd PILATES
```

## Setup Python

```commandline
module load python/3.8.8
pip install --user openmatrix
pip install --user geopandas
module load python/3.10.12
python -m pip uninstall --user shapely
python -m pip install --user shapely
python -m pip install --user openmatrix
python -m pip install --user pygeos
python -m pip install --user geopandas
python -m pip install --user table
python -m pip install --user PyYAML
export PYTHONPATH=`python -m site --user-site`:$PYTHONPATH
```

Expand Down Expand Up @@ -85,4 +90,7 @@ cd ../../../
cd hpc
./job_runner.sh
```
#### Optional tags:
`-c`: Define a new settings file, defaults to `settings.yaml`

`-s`: Current stage file name of run to restart in the middle of. If none, starts a new run with a new current stage file. Defaults to none.
31 changes: 17 additions & 14 deletions pilates/activitysim/postprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
import os

from pilates.utils.io import read_datastore
from workflow_state import WorkflowState

logger = logging.getLogger(__name__)


def _load_asim_outputs(settings):
def _load_asim_outputs(settings, output_path):
output_tables_settings = settings['asim_output_tables']
prefix = output_tables_settings['prefix']
output_tables = output_tables_settings['tables']
asim_output_dict = {}
for table_name in output_tables:
file_name = "%s%s.csv" % (prefix, table_name)
file_path = os.path.join(
settings['asim_local_output_folder'], file_name)
file_path = os.path.join(output_path, settings['asim_local_output_folder'], file_name)
if table_name == 'persons':
index_col = 'person_id'
elif table_name == 'households':
Expand Down Expand Up @@ -50,18 +50,18 @@ def get_usim_datastore_fname(settings, io, year=None):


def _prepare_updated_tables(
settings, forecast_year, asim_output_dict, tables_updated_by_asim,
settings, state: WorkflowState, asim_output_dict, tables_updated_by_asim,
prefix=None):
"""
Combines ActivitySim and UrbanSim outputs for tables updated by
ActivitySim (e.g. households and persons)
"""

data_dir = settings['usim_local_data_folder']
data_dir = os.path.join(state.full_path, settings['usim_local_mutable_data_folder'])

# e.g. model_data_2012.h5
usim_output_store_name = get_usim_datastore_fname(
settings, io='output', year=forecast_year)
settings, io='output', year=state.forecast_year)
usim_output_store_path = os.path.join(data_dir, usim_output_store_name)
if not os.path.exists(usim_output_store_path):
raise ValueError('No output data store found at {0}'.format(
Expand Down Expand Up @@ -172,7 +172,7 @@ def create_beam_input_data(settings, forecast_year, asim_output_dict):

def create_usim_input_data(
settings, input_year, forecast_year, asim_output_dict,
tables_updated_by_asim):
tables_updated_by_asim, full_path=None):
"""
Creates UrbanSim input data for the next iteration.

Expand All @@ -186,7 +186,9 @@ def create_usim_input_data(
"""

# parse settings
data_dir = settings['usim_local_data_folder']
data_dir = settings['usim_local_mutable_data_folder']
if full_path is not None:
data_dir = os.path.join(full_path, data_dir)

# Move UrbanSim input store (e.g. custom_mpo_193482435_model_data.h5)
# to archive (e.g. input_data_for_2015_outputs.h5) because otherwise
Expand Down Expand Up @@ -215,7 +217,7 @@ def create_usim_input_data(
if not os.path.exists(usim_output_store_path):
raise ValueError('No output data found at {0}.'.format(
usim_output_store_path))
usim_output_store, table_prefix_year = read_datastore(settings, forecast_year)
usim_output_store, table_prefix_year = read_datastore(settings, forecast_year, mutable_data_dir=full_path)

logger.info(
'Merging results back into UrbanSim format and storing as .h5!')
Expand Down Expand Up @@ -270,18 +272,19 @@ def create_usim_input_data(
return


def create_next_iter_inputs(settings, year, forecast_year):
def create_next_iter_inputs(settings, year, state: WorkflowState):
forecast_year = state.forecast_year
tables_updated_by_asim = ['households', 'persons']
asim_output_dict = _load_asim_outputs(settings)
asim_output_dict = _load_asim_outputs(settings, state.full_path)
asim_output_dict = _prepare_updated_tables(
settings, forecast_year, asim_output_dict, tables_updated_by_asim,
settings, state, asim_output_dict, tables_updated_by_asim,
prefix=forecast_year)

# if settings['traffic_assignment_enabled']:
# create_beam_input_data(settings, forecast_year, asim_output_dict)
create_usim_input_data(
settings, year, forecast_year, asim_output_dict,
tables_updated_by_asim)
tables_updated_by_asim, state.full_path)

return

Expand All @@ -294,7 +297,7 @@ def update_usim_inputs_after_warm_start(

# load usim data
if not usim_data_dir:
usim_data_dir = settings['usim_local_data_folder']
usim_data_dir = settings['usim_local_mutable_data_folder']
datastore_name = get_usim_datastore_fname(settings, io='input')
input_store_path = os.path.join(usim_data_dir, datastore_name)
if not os.path.exists(input_store_path):
Expand Down
Loading