Выполнить лабораторную 4: S3-вложения и согласованность хранилищ
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
"""Isolated CLI fault: real process death after PUT, before DB ready COMMIT."""
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import sys
|
||||
sys.path.insert(0,str(Path(__file__).resolve().parents[1]))
|
||||
from app import store, object_store
|
||||
|
||||
|
||||
def crash(aid,key):
|
||||
print(json.dumps({'id':aid,'key':key}),flush=True)
|
||||
os._exit(86)
|
||||
|
||||
if __name__=='__main__':
|
||||
store.pool.open(wait=True,timeout=15)
|
||||
path=Path(__file__).resolve().parents[1]/'tests/fixtures/sample.png'
|
||||
payload=path.read_bytes()
|
||||
with path.open('rb') as stream:
|
||||
object_store.persist(stream,sys.argv[1],sys.argv[2],'crash.png','image/png',len(payload),hashlib.sha256(payload).hexdigest(),after_put=crash)
|
||||
Reference in New Issue
Block a user