Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
e9a70c7
Update dependencies in Cargo.lock and add Cargo.lock to .gitignore
shawhanken Dec 18, 2025
68da611
Merge branch 'main' of https://github.com/yusufyian/RustPython
shawhanken Dec 18, 2025
1bf2bdf
Update dependencies in Cargo.lock and add Cargo.lock to .gitignore
shawhanken Dec 19, 2025
1726b36
Add additional reference files to .gitignore
shawhanken Dec 19, 2025
fd57302
Update .gitignore to exclude additional files and improve dependency …
shawhanken Dec 19, 2025
ecfabb8
Merge branch 'RustPython:main' into main
yusufyian Dec 19, 2025
bc9b80a
Merge branch 'main' of https://github.com/yusufyian/RustPython
shawhanken Dec 19, 2025
1a1c97a
Add checkpoint functionality to VirtualMachine
shawhanken Dec 19, 2025
3997507
Add checkpoint request handling and update checkpoint functionality
shawhanken Dec 19, 2025
551d025
Enhance demo script with additional print statements for debugging
shawhanken Dec 19, 2025
665790f
Update demo user and enhance README with testing instructions
shawhanken Dec 24, 2025
c2edc6b
Update .gitignore to include demo files
shawhanken Dec 24, 2025
4dc6120
Update .gitignore and demo script for type checking
shawhanken Dec 25, 2025
9ac5e54
Rename RustPython binary to "pvm" in Cargo.toml and update demo.py fo…
yusufyian Dec 26, 2025
8ea2822
Rename RustPython binary to 'pvm' in Cargo.toml and update demo.py fo…
yusufyian Dec 26, 2025
66dc584
Update README and test script to reflect binary name change from 'rus…
yusufyian Dec 29, 2025
6c26391
Refactor demo.py for improved clarity and structure in checkpointing …
yusufyian Dec 29, 2025
a1c1891
Update demo.py and README for financial trading scenario simulation
yusufyian Dec 29, 2025
f41b080
Enhance demo.py with additional trading scenario features and update …
yusufyian Dec 29, 2025
5f547a5
Implement PVM host and runtime modules with initial configurations
yusufyian Dec 29, 2025
3ed0799
Update various files for improved functionality and clarity
yusufyian Dec 29, 2025
9704677
Enhance VM functionality and code clarity
yusufyian Dec 29, 2025
965b201
Enhance demo script and update .gitignore
yusufyian Dec 30, 2025
9f354c2
Update .gitignore to include all reference files and remove specific …
yusufyian Dec 30, 2025
b50f1f3
Remove obsolete reference files for PVM integration and continuation …
yusufyian Dec 30, 2025
f8fc889
Remove obsolete demo files for checkpoint/resume functionality
yusufyian Dec 30, 2025
26ac488
Remove obsolete binary snapshot file for demo functionality
yusufyian Dec 30, 2025
b2ba6ea
Remove obsolete test script for checkpoint/resume functionality
yusufyian Dec 30, 2025
2dfed2d
Refactor comments in state_store.py for clarity and consistency
yusufyian Dec 30, 2025
d8aabdd
Enhance checkpoint functionality and update .gitignore
yusufyian Dec 30, 2025
6d54427
Update source location handling in compiler-source
yusufyian Dec 30, 2025
a1a7ec6
Refactor checkpoint and snapshot handling for improved functionality
yusufyian Dec 30, 2025
3620c13
Update version formatting in version.rs to reflect PVM 0.0.2 integration
yusufyian Dec 31, 2025
fe31a3d
Add PVM versioning support and update build script
yusufyian Dec 31, 2025
8eaf89f
Implement multi-frame checkpoint support and enhance stack management
yusufyian Dec 31, 2025
5544761
Enhance checkpoint functionality and update demo scripts
yusufyian Dec 31, 2025
13117d6
Add support for enumerate, zip, map, and filter in snapshot handling
yusufyian Dec 31, 2025
63c44b5
Enhance checkpoint and block stack management in VM
yusufyian Dec 31, 2025
c6806af
Add support for ListIterator and RangeIterator in snapshot handling
yusufyian Jan 3, 2026
9844d0d
Add comprehensive demo snapshot to .gitignore
yusufyian Jan 3, 2026
a07fed6
Remove Cargo.lock file to prevent unnecessary tracking of dependencies
yusufyian Jan 5, 2026
06e9e6a
Add error handling and execution options in PVM runtime
yusufyian Jan 5, 2026
072c0cc
Add determinism support and enhance error handling in PVM runtime
yusufyian Jan 8, 2026
5e01466
Enhance PVM runtime with import tracing and version updates
yusufyian Jan 8, 2026
b9dc39d
Add new business scenario demos to README
yusufyian Jan 8, 2026
d5afdde
Fix formatting issue in escrow_marketplace_demo.py by adding a newlin…
yusufyian Jan 12, 2026
9f3c462
Enhance PVM runtime with continuation support and new features
yusufyian Jan 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactor comments in state_store.py for clarity and consistency
- Updated comments in `state_store.py` to provide clear English descriptions of the functions' purposes, enhancing code readability and maintainability.
  • Loading branch information
