Open
Conversation
Separates environment identity (env_id) from run configuration (run_id) to
allow inference environments to be reused across configuration changes. This
prevents unnecessary rebuilding of venv and squashfs images when only the
inference config YAML or steps are modified.
Changes:
src/evalml/config.py:
- Add RunConfig.ENV_FIELDS ClassVar documenting fields that determine the
inference environment (checkpoint, extra_requirements, disable_local_eccodes_definitions)
- Add RunConfig.HASH_EXCLUDE ClassVar for fields never included in hashing
(label, inference_resources)
- Export module-level constants RUN_ENV_FIELDS and RUN_HASH_EXCLUDE
workflow/rules/common.smk:
- Add ENV_HASH_FIELDS and RUN_HASH_EXCLUDE constants
- Split hashing logic into two functions:
- env_entry_hash(): hashes only environment-determining fields
- run_specific_hash(): hashes run-specific fields (config YAML, steps)
- Refactor register_run() to compute and store both env_id and run_id in
each run config entry. Format: run_id = {env_id}/{config_hash}
- Add collect_all_envs() function and ENV_CONFIGS global dict
- Update master_hash() to hash both env and run components separately
workflow/rules/inference.smk:
- Rules using {env_id} wildcard (outputs in data/envs/{env_id}/):
- prepare_checkpoint
- extract_checkpoint_requirements
- create_inference_venv
- make_squashfs_image
- Rules using {run_id} wildcard with nested config directories:
- prepare_inference_forecaster
- prepare_inference_interpolator
- execute_inference (references env via lookup)
- create_inference_sandbox
Directory structure change:
- Environment artifacts: data/envs/{env_id}/
- Run-specific outputs: data/runs/{env_id}/{config_hash}/{init_time}/
Benefits:
- Reuses environments across config changes (no squashfs rebuild)
- Reduces disk I/O on shared filesystems
- Documents identity contract via ClassVars
- Nested directory structure clearly separates concerns
Tests:
- Add test_run_identity.py with 5 tests validating identity separation
- All existing tests pass
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Separates environment identity from run configuration to allow inference environments to be reused across configuration changes, eliminating unnecessary rebuilds of venv and squashfs images. Closes #111
Changes
ENV_FIELDSandHASH_EXCLUDEClassVars toRunConfigdocumenting the identity contractenv_entry_hash()for environment-level changes,run_specific_hash()for configuration changesregister_run()to compute bothenv_idandrun_idwith nested directory structure:data/runs/{env_id}/{config_hash}/{env_id}wildcard for environment artifacts (indata/runs/{env_id}/) and{run_id}for run outputsENV_CONFIGSglobal dict andcollect_all_envs()functionBenefits
Testing