fix(workflow): remove unused MIN_THREADS / CPU_THRESHOLD env vars#478
Open
brycehemme wants to merge 1 commit into
Open
fix(workflow): remove unused MIN_THREADS / CPU_THRESHOLD env vars#478brycehemme wants to merge 1 commit into
brycehemme wants to merge 1 commit into
Conversation
`MIN_THREADS` (`STRANDS_WORKFLOW_MIN_THREADS`) and `CPU_THRESHOLD` (`STRANDS_WORKFLOW_CPU_THRESHOLD`) were defined but never read. The `min_workers` parameter on `TaskExecutor.__init__` was assigned to `self.min_workers` and likewise never used downstream. Drop all three. Also fix module/class docstrings that advertised features the code does not implement: "Automatic thread pool scaling (2-8 threads)", "CPU usage monitoring and optimization", "Resource-aware task distribution", and "dynamic scaling" on `TaskExecutor`. `MAX_THREADS` / `STRANDS_WORKFLOW_MAX_THREADS` (the one variable that does affect `ThreadPoolExecutor`) is preserved unchanged. Fixes strands-agents#327
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.
Description
Issue #327 reported that
MIN_THREADS(STRANDS_WORKFLOW_MIN_THREADS) andCPU_THRESHOLD(STRANDS_WORKFLOW_CPU_THRESHOLD) are defined inworkflow.pybut never read, and that the module/class docstrings advertise behaviors the implementation doesn't have ("automatic thread pool scaling 2-8 threads", "CPU usage monitoring and optimization", "dynamic scaling and resource monitoring" onTaskExecutor).Per the maintainer's suggestion on the issue (Option 1), this PR deletes the dead code rather than implementing the advertised features:
MIN_THREADSandCPU_THRESHOLDmodule constants.min_workersparameter andself.min_workersattribute onTaskExecutor(verified internal-only via grep; the single call siteTaskExecutor()passes no args).TaskExecutorclass docstring.MAX_THREADS/STRANDS_WORKFLOW_MAX_THREADS(the one env var that does flow through toThreadPoolExecutor) is preserved unchanged.Note that this removes two environment variables. Any user who currently sets
STRANDS_WORKFLOW_MIN_THREADSorSTRANDS_WORKFLOW_CPU_THRESHOLDis already getting silently no-op'd today, so the observable behavior doesn't change.Related Issues
Fixes #327
Type of Change
Bug fix
Testing
Ran
hatch run prepareend-to-end viapython:3.12in Docker:format: clean (no changes)lint: cleantest-lint(ruff format --check): cleantest: 1210 passed, 33 skipped, 1 failureThe single failure is
tests/test_file_write.py::test_file_write_error_handling. I verified it reproduces onmainwithout this PR (same Python 3.12 / hatch environment), so it's pre-existing and unrelated to this change.hatch run prepareChecklist
test_workflow.pytests coverTaskExecutor())