INNER CODE UNIT · Python
get_sample
416rehman/DeepZero · src/deepzero/api/server.py:97
async def get_sample(request: Request) -> JSONResponseType:
sample_id = request.path_params["sample_id"]
state = await _run_sync(store.load_sample, sample_id)
if state is None:
return JSONResponse({"error": f"sample {sample_id} not found"}, status_code=404)
from deepzero.engine.state import sample_to_dict
return JSONResponse(sample_to_dict(state))
async def get_sample_artifact(request: Request) -> JSONResponseType:
sample_id = request.path_params["sample_id"]
artifact_name = request.path_params["name"]
sample_dir = store.sample_dir(sample_id)
state = await _run_sync(store.load_sample, sample_id)