yusufyian committed Dec 30, 2025
commit 2dfed2dbcabe9535bfbc9965b69249cd3c18bce9
6 changes: 3 additions & 3 deletions examples/breakpoint_resume_demo/state_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@


def load_state() -> dict[str, Any] | None:
# 读取断点状态文件;不存在则返回 None 表示首次运行
# Load checkpoint state file; return None when missing to indicate first run.
if not STATE_FILE.exists():
return None
return json.loads(STATE_FILE.read_text())


def save_state(state: dict[str, Any]) -> None:
# 写入断点状态,确保目录存在
# Write checkpoint state, ensuring the directory exists.
DATA_DIR.mkdir(parents=True, exist_ok=True)
STATE_FILE.write_text(json.dumps(state, sort_keys=True, indent=2))


def clear_state() -> None:
# 清理断点状态,方便从头开始
# Clear checkpoint state to allow a fresh start.
if STATE_FILE.exists():
STATE_FILE.unlink()
119 changes: 119 additions & 0 deletions examples/breakpoint_resume_demo/test_checkpoint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
from __future__ import annotations

import argparse
import os
import subprocess
import sys
from pathlib import Path


def resolve_bin_path(root: Path, bin_override: str | None) -> Path:
if bin_override:
return Path(bin_override)

bin_path = root / "target" / "release" / "pvm"
if os.name == "nt":
bin_path = bin_path.with_suffix(".exe")
return bin_path


def run_cmd(args: list[str]) -> subprocess.CompletedProcess[str]:
return subprocess.run(args, capture_output=True, text=True, check=False)


def combined_output(result: subprocess.CompletedProcess[str]) -> str:
return (result.stdout or "") + (result.stderr or "")


def main() -> int:
parser = argparse.ArgumentParser(description="Checkpoint resume functionality test")
parser.add_argument(
"--bin",
help="Path to the rustpython executable, defaults to target/release/rustpython",
)
args = parser.parse_args()

repo_root = Path(__file__).resolve().parents[2]
bin_path = resolve_bin_path(repo_root, args.bin)
demo_path = Path(__file__).with_name("demo.py")
snap_path = demo_path.with_suffix(".rpsnap")

if not bin_path.exists():
print(f"[error] rustpython not found: {bin_path}")
return 1

if snap_path.exists():
snap_path.unlink()

# First run: hit checkpoint and generate snapshot
result1 = run_cmd([str(bin_path), str(demo_path)])
output1 = combined_output(result1)
if result1.returncode != 0:
print("[error] First run failed")
print("stdout:")
print(result1.stdout)
print("stderr:")
print(result1.stderr)
return 1
if output1.strip():
if "phase=init" not in output1:
print("[error] First run output did not match expectation")
print("stdout:")
print(result1.stdout)
print("stderr:")
print(result1.stderr)
return 1
if not snap_path.exists():
print("[error] Snapshot file not generated")
return 1

# Second run: resume from checkpoint 1 to checkpoint 2
result2 = run_cmd([str(bin_path), "--resume", str(snap_path), str(demo_path)])
output2 = combined_output(result2)
if result2.returncode != 0:
print("[error] Second run failed")
print("stdout:")
print(result2.stdout)
print("stderr:")
print(result2.stderr)
return 1
if output2.strip():
if "phase=after_checkpoint_1" not in output2:
print("[error] Second run output did not match expectation")
print("stdout:")
print(result2.stdout)
print("stderr:")
print(result2.stderr)
return 1
if not snap_path.exists():
print("[error] Snapshot file missing after second run")
return 1

# Third run: resume from checkpoint 2 and complete
result3 = run_cmd([str(bin_path), "--resume", str(snap_path), str(demo_path)])
output3 = combined_output(result3)
if result3.returncode != 0:
print("[error] Third run failed")
print("stdout:")
print(result3.stdout)
print("stderr:")
print(result3.stderr)
return 1
if output3.strip():
if "phase=after_checkpoint_2" not in output3 or "done" not in output3:
print("[error] Third run output did not match expectation")
print("stdout:")
print(result3.stdout)
print("stderr:")
print(result3.stderr)
return 1
if snap_path.exists():
print("[error] Snapshot file not cleaned up after third run")
return 1

print("[ok] Checkpoint resume test passed")
return 0


if __name__ == "__main__":
raise SystemExit(main())