Fix linting

This commit is contained in:
yangdx 2025-11-18 08:07:54 +08:00
parent 21ad990e36
commit fc9f7c705e
2 changed files with 36 additions and 24 deletions

View file

@ -236,8 +236,12 @@ async def test_lock_mechanism():
) )
print("✅ PASSED: Lock Mechanism - Parallel (Different Workspaces)") print("✅ PASSED: Lock Mechanism - Parallel (Different Workspaces)")
print(f" Locks overlapped for different workspaces (max concurrency={max_parallel})") print(
print(f" Performance: {metrics['total_duration']:.3f}s for {metrics['num_workers']} workers") f" Locks overlapped for different workspaces (max concurrency={max_parallel})"
)
print(
f" Performance: {metrics['total_duration']:.3f}s for {metrics['num_workers']} workers"
)
# Test 2.2: Same workspace should serialize # Test 2.2: Same workspace should serialize
print("\nTest 2.2: Same workspace locks should serialize") print("\nTest 2.2: Same workspace locks should serialize")
@ -245,9 +249,11 @@ async def test_lock_mechanism():
("serial_run_1", "ws_same", "test_namespace"), ("serial_run_1", "ws_same", "test_namespace"),
("serial_run_2", "ws_same", "test_namespace"), ("serial_run_2", "ws_same", "test_namespace"),
] ]
max_parallel_serial, timeline_serial, metrics_serial = await _measure_lock_parallelism( (
serial_workload max_parallel_serial,
) timeline_serial,
metrics_serial,
) = await _measure_lock_parallelism(serial_workload)
assert max_parallel_serial == 1, ( assert max_parallel_serial == 1, (
"Same workspace locks should not overlap; " "Same workspace locks should not overlap; "
f"observed {max_parallel_serial} with timeline {timeline_serial}" f"observed {max_parallel_serial} with timeline {timeline_serial}"
@ -256,7 +262,9 @@ async def test_lock_mechanism():
print("✅ PASSED: Lock Mechanism - Serial (Same Workspace)") print("✅ PASSED: Lock Mechanism - Serial (Same Workspace)")
print(" Same workspace operations executed sequentially with no overlap") print(" Same workspace operations executed sequentially with no overlap")
print(f" Performance: {metrics_serial['total_duration']:.3f}s for {metrics_serial['num_workers']} tasks") print(
f" Performance: {metrics_serial['total_duration']:.3f}s for {metrics_serial['num_workers']} tasks"
)
# ============================================================================= # =============================================================================
@ -519,8 +527,12 @@ async def test_different_namespace_lock_isolation():
) )
print("✅ PASSED: Different Namespace Lock Isolation") print("✅ PASSED: Different Namespace Lock Isolation")
print(f" Different namespace locks ran in parallel (max concurrency={max_parallel})") print(
print(f" Performance: {metrics['total_duration']:.3f}s for {metrics['num_workers']} namespaces") f" Different namespace locks ran in parallel (max concurrency={max_parallel})"
)
print(
f" Performance: {metrics['total_duration']:.3f}s for {metrics['num_workers']} namespaces"
)
# ============================================================================= # =============================================================================