Repository navigation
fix(crawlers): persist session pool and predictor after migration or abort pause - #2577
Closed
cobanfurkanx wants to merge 1 commit into
Closed
cobanfurkanx wants to merge 1 commit into
cobanfurkanx wants to merge 1 commit into
Conversation
Collaborator
|
Thank you for your PR! However, this is an internal task, and we'll address it later in v2, once we resolve a few other bottlenecks. So I'm closing this PR. |
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
persist_state()toSessionPool,RenderingTypePredictor(no-op default so custom subclasses stay compatible), andDefaultRenderingTypePredictor, delegating toself._state.persist_state()the same wayStatistics.persist_state()does.BasicCrawler._persist_state()called at the end of_pause_by_event()to persist bothself._statisticsandself._session_poolafter in-flight requests drain onMIGRATINGandABORTING.AdaptivePlaywrightCrawler._persist_state()to also persistself._rendering_type_predictorafter in-flight requests finish.Issues
Testing
SessionPool.persist_state()andDefaultRenderingTypePredictor.persist_state()(with persistence enabled and disabled).test_basic_crawler.pyandtest_adaptive_playwright_crawler.pyverifying that session mutations (cookies + retired status) and predictor model updates learned while draining in-flight requests are written to the crawler's key-value store after the pause.uv run --no-sync pytest tests/unit/sessions/test_session_pool.py tests/unit/crawlers/_adaptive_playwright/test_predictor.py tests/unit/crawlers/_adaptive_playwright/test_adaptive_playwright_crawler.py -k "not import_error"(99 passed)uv run --no-sync pytest tests/unit/crawlers/_basic/test_basic_crawler.py -k "migration or abort or pause"(22 passed)uv run --no-sync ruff format --check&uv run --no-sync ruff check(all checks passed)uv run --no-sync ty check(all checks passed)Checklist