Skip to content

Fallback to full run if protocol deps are missing/invalid instead of crashing/failing - #5004

Merged
ilevkivskyi merged 2 commits into
python:masterfrom
ilevkivskyi:fix-fine-protocols
May 4, 2018
Merged

ilevkivskyi merged 2 commits into
python:masterfrom
ilevkivskyi:fix-fine-protocols

Conversation

@ilevkivskyi

Copy link
Copy Markdown
Member

Also change the cache file names to @proto_deps to avoid clashes with user modules with the same name.

Comment thread mypy/build.py
# the protocol cache against the loaded individual cache files.
TypeState.proto_deps = read_protocol_cache(manager, graph)
if TypeState.proto_deps is None and manager.stats.get('fresh_trees', 0) > 0:
if TypeState.proto_deps is None and manager.stats.get('fresh_metas', 0) > 0:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to have a test case for this, since this is something that could easily get stale. Maybe create an issue about adding a test (maybe also for other related cache corruption issues)?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have #5002, do we need a separate issue? I can just add a comment that we need to also check performance/behavior with corrupted caches.

Comment thread mypy/build.py Outdated
manager.cache_enabled = False
TypeState.proto_deps = {}
manager.log("Falling back to full run -- reloading graph...")
graph = load_graph(sources, manager)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we call update_protocol_deps as well? This might be less likely to get stale if we'd only have one process_graph callin this function. Maybe instead of calling load_graph and process_graph here, call dispatch recursively after changing the options?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we call update_protocol_deps as well?

I think no, since update.py should do this. We call it manually below to have them up to date if we write caches. Anyway, I think calling dispatch recursively is a better option, so we don't need to worry about keeping the logic in sync.

@JukkaL JukkaL left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ilevkivskyi
ilevkivskyi merged commit 4015eef into python:master May 4, 2018
@ilevkivskyi
ilevkivskyi deleted the fix-fine-protocols branch May 4, 2018 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants