Skip to content

herheliuk/pure-python-checkpoint-restore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Usage:

python3 dump.py <script_path> <dump_line> [dump_occurrence] [snapshot_path] {optimiation_level} --args {script_args}

python3 restore.py <script_path> [snapshot_path]

Example:

source env.sh

python -O dump.py test_files/miss.py 5 4
python -O restore.py test_files/miss.py

Main idea:

def walk_frames_to_root(frame: FrameType) -> Iterator[FrameType]:
    while frame:
        yield frame
        frame = frame.f_back

Extract all useful data from these frames and rebuild the state in a new program.


WIP:

  • known BUGS

known BUGS:

  • dumpimg imp.py:95 - class triggers enter!? (remove enter from all clases if it was ran already)

potential issues:

  • async/await 🌚
  • threads 🌚

&

  • locals()['var'] = ... ; ast is blind to that ATM
  • use frame_ids for all rewrites ; we may have a few instances!
  • does main trace_function need paths_to_trace?

from 'for' block:

  • generator expressions
  • zip objects
  • map/filter
  • custom iterators

OPTIMISATIONS:

  • use AST to determine which locals we need to dump &? -> SQL

Bugs that disappeared overtime?!

  • test_files/miss.py memory test (-O with python3, dump&restore with dump.py 🔥 > 0)