Refactor job model and optimize job streaming.
Updated the `JobModel` with foreign key relationships and string-based status to enhance database consistency, and improved job event streaming by using `jsonable_encoder` for better serialization. Also, streamlined dependencies by adding `urllib3` to handle HTTP requests.
This commit is contained in:
parent
866139baea
commit
3eb4050d82
@ -7,7 +7,6 @@ from sqlalchemy import (
|
|||||||
JSON,
|
JSON,
|
||||||
DateTime,
|
DateTime,
|
||||||
Boolean,
|
Boolean,
|
||||||
Enum,
|
|
||||||
func,
|
func,
|
||||||
)
|
)
|
||||||
from sqlalchemy.orm import relationship
|
from sqlalchemy.orm import relationship
|
||||||
@ -318,8 +317,8 @@ class Jobs(Base):
|
|||||||
__tablename__ = "jobs"
|
__tablename__ = "jobs"
|
||||||
|
|
||||||
id = Column(Integer, primary_key=True, index=True)
|
id = Column(Integer, primary_key=True, index=True)
|
||||||
experiment_parameters_id = Column(Integer, nullable=False)
|
experiment_parameters_id = Column(Integer, ForeignKey("experiment_parameters.id"))
|
||||||
status = Column(Enum(JobStatus), default=JobStatus.TODO, nullable=False)
|
status = Column(String, nullable=False)
|
||||||
parameters = Column(JSON, nullable=False)
|
parameters = relationship(ExperimentParameters)
|
||||||
created_at = Column(DateTime, server_default=func.now())
|
created_at = Column(DateTime, server_default=func.now())
|
||||||
updated_at = Column(DateTime, onupdate=func.now())
|
updated_at = Column(DateTime, onupdate=func.now())
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import json
|
import json
|
||||||
import asyncio
|
import asyncio
|
||||||
from fastapi import APIRouter, Depends
|
from fastapi import APIRouter, Depends
|
||||||
|
from fastapi.encoders import jsonable_encoder
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
from starlette.responses import StreamingResponse
|
from starlette.responses import StreamingResponse
|
||||||
from app.models import JobStatus, Jobs as JobModel
|
from app.models import JobStatus, Jobs as JobModel
|
||||||
@ -11,15 +12,14 @@ router = APIRouter()
|
|||||||
|
|
||||||
async def job_event_generator(db: Session):
|
async def job_event_generator(db: Session):
|
||||||
while True:
|
while True:
|
||||||
# Fetch jobs with status TODO
|
|
||||||
jobs = db.query(JobModel).filter(JobModel.status == JobStatus.TODO).all()
|
jobs = db.query(JobModel).filter(JobModel.status == JobStatus.TODO).all()
|
||||||
|
|
||||||
if jobs:
|
if jobs:
|
||||||
# It's recommended to explicitly communicate IDs clearly
|
job_payload = jsonable_encoder(jobs)
|
||||||
job_payload = [{"id": job.id, "parameters": job.parameters} for job in jobs]
|
|
||||||
yield f"data: {json.dumps(job_payload)}\n\n"
|
yield f"data: {json.dumps(job_payload)}\n\n"
|
||||||
|
await asyncio.sleep(5)
|
||||||
|
|
||||||
await asyncio.sleep(5) # A reasonable heartbeat/refresh
|
|
||||||
|
# A reasonable heartbeat/refresh
|
||||||
|
|
||||||
|
|
||||||
@router.get("/jobs/stream")
|
@router.get("/jobs/stream")
|
||||||
|
@ -352,7 +352,7 @@ def create_experiment_parameters_for_sample(
|
|||||||
|
|
||||||
new_job = JobModel(
|
new_job = JobModel(
|
||||||
experiment_parameters_id=new_exp.id, # <-- Correct reference here
|
experiment_parameters_id=new_exp.id, # <-- Correct reference here
|
||||||
parameters=new_exp.to_dict(), # assuming params has a to_dict() method
|
parameters=new_exp, # assuming params has a to_dict() method
|
||||||
status=JobStatus.TODO,
|
status=JobStatus.TODO,
|
||||||
)
|
)
|
||||||
db.add(new_job)
|
db.add(new_job)
|
||||||
|
@ -941,3 +941,19 @@ class ResultResponse(BaseModel):
|
|||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
from_attributes = True
|
from_attributes = True
|
||||||
|
|
||||||
|
|
||||||
|
class JobsCreate(BaseModel):
|
||||||
|
id: str
|
||||||
|
name: str
|
||||||
|
status: str
|
||||||
|
type: str
|
||||||
|
start_time: datetime
|
||||||
|
end_time: datetime
|
||||||
|
description: Optional[str]
|
||||||
|
parameters: str
|
||||||
|
datacollectionparameters: DataCollectionParameters
|
||||||
|
beamlineparameters: BeamlineParameters
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
from_attributes = True
|
||||||
|
171
backend/propipe_sim.ipynb
Normal file
171
backend/propipe_sim.ipynb
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
{
|
||||||
|
"cells": [
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"id": "initial_id",
|
||||||
|
"metadata": {
|
||||||
|
"collapsed": true,
|
||||||
|
"jupyter": {
|
||||||
|
"is_executing": true
|
||||||
|
},
|
||||||
|
"ExecuteTime": {
|
||||||
|
"start_time": "2025-04-29T07:44:02.103530Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"source": [
|
||||||
|
"import requests\n",
|
||||||
|
"import sseclient\n",
|
||||||
|
"import json\n",
|
||||||
|
"\n",
|
||||||
|
"SSE_URL = \"https://127.0.0.1:8000/processing/jobs/stream\"\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"#SSE_URL = \"https://mx-aare-test.psi.ch:1492/processing/jobs/stream\"\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"def listen_and_process_jobs(url):\n",
|
||||||
|
" print(\"Starting processing pipeline...\")\n",
|
||||||
|
" with requests.get(url, stream=True, verify=False) as response:\n",
|
||||||
|
" if response.status_code != 200:\n",
|
||||||
|
" print(f\"Failed to connect with status code: {response.status_code}\")\n",
|
||||||
|
" return\n",
|
||||||
|
"\n",
|
||||||
|
" client = sseclient.SSEClient(response)\n",
|
||||||
|
"\n",
|
||||||
|
" for event in client.events():\n",
|
||||||
|
" try:\n",
|
||||||
|
" jobs = json.loads(event.data)\n",
|
||||||
|
" print(f\"Jobs received: {jobs}\")\n",
|
||||||
|
"\n",
|
||||||
|
" for job in jobs:\n",
|
||||||
|
" job_id = job.get(\"id\")\n",
|
||||||
|
" parameters = job.get(\"parameters\")\n",
|
||||||
|
" if parameters is None:\n",
|
||||||
|
" print(\n",
|
||||||
|
" f\"⚠️ Job {job_id if job_id is not None else '[unknown id]'} has no 'parameters'; skipping.\")\n",
|
||||||
|
" continue\n",
|
||||||
|
"\n",
|
||||||
|
" print(f\"Processing job ID: {job_id} with parameters: {parameters}\")\n",
|
||||||
|
"\n",
|
||||||
|
" # Your custom job-processing logic goes here\n",
|
||||||
|
" process_job_logic(job_id, parameters)\n",
|
||||||
|
"\n",
|
||||||
|
" # After job processing completes, send results & update job status\n",
|
||||||
|
" submit_job_result(job_id, processing_result={'success': True})\n",
|
||||||
|
" except json.JSONDecodeError as e:\n",
|
||||||
|
" print(f\"Error decoding event data: {e}\")\n",
|
||||||
|
" except Exception as e:\n",
|
||||||
|
" print(f\"Unexpected error while processing event: {e}\")\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"def process_job_logic(job_id, parameters):\n",
|
||||||
|
" print(f\"📦 {job_id} - Processing detailed logic here: {parameters}\")\n",
|
||||||
|
" import time\n",
|
||||||
|
" time.sleep(5)\n",
|
||||||
|
" print(f\"✅ Job {job_id} processing complete\")\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"def submit_job_result(job_id, processing_result):\n",
|
||||||
|
" import backend.aareDBclient as aareDBclient\n",
|
||||||
|
" from aareDBclient.models import ResultCreate\n",
|
||||||
|
"\n",
|
||||||
|
" configuration = aareDBclient.Configuration(\n",
|
||||||
|
" host=\"https://127.0.0.1:8000\",\n",
|
||||||
|
" verify_ssl=False\n",
|
||||||
|
" )\n",
|
||||||
|
"\n",
|
||||||
|
" with aareDBclient.ApiClient(configuration) as api_client:\n",
|
||||||
|
" api_instance = aareDBclient.ProcessingApi(api_client)\n",
|
||||||
|
"\n",
|
||||||
|
" result = ResultCreate(\n",
|
||||||
|
" job_id=job_id,\n",
|
||||||
|
" result=processing_result\n",
|
||||||
|
" )\n",
|
||||||
|
" try:\n",
|
||||||
|
" res = api_instance.submit_processing_result(result_create=result)\n",
|
||||||
|
" print(f\"Job {job_id} result submitted successfully! Backend Response: {res}\")\n",
|
||||||
|
" except aareDBclient.rest.ApiException as e:\n",
|
||||||
|
" print(f\"Failed to submit result for Job {job_id}: {e}\")\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"if __name__ == \"__main__\":\n",
|
||||||
|
" listen_and_process_jobs(SSE_URL)"
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"Starting processing pipeline...\n",
|
||||||
|
"Jobs received: [{'status': 'todo', 'updated_at': None, 'created_at': '2025-04-29T07:40:46.419291', 'id': 1, 'experiment_parameters_id': 1}, {'status': 'todo', 'updated_at': None, 'created_at': '2025-04-29T07:41:44.451862', 'id': 2, 'experiment_parameters_id': 2}]\n",
|
||||||
|
"⚠️ Job 1 has no 'parameters'; skipping.\n",
|
||||||
|
"⚠️ Job 2 has no 'parameters'; skipping.\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stderr",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/urllib3/connectionpool.py:1103: InsecureRequestWarning: Unverified HTTPS request is being made to host '127.0.0.1'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n",
|
||||||
|
" warnings.warn(\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"Jobs received: [{'status': 'todo', 'updated_at': None, 'created_at': '2025-04-29T07:40:46.419291', 'id': 1, 'experiment_parameters_id': 1}, {'status': 'todo', 'updated_at': None, 'created_at': '2025-04-29T07:41:44.451862', 'id': 2, 'experiment_parameters_id': 2}]\n",
|
||||||
|
"⚠️ Job 1 has no 'parameters'; skipping.\n",
|
||||||
|
"⚠️ Job 2 has no 'parameters'; skipping.\n",
|
||||||
|
"Jobs received: [{'status': 'todo', 'updated_at': None, 'created_at': '2025-04-29T07:40:46.419291', 'id': 1, 'experiment_parameters_id': 1}, {'status': 'todo', 'updated_at': None, 'created_at': '2025-04-29T07:41:44.451862', 'id': 2, 'experiment_parameters_id': 2}]\n",
|
||||||
|
"⚠️ Job 1 has no 'parameters'; skipping.\n",
|
||||||
|
"⚠️ Job 2 has no 'parameters'; skipping.\n",
|
||||||
|
"Jobs received: [{'status': 'todo', 'updated_at': None, 'created_at': '2025-04-29T07:40:46.419291', 'id': 1, 'experiment_parameters_id': 1}, {'status': 'todo', 'updated_at': None, 'created_at': '2025-04-29T07:41:44.451862', 'id': 2, 'experiment_parameters_id': 2}]\n",
|
||||||
|
"⚠️ Job 1 has no 'parameters'; skipping.\n",
|
||||||
|
"⚠️ Job 2 has no 'parameters'; skipping.\n",
|
||||||
|
"Jobs received: [{'status': 'todo', 'updated_at': None, 'created_at': '2025-04-29T07:40:46.419291', 'id': 1, 'experiment_parameters_id': 1}, {'status': 'todo', 'updated_at': None, 'created_at': '2025-04-29T07:41:44.451862', 'id': 2, 'experiment_parameters_id': 2}]\n",
|
||||||
|
"⚠️ Job 1 has no 'parameters'; skipping.\n",
|
||||||
|
"⚠️ Job 2 has no 'parameters'; skipping.\n",
|
||||||
|
"Jobs received: [{'status': 'todo', 'updated_at': None, 'created_at': '2025-04-29T07:40:46.419291', 'id': 1, 'experiment_parameters_id': 1}, {'status': 'todo', 'updated_at': None, 'created_at': '2025-04-29T07:41:44.451862', 'id': 2, 'experiment_parameters_id': 2}]\n",
|
||||||
|
"⚠️ Job 1 has no 'parameters'; skipping.\n",
|
||||||
|
"⚠️ Job 2 has no 'parameters'; skipping.\n",
|
||||||
|
"Jobs received: [{'status': 'todo', 'updated_at': None, 'created_at': '2025-04-29T07:40:46.419291', 'id': 1, 'experiment_parameters_id': 1}, {'status': 'todo', 'updated_at': None, 'created_at': '2025-04-29T07:41:44.451862', 'id': 2, 'experiment_parameters_id': 2}]\n",
|
||||||
|
"⚠️ Job 1 has no 'parameters'; skipping.\n",
|
||||||
|
"⚠️ Job 2 has no 'parameters'; skipping.\n",
|
||||||
|
"Jobs received: [{'status': 'todo', 'updated_at': None, 'created_at': '2025-04-29T07:40:46.419291', 'id': 1, 'experiment_parameters_id': 1}, {'status': 'todo', 'updated_at': None, 'created_at': '2025-04-29T07:41:44.451862', 'id': 2, 'experiment_parameters_id': 2}]\n",
|
||||||
|
"⚠️ Job 1 has no 'parameters'; skipping.\n",
|
||||||
|
"⚠️ Job 2 has no 'parameters'; skipping.\n",
|
||||||
|
"Jobs received: [{'status': 'todo', 'updated_at': None, 'created_at': '2025-04-29T07:40:46.419291', 'id': 1, 'experiment_parameters_id': 1}, {'status': 'todo', 'updated_at': None, 'created_at': '2025-04-29T07:41:44.451862', 'id': 2, 'experiment_parameters_id': 2}]\n",
|
||||||
|
"⚠️ Job 1 has no 'parameters'; skipping.\n",
|
||||||
|
"⚠️ Job 2 has no 'parameters'; skipping.\n",
|
||||||
|
"Jobs received: [{'status': 'todo', 'updated_at': None, 'created_at': '2025-04-29T07:40:46.419291', 'id': 1, 'experiment_parameters_id': 1}, {'status': 'todo', 'updated_at': None, 'created_at': '2025-04-29T07:41:44.451862', 'id': 2, 'experiment_parameters_id': 2}]\n",
|
||||||
|
"⚠️ Job 1 has no 'parameters'; skipping.\n",
|
||||||
|
"⚠️ Job 2 has no 'parameters'; skipping.\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"execution_count": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"kernelspec": {
|
||||||
|
"display_name": "Python 3",
|
||||||
|
"language": "python",
|
||||||
|
"name": "python3"
|
||||||
|
},
|
||||||
|
"language_info": {
|
||||||
|
"codemirror_mode": {
|
||||||
|
"name": "ipython",
|
||||||
|
"version": 2
|
||||||
|
},
|
||||||
|
"file_extension": ".py",
|
||||||
|
"mimetype": "text/x-python",
|
||||||
|
"name": "python",
|
||||||
|
"nbconvert_exporter": "python",
|
||||||
|
"pygments_lexer": "ipython2",
|
||||||
|
"version": "2.7.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nbformat": 4,
|
||||||
|
"nbformat_minor": 5
|
||||||
|
}
|
@ -29,7 +29,8 @@ dependencies = [
|
|||||||
"python-dateutil~=2.8.2",
|
"python-dateutil~=2.8.2",
|
||||||
"tomli>=2.0.1",
|
"tomli>=2.0.1",
|
||||||
"python-dotenv",
|
"python-dotenv",
|
||||||
"psycopg2-binary"
|
"psycopg2-binary",
|
||||||
|
"urllib3~=2.2.1"
|
||||||
]
|
]
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
norecursedirs = ["backend/python-client"]
|
norecursedirs = ["backend/python-client"]
|
||||||
|
7793
frontend/package-lock.json
generated
7793
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -16,4 +16,6 @@ mysqlclient~=2.1.1
|
|||||||
python-multipart~=0.0.6
|
python-multipart~=0.0.6
|
||||||
uvicorn==0.23.1
|
uvicorn==0.23.1
|
||||||
python-dotenv
|
python-dotenv
|
||||||
psycopg2-binary
|
psycopg2-binary
|
||||||
|
python-dateutil~=2.8.2
|
||||||
|
urllib3~=2.2.1
|
@ -3,8 +3,8 @@
|
|||||||
{
|
{
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"ExecuteTime": {
|
"ExecuteTime": {
|
||||||
"end_time": "2025-03-19T11:01:53.035111Z",
|
"end_time": "2025-04-29T07:40:06.661672Z",
|
||||||
"start_time": "2025-03-19T11:01:52.510182Z"
|
"start_time": "2025-04-29T07:40:05.953900Z"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -29,7 +29,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"configuration = aareDBclient.Configuration(\n",
|
"configuration = aareDBclient.Configuration(\n",
|
||||||
" #host = \"https://mx-aare-test.psi.ch:1492\"\n",
|
" #host = \"https://mx-aare-test.psi.ch:1492\"\n",
|
||||||
" host = \"https://127.0.0.1:8000\"\n",
|
" host = \"https://localhost:8000\"\n",
|
||||||
")\n",
|
")\n",
|
||||||
"\n",
|
"\n",
|
||||||
"print(configuration.host)\n",
|
"print(configuration.host)\n",
|
||||||
@ -43,12 +43,12 @@
|
|||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"0.1.0a26\n",
|
"0.1.1a1\n",
|
||||||
"https://127.0.0.1:8000\n"
|
"https://localhost:8000\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"execution_count": 1
|
"execution_count": 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -178,8 +178,8 @@
|
|||||||
{
|
{
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"ExecuteTime": {
|
"ExecuteTime": {
|
||||||
"end_time": "2025-03-03T10:06:33.111482Z",
|
"end_time": "2025-04-28T14:36:56.694422Z",
|
||||||
"start_time": "2025-03-03T10:06:33.082367Z"
|
"start_time": "2025-04-28T14:36:56.656426Z"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -202,37 +202,36 @@
|
|||||||
],
|
],
|
||||||
"id": "9cf3457093751b61",
|
"id": "9cf3457093751b61",
|
||||||
"outputs": [
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stderr",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): localhost:8000\n",
|
||||||
|
"/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/urllib3/connectionpool.py:1097: InsecureRequestWarning: Unverified HTTPS request is being made to host 'localhost'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n",
|
||||||
|
" warnings.warn(\n",
|
||||||
|
"DEBUG:urllib3.connectionpool:https://localhost:8000 \"GET /pucks/slot/X06DA HTTP/1.1\" 200 693\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"The response of PucksApi->get_pucks_by_slot_pucks_slot_slot_identifier_get:\n",
|
"The response of PucksApi->get_pucks_by_slot_pucks_slot_slot_identifier_get:\n",
|
||||||
"\n",
|
"\n",
|
||||||
"[PuckWithTellPosition(id=1, puck_name='PUCK-001', puck_type='Unipuck', puck_location_in_dewar=1, dewar_id=1, dewar_name='Dewar One', pgroup='p20001', samples=None, tell_position='A2'),\n",
|
"[PuckWithTellPosition(id=27, puck_name='PKK004', puck_type='Unipuck', puck_location_in_dewar=4, dewar_id=5, dewar_name='Dewar Five', pgroup='p20003', samples=None, tell_position=None),\n",
|
||||||
" PuckWithTellPosition(id=2, puck_name='PUCK002', puck_type='Unipuck', puck_location_in_dewar=2, dewar_id=1, dewar_name='Dewar One', pgroup='p20001', samples=None, tell_position='A1'),\n",
|
" PuckWithTellPosition(id=28, puck_name='PKK005', puck_type='Unipuck', puck_location_in_dewar=5, dewar_id=5, dewar_name='Dewar Five', pgroup='p20003', samples=None, tell_position=None),\n",
|
||||||
" PuckWithTellPosition(id=3, puck_name='PUCK003', puck_type='Unipuck', puck_location_in_dewar=3, dewar_id=1, dewar_name='Dewar One', pgroup='p20001', samples=None, tell_position='F2'),\n",
|
" PuckWithTellPosition(id=29, puck_name='PKK006', puck_type='Unipuck', puck_location_in_dewar=6, dewar_id=5, dewar_name='Dewar Five', pgroup='p20003', samples=None, tell_position=None),\n",
|
||||||
" PuckWithTellPosition(id=4, puck_name='PUCK004', puck_type='Unipuck', puck_location_in_dewar=4, dewar_id=1, dewar_name='Dewar One', pgroup='p20001', samples=None, tell_position=None),\n",
|
" PuckWithTellPosition(id=30, puck_name='PKK007', puck_type='Unipuck', puck_location_in_dewar=7, dewar_id=5, dewar_name='Dewar Five', pgroup='p20003', samples=None, tell_position=None)]\n"
|
||||||
" PuckWithTellPosition(id=5, puck_name='PUCK005', puck_type='Unipuck', puck_location_in_dewar=5, dewar_id=1, dewar_name='Dewar One', pgroup='p20001', samples=None, tell_position=None),\n",
|
|
||||||
" PuckWithTellPosition(id=6, puck_name='PUCK006', puck_type='Unipuck', puck_location_in_dewar=6, dewar_id=1, dewar_name='Dewar One', pgroup='p20001', samples=None, tell_position='F1'),\n",
|
|
||||||
" PuckWithTellPosition(id=7, puck_name='PUCK007', puck_type='Unipuck', puck_location_in_dewar=7, dewar_id=1, dewar_name='Dewar One', pgroup='p20001', samples=None, tell_position=None)]\n"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "stderr",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/urllib3/connectionpool.py:1097: InsecureRequestWarning: Unverified HTTPS request is being made to host '127.0.0.1'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n",
|
|
||||||
" warnings.warn(\n"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"execution_count": 2
|
"execution_count": 3
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"ExecuteTime": {
|
"ExecuteTime": {
|
||||||
"end_time": "2025-02-26T12:04:33.644201Z",
|
"end_time": "2025-04-28T14:37:09.989924Z",
|
||||||
"start_time": "2025-02-26T12:04:33.625894Z"
|
"start_time": "2025-04-28T14:37:09.960196Z"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -262,10 +261,10 @@
|
|||||||
" # SetTellPosition(puck_name='PSIMX117', segment='A', puck_in_segment=2),\n",
|
" # SetTellPosition(puck_name='PSIMX117', segment='A', puck_in_segment=2),\n",
|
||||||
" #]\n",
|
" #]\n",
|
||||||
" pucks=[\n",
|
" pucks=[\n",
|
||||||
" SetTellPosition(puck_name='PUCK006', segment='F', puck_in_segment=1),\n",
|
" SetTellPosition(puck_name='PKK006', segment='F', puck_in_segment=1),\n",
|
||||||
" SetTellPosition(puck_name='PUCK003', segment='F', puck_in_segment=2),\n",
|
" SetTellPosition(puck_name='PKK005', segment='F', puck_in_segment=2),\n",
|
||||||
" SetTellPosition(puck_name='PUCK002', segment='A', puck_in_segment=1),\n",
|
" SetTellPosition(puck_name='PKK007', segment='A', puck_in_segment=1),\n",
|
||||||
" SetTellPosition(puck_name='PUCK001', segment='A', puck_in_segment=2),\n",
|
" SetTellPosition(puck_name='PKK004', segment='A', puck_in_segment=2),\n",
|
||||||
" ]\n",
|
" ]\n",
|
||||||
" #pucks = []\n",
|
" #pucks = []\n",
|
||||||
" )\n",
|
" )\n",
|
||||||
@ -284,6 +283,16 @@
|
|||||||
],
|
],
|
||||||
"id": "37e3eac6760150ee",
|
"id": "37e3eac6760150ee",
|
||||||
"outputs": [
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stderr",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): localhost:8000\n",
|
||||||
|
"/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/urllib3/connectionpool.py:1097: InsecureRequestWarning: Unverified HTTPS request is being made to host 'localhost'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n",
|
||||||
|
" warnings.warn(\n",
|
||||||
|
"DEBUG:urllib3.connectionpool:https://localhost:8000 \"PUT /pucks/set-tell-positions HTTP/1.1\" 200 601\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
@ -293,45 +302,37 @@
|
|||||||
"[{'message': 'Tell position updated successfully.',\n",
|
"[{'message': 'Tell position updated successfully.',\n",
|
||||||
" 'new_position': 'F1',\n",
|
" 'new_position': 'F1',\n",
|
||||||
" 'previous_position': None,\n",
|
" 'previous_position': None,\n",
|
||||||
" 'puck_name': 'PUCK006',\n",
|
" 'puck_name': 'PKK006',\n",
|
||||||
" 'status': 'updated',\n",
|
" 'status': 'updated',\n",
|
||||||
" 'tell': 'X06DA'},\n",
|
" 'tell': 'X06DA'},\n",
|
||||||
" {'message': 'Tell position updated successfully.',\n",
|
" {'message': 'Tell position updated successfully.',\n",
|
||||||
" 'new_position': 'F2',\n",
|
" 'new_position': 'F2',\n",
|
||||||
" 'previous_position': None,\n",
|
" 'previous_position': None,\n",
|
||||||
" 'puck_name': 'PUCK003',\n",
|
" 'puck_name': 'PKK005',\n",
|
||||||
" 'status': 'updated',\n",
|
" 'status': 'updated',\n",
|
||||||
" 'tell': 'X06DA'},\n",
|
" 'tell': 'X06DA'},\n",
|
||||||
" {'message': 'Tell position updated successfully.',\n",
|
" {'message': 'Tell position updated successfully.',\n",
|
||||||
" 'new_position': 'A1',\n",
|
" 'new_position': 'A1',\n",
|
||||||
" 'previous_position': None,\n",
|
" 'previous_position': None,\n",
|
||||||
" 'puck_name': 'PUCK002',\n",
|
" 'puck_name': 'PKK007',\n",
|
||||||
" 'status': 'updated',\n",
|
" 'status': 'updated',\n",
|
||||||
" 'tell': 'X06DA'},\n",
|
" 'tell': 'X06DA'},\n",
|
||||||
" {'message': 'Tell position updated successfully.',\n",
|
" {'message': 'Tell position updated successfully.',\n",
|
||||||
" 'new_position': 'A2',\n",
|
" 'new_position': 'A2',\n",
|
||||||
" 'previous_position': None,\n",
|
" 'previous_position': None,\n",
|
||||||
" 'puck_name': 'PUCK001',\n",
|
" 'puck_name': 'PKK004',\n",
|
||||||
" 'status': 'updated',\n",
|
" 'status': 'updated',\n",
|
||||||
" 'tell': 'X06DA'}]\n"
|
" 'tell': 'X06DA'}]\n"
|
||||||
]
|
]
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "stderr",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/urllib3/connectionpool.py:1097: InsecureRequestWarning: Unverified HTTPS request is being made to host '127.0.0.1'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n",
|
|
||||||
" warnings.warn(\n"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"execution_count": 78
|
"execution_count": 4
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"ExecuteTime": {
|
"ExecuteTime": {
|
||||||
"end_time": "2025-03-07T12:40:09.769132Z",
|
"end_time": "2025-04-28T14:37:23.148869Z",
|
||||||
"start_time": "2025-03-07T12:40:09.752103Z"
|
"start_time": "2025-04-28T14:37:23.115094Z"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -375,31 +376,72 @@
|
|||||||
"name": "stderr",
|
"name": "stderr",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/urllib3/connectionpool.py:1097: InsecureRequestWarning: Unverified HTTPS request is being made to host '127.0.0.1'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n",
|
"DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): localhost:8000\n",
|
||||||
" warnings.warn(\n"
|
"/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/urllib3/connectionpool.py:1097: InsecureRequestWarning: Unverified HTTPS request is being made to host 'localhost'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n",
|
||||||
|
" warnings.warn(\n",
|
||||||
|
"DEBUG:urllib3.connectionpool:https://localhost:8000 \"GET /pucks/with-tell-position?tell=X06DA HTTP/1.1\" 200 7592\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"Puck ID: 29, Puck Name: PKK006\n",
|
||||||
|
" Sample ID: 268, Sample Name: Sample268, Position: 13, Mount count: 0\n",
|
||||||
|
" Sample ID: 265, Sample Name: Sample265, Position: 3, Mount count: 0\n",
|
||||||
|
" Sample ID: 266, Sample Name: Sample266, Position: 4, Mount count: 0\n",
|
||||||
|
" Sample ID: 269, Sample Name: Sample269, Position: 16, Mount count: 0\n",
|
||||||
|
" Sample ID: 267, Sample Name: Sample267, Position: 6, Mount count: 0\n",
|
||||||
|
"Puck ID: 30, Puck Name: PKK007\n",
|
||||||
|
" Sample ID: 276, Sample Name: Sample276, Position: 15, Mount count: 0\n",
|
||||||
|
" Sample ID: 270, Sample Name: Sample270, Position: 1, Mount count: 0\n",
|
||||||
|
" Sample ID: 274, Sample Name: Sample274, Position: 6, Mount count: 0\n",
|
||||||
|
" Sample ID: 277, Sample Name: Sample277, Position: 16, Mount count: 0\n",
|
||||||
|
" Sample ID: 273, Sample Name: Sample273, Position: 5, Mount count: 0\n",
|
||||||
|
" Sample ID: 271, Sample Name: Sample271, Position: 2, Mount count: 0\n",
|
||||||
|
" Sample ID: 275, Sample Name: Sample275, Position: 7, Mount count: 0\n",
|
||||||
|
" Sample ID: 272, Sample Name: Sample272, Position: 4, Mount count: 0\n",
|
||||||
|
"Puck ID: 28, Puck Name: PKK005\n",
|
||||||
|
" Sample ID: 264, Sample Name: Sample264, Position: 11, Mount count: 0\n",
|
||||||
|
" Sample ID: 261, Sample Name: Sample261, Position: 6, Mount count: 0\n",
|
||||||
|
" Sample ID: 262, Sample Name: Sample262, Position: 7, Mount count: 0\n",
|
||||||
|
" Sample ID: 260, Sample Name: Sample260, Position: 5, Mount count: 0\n",
|
||||||
|
" Sample ID: 263, Sample Name: Sample263, Position: 9, Mount count: 0\n",
|
||||||
|
"Puck ID: 27, Puck Name: PKK004\n",
|
||||||
|
" Sample ID: 251, Sample Name: Sample251, Position: 3, Mount count: 0\n",
|
||||||
|
" Sample ID: 253, Sample Name: Sample253, Position: 7, Mount count: 0\n",
|
||||||
|
" Sample ID: 252, Sample Name: Sample252, Position: 4, Mount count: 0\n",
|
||||||
|
" Sample ID: 255, Sample Name: Sample255, Position: 9, Mount count: 0\n",
|
||||||
|
" Sample ID: 250, Sample Name: Sample250, Position: 2, Mount count: 0\n",
|
||||||
|
" Sample ID: 254, Sample Name: Sample254, Position: 8, Mount count: 0\n",
|
||||||
|
" Sample ID: 258, Sample Name: Sample258, Position: 14, Mount count: 0\n",
|
||||||
|
" Sample ID: 256, Sample Name: Sample256, Position: 12, Mount count: 0\n",
|
||||||
|
" Sample ID: 249, Sample Name: Sample249, Position: 1, Mount count: 0\n",
|
||||||
|
" Sample ID: 257, Sample Name: Sample257, Position: 13, Mount count: 0\n",
|
||||||
|
" Sample ID: 259, Sample Name: Sample259, Position: 16, Mount count: 0\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"execution_count": 2
|
"execution_count": 5
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"ExecuteTime": {
|
"ExecuteTime": {
|
||||||
"end_time": "2025-03-17T20:58:01.971747Z",
|
"end_time": "2025-04-29T07:40:05.945177Z",
|
||||||
"start_time": "2025-03-17T20:58:01.969438Z"
|
"start_time": "2025-04-29T07:40:05.942144Z"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"source": "sample_id = 247",
|
"source": "sample_id = 243",
|
||||||
"id": "54d4d46ca558e7b9",
|
"id": "54d4d46ca558e7b9",
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"execution_count": 2
|
"execution_count": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"ExecuteTime": {
|
"ExecuteTime": {
|
||||||
"end_time": "2025-03-14T19:35:49.714724Z",
|
"end_time": "2025-04-29T07:40:22.013545Z",
|
||||||
"start_time": "2025-03-14T19:35:49.691388Z"
|
"start_time": "2025-04-29T07:40:21.981147Z"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -416,8 +458,8 @@
|
|||||||
" # Define the payload with only `event_type`\n",
|
" # Define the payload with only `event_type`\n",
|
||||||
" sample_event_create = SampleEventCreate(\n",
|
" sample_event_create = SampleEventCreate(\n",
|
||||||
" sample_id=sample_id,\n",
|
" sample_id=sample_id,\n",
|
||||||
" event_type=\"Centering\" # Valid event type\n",
|
" #event_type=\"Centering\" # Valid event type\n",
|
||||||
" #event_type=\"Collecting\" # Valid event type\n",
|
" event_type=\"Collecting\" # Valid event type\n",
|
||||||
" )\n",
|
" )\n",
|
||||||
"\n",
|
"\n",
|
||||||
" # Debug the payload before sending\n",
|
" # Debug the payload before sending\n",
|
||||||
@ -448,10 +490,10 @@
|
|||||||
"name": "stderr",
|
"name": "stderr",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): 127.0.0.1:8000\n",
|
"DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): localhost:8000\n",
|
||||||
"/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/urllib3/connectionpool.py:1097: InsecureRequestWarning: Unverified HTTPS request is being made to host '127.0.0.1'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n",
|
"/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/urllib3/connectionpool.py:1103: InsecureRequestWarning: Unverified HTTPS request is being made to host 'localhost'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n",
|
||||||
" warnings.warn(\n",
|
" warnings.warn(\n",
|
||||||
"DEBUG:urllib3.connectionpool:https://127.0.0.1:8000 \"POST /samples/samples/247/events HTTP/1.1\" 200 405\n"
|
"DEBUG:urllib3.connectionpool:https://localhost:8000 \"POST /samples/samples/243/events HTTP/1.1\" 200 413\n"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -459,11 +501,11 @@
|
|||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"Payload being sent to API:\n",
|
"Payload being sent to API:\n",
|
||||||
"{\"event_type\":\"Centering\"}\n",
|
"{\"event_type\":\"Collecting\"}\n",
|
||||||
"API response:\n",
|
"API response:\n",
|
||||||
"('id', 247)\n",
|
"('id', 243)\n",
|
||||||
"('sample_name', 'Sample247')\n",
|
"('sample_name', 'Sample243')\n",
|
||||||
"('position', 16)\n",
|
"('position', 10)\n",
|
||||||
"('puck_id', 30)\n",
|
"('puck_id', 30)\n",
|
||||||
"('crystalname', None)\n",
|
"('crystalname', None)\n",
|
||||||
"('proteinname', None)\n",
|
"('proteinname', None)\n",
|
||||||
@ -471,13 +513,13 @@
|
|||||||
"('priority', None)\n",
|
"('priority', None)\n",
|
||||||
"('comments', None)\n",
|
"('comments', None)\n",
|
||||||
"('data_collection_parameters', None)\n",
|
"('data_collection_parameters', None)\n",
|
||||||
"('events', [SampleEventResponse(event_type='Mounting', id=482, sample_id=247, timestamp=datetime.datetime(2025, 3, 13, 13, 39)), SampleEventResponse(event_type='Centering', id=483, sample_id=247, timestamp=datetime.datetime(2025, 3, 14, 20, 35, 49))])\n",
|
"('events', [SampleEventResponse(event_type='Mounting', id=478, sample_id=243, timestamp=datetime.datetime(2025, 4, 28, 13, 35)), SampleEventResponse(event_type='Collecting', id=479, sample_id=243, timestamp=datetime.datetime(2025, 4, 29, 7, 40, 22, 3703))])\n",
|
||||||
"('mount_count', 0)\n",
|
"('mount_count', 0)\n",
|
||||||
"('unmount_count', 0)\n"
|
"('unmount_count', 0)\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"execution_count": 5
|
"execution_count": 3
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -504,8 +546,8 @@
|
|||||||
{
|
{
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"ExecuteTime": {
|
"ExecuteTime": {
|
||||||
"end_time": "2025-03-14T19:55:02.036739Z",
|
"end_time": "2025-04-29T07:40:39.462571Z",
|
||||||
"start_time": "2025-03-14T19:55:02.011806Z"
|
"start_time": "2025-04-29T07:40:39.385378Z"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -574,9 +616,9 @@
|
|||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): 127.0.0.1:8000\n",
|
"DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): 127.0.0.1:8000\n",
|
||||||
"/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/urllib3/connectionpool.py:1097: InsecureRequestWarning: Unverified HTTPS request is being made to host '127.0.0.1'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n",
|
"/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/urllib3/connectionpool.py:1103: InsecureRequestWarning: Unverified HTTPS request is being made to host '127.0.0.1'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n",
|
||||||
" warnings.warn(\n",
|
" warnings.warn(\n",
|
||||||
"DEBUG:urllib3.connectionpool:https://127.0.0.1:8000 \"POST /samples/247/upload-images HTTP/1.1\" 200 205\n"
|
"DEBUG:urllib3.connectionpool:https://127.0.0.1:8000 \"POST /samples/243/upload-images HTTP/1.1\" 200 205\n"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -586,11 +628,11 @@
|
|||||||
"Uploading after_dc.jpeg.jpg...\n",
|
"Uploading after_dc.jpeg.jpg...\n",
|
||||||
"API Response for after_dc.jpeg.jpg:\n",
|
"API Response for after_dc.jpeg.jpg:\n",
|
||||||
"200\n",
|
"200\n",
|
||||||
"{'pgroup': 'p20003', 'sample_id': 247, 'sample_event_id': 486, 'filepath': 'images/p20003/2025-03-14/Dewar Five/PKK007/16/Collecting_2025-03-14_20-54-48/after_dc.jpeg.jpg', 'status': 'active', 'comment': None, 'id': 8}\n"
|
"{'pgroup': 'p20003', 'sample_id': 243, 'sample_event_id': 479, 'filepath': 'images/p20003/2025-04-29/Dewar Five/PKK007/10/Collecting_2025-04-29_07-40-22/after_dc.jpeg.jpg', 'status': 'active', 'comment': None, 'id': 1}\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"execution_count": 12
|
"execution_count": 4
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -603,8 +645,8 @@
|
|||||||
{
|
{
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"ExecuteTime": {
|
"ExecuteTime": {
|
||||||
"end_time": "2025-03-14T19:54:48.102322Z",
|
"end_time": "2025-04-29T07:44:50.945943Z",
|
||||||
"start_time": "2025-03-14T19:54:48.080070Z"
|
"start_time": "2025-04-29T07:44:50.920743Z"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -716,10 +758,10 @@
|
|||||||
"name": "stderr",
|
"name": "stderr",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): 127.0.0.1:8000\n",
|
"DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): localhost:8000\n",
|
||||||
"/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/urllib3/connectionpool.py:1097: InsecureRequestWarning: Unverified HTTPS request is being made to host '127.0.0.1'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n",
|
"/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/urllib3/connectionpool.py:1103: InsecureRequestWarning: Unverified HTTPS request is being made to host 'localhost'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n",
|
||||||
" warnings.warn(\n",
|
" warnings.warn(\n",
|
||||||
"DEBUG:urllib3.connectionpool:https://127.0.0.1:8000 \"POST /samples/samples/247/experiment_parameters HTTP/1.1\" 200 860\n"
|
"DEBUG:urllib3.connectionpool:https://localhost:8000 \"POST /samples/samples/243/experiment_parameters HTTP/1.1\" 200 860\n"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -727,11 +769,11 @@
|
|||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"API Response:\n",
|
"API Response:\n",
|
||||||
"run_number=3 beamline_parameters=BeamlineParameters(synchrotron='Swiss Light Source', beamline='PXIII', detector=Detector(manufacturer='DECTRIS', model='PILATUS4 2M', type='photon-counting', serial_number='16684dscsd668468', detector_distance_mm=95.0, beam_center_x_px=512.0, beam_center_y_px=512.0, pixel_size_x_um=150.0, pixel_size_y_um=150.0), wavelength=1.0, ring_current_a=0.0, ring_mode='Machine Down', undulator=None, undulatorgap_mm=None, monochromator='Si111', transmission=1.0, focusing_optic='Kirkpatrick-Baez', beamline_flux_at_sample_ph_s=0.0, beam_size_width=30.0, beam_size_height=30.0, characterization=None, rotation=RotationParameters(omega_start_deg=0.0, omega_step=0.1, chi=0.0, phi=10.0, number_of_images=3600, exposure_time_s=0.02), grid_scan=None, jet=None, cryojet_temperature_k=None, humidifier_temperature_k=None, humidifier_humidity=None) sample_id=247 id=3\n"
|
"run_number=3 beamline_parameters=BeamlineParameters(synchrotron='Swiss Light Source', beamline='PXIII', detector=Detector(manufacturer='DECTRIS', model='PILATUS4 2M', type='photon-counting', serial_number='16684dscsd668468', detector_distance_mm=95.0, beam_center_x_px=512.0, beam_center_y_px=512.0, pixel_size_x_um=150.0, pixel_size_y_um=150.0), wavelength=1.0, ring_current_a=0.0, ring_mode='Machine Down', undulator=None, undulatorgap_mm=None, monochromator='Si111', transmission=1.0, focusing_optic='Kirkpatrick-Baez', beamline_flux_at_sample_ph_s=0.0, beam_size_width=30.0, beam_size_height=30.0, characterization=None, rotation=RotationParameters(omega_start_deg=0.0, omega_step=0.1, chi=0.0, phi=10.0, number_of_images=3600, exposure_time_s=0.02), grid_scan=None, jet=None, cryojet_temperature_k=None, humidifier_temperature_k=None, humidifier_humidity=None) sample_id=243 id=3\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"execution_count": 11
|
"execution_count": 7
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"metadata": {
|
"metadata": {
|
||||||
@ -939,8 +981,8 @@
|
|||||||
{
|
{
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"ExecuteTime": {
|
"ExecuteTime": {
|
||||||
"end_time": "2025-04-11T11:57:22.504015Z",
|
"end_time": "2025-04-28T19:27:24.672540Z",
|
||||||
"start_time": "2025-04-11T11:56:30.723778Z"
|
"start_time": "2025-04-28T19:25:49.421881Z"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -949,7 +991,9 @@
|
|||||||
"import sseclient\n",
|
"import sseclient\n",
|
||||||
"import json\n",
|
"import json\n",
|
||||||
"\n",
|
"\n",
|
||||||
"SSE_URL = \"https://127.0.0.1:8000/processing/jobs/stream\" # Replace clearly according to backend\n",
|
"# Replace clearly according to backend\n",
|
||||||
|
"SSE_URL = \"https://127.0.0.1:8000/processing/jobs/stream\"\n",
|
||||||
|
"#SSE_URL = \"https://mx-aare-test.psi.ch:1492/processing/jobs/stream\"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"def listen_and_process_jobs(url):\n",
|
"def listen_and_process_jobs(url):\n",
|
||||||
@ -1018,6 +1062,17 @@
|
|||||||
],
|
],
|
||||||
"id": "aef43f1265a23cb1",
|
"id": "aef43f1265a23cb1",
|
||||||
"outputs": [
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stderr",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): 127.0.0.1:8000\n",
|
||||||
|
"/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/urllib3/connectionpool.py:1097: InsecureRequestWarning: Unverified HTTPS request is being made to host '127.0.0.1'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n",
|
||||||
|
" warnings.warn(\n",
|
||||||
|
"DEBUG:urllib3.connectionpool:https://127.0.0.1:8000 \"GET /processing/jobs/stream HTTP/1.1\" 200 None\n",
|
||||||
|
"DEBUG:sseclient:Initialized SSE client from event source <Response [200]>\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
@ -1025,37 +1080,29 @@
|
|||||||
"Starting processing pipeline...\n"
|
"Starting processing pipeline...\n"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "stderr",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"/Users/gotthardg/PycharmProjects/aaredb/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py:1097: InsecureRequestWarning: Unverified HTTPS request is being made to host '127.0.0.1'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n",
|
|
||||||
" warnings.warn(\n"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"ename": "KeyboardInterrupt",
|
"ename": "KeyboardInterrupt",
|
||||||
"evalue": "",
|
"evalue": "",
|
||||||
"output_type": "error",
|
"output_type": "error",
|
||||||
"traceback": [
|
"traceback": [
|
||||||
"\u001B[31m---------------------------------------------------------------------------\u001B[39m",
|
"\u001B[0;31m---------------------------------------------------------------------------\u001B[0m",
|
||||||
"\u001B[31mKeyboardInterrupt\u001B[39m Traceback (most recent call last)",
|
"\u001B[0;31mKeyboardInterrupt\u001B[0m Traceback (most recent call last)",
|
||||||
"\u001B[36mCell\u001B[39m\u001B[36m \u001B[39m\u001B[32mIn[3]\u001B[39m\u001B[32m, line 70\u001B[39m\n\u001B[32m 66\u001B[39m \u001B[38;5;28mprint\u001B[39m(\u001B[33mf\u001B[39m\u001B[33m\"\u001B[39m\u001B[33mFailed to submit result for Job \u001B[39m\u001B[38;5;132;01m{\u001B[39;00mjob_id\u001B[38;5;132;01m}\u001B[39;00m\u001B[33m: \u001B[39m\u001B[38;5;132;01m{\u001B[39;00me\u001B[38;5;132;01m}\u001B[39;00m\u001B[33m\"\u001B[39m)\n\u001B[32m 69\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m \u001B[34m__name__\u001B[39m == \u001B[33m\"\u001B[39m\u001B[33m__main__\u001B[39m\u001B[33m\"\u001B[39m:\n\u001B[32m---> \u001B[39m\u001B[32m70\u001B[39m \u001B[43mlisten_and_process_jobs\u001B[49m\u001B[43m(\u001B[49m\u001B[43mSSE_URL\u001B[49m\u001B[43m)\u001B[49m\n",
|
"Cell \u001B[0;32mIn[16], line 72\u001B[0m\n\u001B[1;32m 68\u001B[0m \u001B[38;5;28mprint\u001B[39m(\u001B[38;5;124mf\u001B[39m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mFailed to submit result for Job \u001B[39m\u001B[38;5;132;01m{\u001B[39;00mjob_id\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m: \u001B[39m\u001B[38;5;132;01m{\u001B[39;00me\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m\"\u001B[39m)\n\u001B[1;32m 71\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;18m__name__\u001B[39m \u001B[38;5;241m==\u001B[39m \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m__main__\u001B[39m\u001B[38;5;124m\"\u001B[39m:\n\u001B[0;32m---> 72\u001B[0m \u001B[43mlisten_and_process_jobs\u001B[49m\u001B[43m(\u001B[49m\u001B[43mSSE_URL\u001B[49m\u001B[43m)\u001B[49m\n",
|
||||||
"\u001B[36mCell\u001B[39m\u001B[36m \u001B[39m\u001B[32mIn[3]\u001B[39m\u001B[32m, line 17\u001B[39m, in \u001B[36mlisten_and_process_jobs\u001B[39m\u001B[34m(url)\u001B[39m\n\u001B[32m 13\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m\n\u001B[32m 15\u001B[39m client = sseclient.SSEClient(response)\n\u001B[32m---> \u001B[39m\u001B[32m17\u001B[39m \u001B[43m\u001B[49m\u001B[38;5;28;43;01mfor\u001B[39;49;00m\u001B[43m \u001B[49m\u001B[43mevent\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;129;43;01min\u001B[39;49;00m\u001B[43m \u001B[49m\u001B[43mclient\u001B[49m\u001B[43m.\u001B[49m\u001B[43mevents\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\u001B[43m:\u001B[49m\n\u001B[32m 18\u001B[39m \u001B[43m \u001B[49m\u001B[38;5;28;43;01mtry\u001B[39;49;00m\u001B[43m:\u001B[49m\n\u001B[32m 19\u001B[39m \u001B[43m \u001B[49m\u001B[43mjobs\u001B[49m\u001B[43m \u001B[49m\u001B[43m=\u001B[49m\u001B[43m \u001B[49m\u001B[43mjson\u001B[49m\u001B[43m.\u001B[49m\u001B[43mloads\u001B[49m\u001B[43m(\u001B[49m\u001B[43mevent\u001B[49m\u001B[43m.\u001B[49m\u001B[43mdata\u001B[49m\u001B[43m)\u001B[49m\n",
|
"Cell \u001B[0;32mIn[16], line 19\u001B[0m, in \u001B[0;36mlisten_and_process_jobs\u001B[0;34m(url)\u001B[0m\n\u001B[1;32m 15\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m\n\u001B[1;32m 17\u001B[0m client \u001B[38;5;241m=\u001B[39m sseclient\u001B[38;5;241m.\u001B[39mSSEClient(response)\n\u001B[0;32m---> 19\u001B[0m \u001B[43m\u001B[49m\u001B[38;5;28;43;01mfor\u001B[39;49;00m\u001B[43m \u001B[49m\u001B[43mevent\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;129;43;01min\u001B[39;49;00m\u001B[43m \u001B[49m\u001B[43mclient\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mevents\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\u001B[43m:\u001B[49m\n\u001B[1;32m 20\u001B[0m \u001B[43m \u001B[49m\u001B[38;5;28;43;01mtry\u001B[39;49;00m\u001B[43m:\u001B[49m\n\u001B[1;32m 21\u001B[0m \u001B[43m \u001B[49m\u001B[43mjobs\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43m \u001B[49m\u001B[43mjson\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mloads\u001B[49m\u001B[43m(\u001B[49m\u001B[43mevent\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mdata\u001B[49m\u001B[43m)\u001B[49m\n",
|
||||||
"\u001B[36mFile \u001B[39m\u001B[32m~/PycharmProjects/aaredb/.venv/lib/python3.12/site-packages/sseclient/__init__.py:55\u001B[39m, in \u001B[36mSSEClient.events\u001B[39m\u001B[34m(self)\u001B[39m\n\u001B[32m 54\u001B[39m \u001B[38;5;28;01mdef\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34mevents\u001B[39m(\u001B[38;5;28mself\u001B[39m):\n\u001B[32m---> \u001B[39m\u001B[32m55\u001B[39m \u001B[43m \u001B[49m\u001B[38;5;28;43;01mfor\u001B[39;49;00m\u001B[43m \u001B[49m\u001B[43mchunk\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;129;43;01min\u001B[39;49;00m\u001B[43m \u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43m_read\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\u001B[43m:\u001B[49m\n\u001B[32m 56\u001B[39m \u001B[43m \u001B[49m\u001B[43mevent\u001B[49m\u001B[43m \u001B[49m\u001B[43m=\u001B[49m\u001B[43m \u001B[49m\u001B[43mEvent\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m 57\u001B[39m \u001B[43m \u001B[49m\u001B[38;5;66;43;03m# Split before decoding so splitlines() only uses \\r and \\n\u001B[39;49;00m\n",
|
"File \u001B[0;32m/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/sseclient/__init__.py:55\u001B[0m, in \u001B[0;36mSSEClient.events\u001B[0;34m(self)\u001B[0m\n\u001B[1;32m 54\u001B[0m \u001B[38;5;28;01mdef\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[38;5;21mevents\u001B[39m(\u001B[38;5;28mself\u001B[39m):\n\u001B[0;32m---> 55\u001B[0m \u001B[43m \u001B[49m\u001B[38;5;28;43;01mfor\u001B[39;49;00m\u001B[43m \u001B[49m\u001B[43mchunk\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;129;43;01min\u001B[39;49;00m\u001B[43m \u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_read\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\u001B[43m:\u001B[49m\n\u001B[1;32m 56\u001B[0m \u001B[43m \u001B[49m\u001B[43mevent\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43m \u001B[49m\u001B[43mEvent\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\n\u001B[1;32m 57\u001B[0m \u001B[43m \u001B[49m\u001B[38;5;66;43;03m# Split before decoding so splitlines() only uses \\r and \\n\u001B[39;49;00m\n",
|
||||||
"\u001B[36mFile \u001B[39m\u001B[32m~/PycharmProjects/aaredb/.venv/lib/python3.12/site-packages/sseclient/__init__.py:45\u001B[39m, in \u001B[36mSSEClient._read\u001B[39m\u001B[34m(self)\u001B[39m\n\u001B[32m 38\u001B[39m \u001B[38;5;250m\u001B[39m\u001B[33;03m\"\"\"Read the incoming event source stream and yield event chunks.\u001B[39;00m\n\u001B[32m 39\u001B[39m \n\u001B[32m 40\u001B[39m \u001B[33;03mUnfortunately it is possible for some servers to decide to break an\u001B[39;00m\n\u001B[32m 41\u001B[39m \u001B[33;03mevent into multiple HTTP chunks in the response. It is thus necessary\u001B[39;00m\n\u001B[32m 42\u001B[39m \u001B[33;03mto correctly stitch together consecutive response chunks and find the\u001B[39;00m\n\u001B[32m 43\u001B[39m \u001B[33;03mSSE delimiter (empty new line) to yield full, correct event chunks.\"\"\"\u001B[39;00m\n\u001B[32m 44\u001B[39m data = \u001B[33mb\u001B[39m\u001B[33m'\u001B[39m\u001B[33m'\u001B[39m\n\u001B[32m---> \u001B[39m\u001B[32m45\u001B[39m \u001B[43m\u001B[49m\u001B[38;5;28;43;01mfor\u001B[39;49;00m\u001B[43m \u001B[49m\u001B[43mchunk\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;129;43;01min\u001B[39;49;00m\u001B[43m \u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43m_event_source\u001B[49m\u001B[43m:\u001B[49m\n\u001B[32m 46\u001B[39m \u001B[43m \u001B[49m\u001B[38;5;28;43;01mfor\u001B[39;49;00m\u001B[43m \u001B[49m\u001B[43mline\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;129;43;01min\u001B[39;49;00m\u001B[43m \u001B[49m\u001B[43mchunk\u001B[49m\u001B[43m.\u001B[49m\u001B[43msplitlines\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;28;43;01mTrue\u001B[39;49;00m\u001B[43m)\u001B[49m\u001B[43m:\u001B[49m\n\u001B[32m 47\u001B[39m \u001B[43m \u001B[49m\u001B[43mdata\u001B[49m\u001B[43m \u001B[49m\u001B[43m+\u001B[49m\u001B[43m=\u001B[49m\u001B[43m \u001B[49m\u001B[43mline\u001B[49m\n",
|
"File \u001B[0;32m/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/sseclient/__init__.py:45\u001B[0m, in \u001B[0;36mSSEClient._read\u001B[0;34m(self)\u001B[0m\n\u001B[1;32m 38\u001B[0m \u001B[38;5;250m\u001B[39m\u001B[38;5;124;03m\"\"\"Read the incoming event source stream and yield event chunks.\u001B[39;00m\n\u001B[1;32m 39\u001B[0m \n\u001B[1;32m 40\u001B[0m \u001B[38;5;124;03mUnfortunately it is possible for some servers to decide to break an\u001B[39;00m\n\u001B[1;32m 41\u001B[0m \u001B[38;5;124;03mevent into multiple HTTP chunks in the response. It is thus necessary\u001B[39;00m\n\u001B[1;32m 42\u001B[0m \u001B[38;5;124;03mto correctly stitch together consecutive response chunks and find the\u001B[39;00m\n\u001B[1;32m 43\u001B[0m \u001B[38;5;124;03mSSE delimiter (empty new line) to yield full, correct event chunks.\"\"\"\u001B[39;00m\n\u001B[1;32m 44\u001B[0m data \u001B[38;5;241m=\u001B[39m \u001B[38;5;124mb\u001B[39m\u001B[38;5;124m'\u001B[39m\u001B[38;5;124m'\u001B[39m\n\u001B[0;32m---> 45\u001B[0m \u001B[43m\u001B[49m\u001B[38;5;28;43;01mfor\u001B[39;49;00m\u001B[43m \u001B[49m\u001B[43mchunk\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;129;43;01min\u001B[39;49;00m\u001B[43m \u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_event_source\u001B[49m\u001B[43m:\u001B[49m\n\u001B[1;32m 46\u001B[0m \u001B[43m \u001B[49m\u001B[38;5;28;43;01mfor\u001B[39;49;00m\u001B[43m \u001B[49m\u001B[43mline\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;129;43;01min\u001B[39;49;00m\u001B[43m \u001B[49m\u001B[43mchunk\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43msplitlines\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;28;43;01mTrue\u001B[39;49;00m\u001B[43m)\u001B[49m\u001B[43m:\u001B[49m\n\u001B[1;32m 47\u001B[0m \u001B[43m \u001B[49m\u001B[43mdata\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;241;43m+\u001B[39;49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43m \u001B[49m\u001B[43mline\u001B[49m\n",
|
||||||
"\u001B[36mFile \u001B[39m\u001B[32m~/PycharmProjects/aaredb/.venv/lib/python3.12/site-packages/requests/models.py:820\u001B[39m, in \u001B[36mResponse.iter_content.<locals>.generate\u001B[39m\u001B[34m()\u001B[39m\n\u001B[32m 818\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mhasattr\u001B[39m(\u001B[38;5;28mself\u001B[39m.raw, \u001B[33m\"\u001B[39m\u001B[33mstream\u001B[39m\u001B[33m\"\u001B[39m):\n\u001B[32m 819\u001B[39m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[32m--> \u001B[39m\u001B[32m820\u001B[39m \u001B[38;5;28;01myield from\u001B[39;00m \u001B[38;5;28mself\u001B[39m.raw.stream(chunk_size, decode_content=\u001B[38;5;28;01mTrue\u001B[39;00m)\n\u001B[32m 821\u001B[39m \u001B[38;5;28;01mexcept\u001B[39;00m ProtocolError \u001B[38;5;28;01mas\u001B[39;00m e:\n\u001B[32m 822\u001B[39m \u001B[38;5;28;01mraise\u001B[39;00m ChunkedEncodingError(e)\n",
|
"File \u001B[0;32m/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/requests/models.py:820\u001B[0m, in \u001B[0;36mResponse.iter_content.<locals>.generate\u001B[0;34m()\u001B[0m\n\u001B[1;32m 818\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mhasattr\u001B[39m(\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mraw, \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mstream\u001B[39m\u001B[38;5;124m\"\u001B[39m):\n\u001B[1;32m 819\u001B[0m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[0;32m--> 820\u001B[0m \u001B[38;5;28;01myield from\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mraw\u001B[38;5;241m.\u001B[39mstream(chunk_size, decode_content\u001B[38;5;241m=\u001B[39m\u001B[38;5;28;01mTrue\u001B[39;00m)\n\u001B[1;32m 821\u001B[0m \u001B[38;5;28;01mexcept\u001B[39;00m ProtocolError \u001B[38;5;28;01mas\u001B[39;00m e:\n\u001B[1;32m 822\u001B[0m \u001B[38;5;28;01mraise\u001B[39;00m ChunkedEncodingError(e)\n",
|
||||||
"\u001B[36mFile \u001B[39m\u001B[32m~/PycharmProjects/aaredb/.venv/lib/python3.12/site-packages/urllib3/response.py:1063\u001B[39m, in \u001B[36mHTTPResponse.stream\u001B[39m\u001B[34m(self, amt, decode_content)\u001B[39m\n\u001B[32m 1047\u001B[39m \u001B[38;5;250m\u001B[39m\u001B[33;03m\"\"\"\u001B[39;00m\n\u001B[32m 1048\u001B[39m \u001B[33;03mA generator wrapper for the read() method. A call will block until\u001B[39;00m\n\u001B[32m 1049\u001B[39m \u001B[33;03m``amt`` bytes have been read from the connection or until the\u001B[39;00m\n\u001B[32m (...)\u001B[39m\u001B[32m 1060\u001B[39m \u001B[33;03m 'content-encoding' header.\u001B[39;00m\n\u001B[32m 1061\u001B[39m \u001B[33;03m\"\"\"\u001B[39;00m\n\u001B[32m 1062\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mself\u001B[39m.chunked \u001B[38;5;129;01mand\u001B[39;00m \u001B[38;5;28mself\u001B[39m.supports_chunked_reads():\n\u001B[32m-> \u001B[39m\u001B[32m1063\u001B[39m \u001B[38;5;28;01myield from\u001B[39;00m \u001B[38;5;28mself\u001B[39m.read_chunked(amt, decode_content=decode_content)\n\u001B[32m 1064\u001B[39m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[32m 1065\u001B[39m \u001B[38;5;28;01mwhile\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m is_fp_closed(\u001B[38;5;28mself\u001B[39m._fp) \u001B[38;5;129;01mor\u001B[39;00m \u001B[38;5;28mlen\u001B[39m(\u001B[38;5;28mself\u001B[39m._decoded_buffer) > \u001B[32m0\u001B[39m:\n",
|
"File \u001B[0;32m/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/urllib3/response.py:1063\u001B[0m, in \u001B[0;36mstream\u001B[0;34m(self, amt, decode_content)\u001B[0m\n\u001B[1;32m 1059\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mauto_close:\n\u001B[1;32m 1060\u001B[0m io\u001B[38;5;241m.\u001B[39mIOBase\u001B[38;5;241m.\u001B[39mclose(\u001B[38;5;28mself\u001B[39m)\n\u001B[1;32m 1062\u001B[0m \u001B[38;5;129m@property\u001B[39m\n\u001B[0;32m-> 1063\u001B[0m \u001B[38;5;28;01mdef\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[38;5;21mclosed\u001B[39m(\u001B[38;5;28mself\u001B[39m) \u001B[38;5;241m-\u001B[39m\u001B[38;5;241m>\u001B[39m \u001B[38;5;28mbool\u001B[39m:\n\u001B[1;32m 1064\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mauto_close:\n\u001B[1;32m 1065\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m io\u001B[38;5;241m.\u001B[39mIOBase\u001B[38;5;241m.\u001B[39mclosed\u001B[38;5;241m.\u001B[39m\u001B[38;5;21m__get__\u001B[39m(\u001B[38;5;28mself\u001B[39m) \u001B[38;5;66;03m# type: ignore[no-any-return]\u001B[39;00m\n",
|
||||||
"\u001B[36mFile \u001B[39m\u001B[32m~/PycharmProjects/aaredb/.venv/lib/python3.12/site-packages/urllib3/response.py:1219\u001B[39m, in \u001B[36mHTTPResponse.read_chunked\u001B[39m\u001B[34m(self, amt, decode_content)\u001B[39m\n\u001B[32m 1216\u001B[39m amt = \u001B[38;5;28;01mNone\u001B[39;00m\n\u001B[32m 1218\u001B[39m \u001B[38;5;28;01mwhile\u001B[39;00m \u001B[38;5;28;01mTrue\u001B[39;00m:\n\u001B[32m-> \u001B[39m\u001B[32m1219\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43m_update_chunk_length\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m 1220\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mself\u001B[39m.chunk_left == \u001B[32m0\u001B[39m:\n\u001B[32m 1221\u001B[39m \u001B[38;5;28;01mbreak\u001B[39;00m\n",
|
"File \u001B[0;32m/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/urllib3/response.py:1219\u001B[0m, in \u001B[0;36mread_chunked\u001B[0;34m(self, amt, decode_content)\u001B[0m\n\u001B[1;32m 1215\u001B[0m \u001B[38;5;129m@property\u001B[39m\n\u001B[1;32m 1216\u001B[0m \u001B[38;5;28;01mdef\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[38;5;21murl\u001B[39m(\u001B[38;5;28mself\u001B[39m) \u001B[38;5;241m-\u001B[39m\u001B[38;5;241m>\u001B[39m \u001B[38;5;28mstr\u001B[39m \u001B[38;5;241m|\u001B[39m \u001B[38;5;28;01mNone\u001B[39;00m:\n\u001B[1;32m 1217\u001B[0m \u001B[38;5;250m \u001B[39m\u001B[38;5;124;03m\"\"\"\u001B[39;00m\n\u001B[1;32m 1218\u001B[0m \u001B[38;5;124;03m Returns the URL that was the source of this response.\u001B[39;00m\n\u001B[0;32m-> 1219\u001B[0m \u001B[38;5;124;03m If the request that generated this response redirected, this method\u001B[39;00m\n\u001B[1;32m 1220\u001B[0m \u001B[38;5;124;03m will return the final redirect location.\u001B[39;00m\n\u001B[1;32m 1221\u001B[0m \u001B[38;5;124;03m \"\"\"\u001B[39;00m\n\u001B[1;32m 1222\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_request_url\n",
|
||||||
"\u001B[36mFile \u001B[39m\u001B[32m~/PycharmProjects/aaredb/.venv/lib/python3.12/site-packages/urllib3/response.py:1138\u001B[39m, in \u001B[36mHTTPResponse._update_chunk_length\u001B[39m\u001B[34m(self)\u001B[39m\n\u001B[32m 1136\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mself\u001B[39m.chunk_left \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m:\n\u001B[32m 1137\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m\n\u001B[32m-> \u001B[39m\u001B[32m1138\u001B[39m line = \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43m_fp\u001B[49m\u001B[43m.\u001B[49m\u001B[43mfp\u001B[49m\u001B[43m.\u001B[49m\u001B[43mreadline\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m \u001B[38;5;66;03m# type: ignore[union-attr]\u001B[39;00m\n\u001B[32m 1139\u001B[39m line = line.split(\u001B[33mb\u001B[39m\u001B[33m\"\u001B[39m\u001B[33m;\u001B[39m\u001B[33m\"\u001B[39m, \u001B[32m1\u001B[39m)[\u001B[32m0\u001B[39m]\n\u001B[32m 1140\u001B[39m \u001B[38;5;28;01mtry\u001B[39;00m:\n",
|
"File \u001B[0;32m/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/urllib3/response.py:1138\u001B[0m, in \u001B[0;36m_update_chunk_length\u001B[0;34m(self)\u001B[0m\n\u001B[1;32m 1136\u001B[0m returned_chunk \u001B[38;5;241m=\u001B[39m value\n\u001B[1;32m 1137\u001B[0m \u001B[38;5;28;01melse\u001B[39;00m: \u001B[38;5;66;03m# amt > self.chunk_left\u001B[39;00m\n\u001B[0;32m-> 1138\u001B[0m returned_chunk \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_fp\u001B[38;5;241m.\u001B[39m_safe_read(\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mchunk_left) \u001B[38;5;66;03m# type: ignore[union-attr]\u001B[39;00m\n\u001B[1;32m 1139\u001B[0m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_fp\u001B[38;5;241m.\u001B[39m_safe_read(\u001B[38;5;241m2\u001B[39m) \u001B[38;5;66;03m# type: ignore[union-attr] # Toss the CRLF at the end of the chunk.\u001B[39;00m\n\u001B[1;32m 1140\u001B[0m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mchunk_left \u001B[38;5;241m=\u001B[39m \u001B[38;5;28;01mNone\u001B[39;00m\n",
|
||||||
"\u001B[36mFile \u001B[39m\u001B[32m~/anaconda3/lib/python3.12/socket.py:720\u001B[39m, in \u001B[36mSocketIO.readinto\u001B[39m\u001B[34m(self, b)\u001B[39m\n\u001B[32m 718\u001B[39m \u001B[38;5;28;01mwhile\u001B[39;00m \u001B[38;5;28;01mTrue\u001B[39;00m:\n\u001B[32m 719\u001B[39m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[32m--> \u001B[39m\u001B[32m720\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43m_sock\u001B[49m\u001B[43m.\u001B[49m\u001B[43mrecv_into\u001B[49m\u001B[43m(\u001B[49m\u001B[43mb\u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m 721\u001B[39m \u001B[38;5;28;01mexcept\u001B[39;00m timeout:\n\u001B[32m 722\u001B[39m \u001B[38;5;28mself\u001B[39m._timeout_occurred = \u001B[38;5;28;01mTrue\u001B[39;00m\n",
|
"File \u001B[0;32m/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/socket.py:707\u001B[0m, in \u001B[0;36mSocketIO.readinto\u001B[0;34m(self, b)\u001B[0m\n\u001B[1;32m 705\u001B[0m \u001B[38;5;28;01mwhile\u001B[39;00m \u001B[38;5;28;01mTrue\u001B[39;00m:\n\u001B[1;32m 706\u001B[0m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[0;32m--> 707\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_sock\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mrecv_into\u001B[49m\u001B[43m(\u001B[49m\u001B[43mb\u001B[49m\u001B[43m)\u001B[49m\n\u001B[1;32m 708\u001B[0m \u001B[38;5;28;01mexcept\u001B[39;00m timeout:\n\u001B[1;32m 709\u001B[0m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_timeout_occurred \u001B[38;5;241m=\u001B[39m \u001B[38;5;28;01mTrue\u001B[39;00m\n",
|
||||||
"\u001B[36mFile \u001B[39m\u001B[32m~/anaconda3/lib/python3.12/ssl.py:1251\u001B[39m, in \u001B[36mSSLSocket.recv_into\u001B[39m\u001B[34m(self, buffer, nbytes, flags)\u001B[39m\n\u001B[32m 1247\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m flags != \u001B[32m0\u001B[39m:\n\u001B[32m 1248\u001B[39m \u001B[38;5;28;01mraise\u001B[39;00m \u001B[38;5;167;01mValueError\u001B[39;00m(\n\u001B[32m 1249\u001B[39m \u001B[33m\"\u001B[39m\u001B[33mnon-zero flags not allowed in calls to recv_into() on \u001B[39m\u001B[38;5;132;01m%s\u001B[39;00m\u001B[33m\"\u001B[39m %\n\u001B[32m 1250\u001B[39m \u001B[38;5;28mself\u001B[39m.\u001B[34m__class__\u001B[39m)\n\u001B[32m-> \u001B[39m\u001B[32m1251\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43mread\u001B[49m\u001B[43m(\u001B[49m\u001B[43mnbytes\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mbuffer\u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m 1252\u001B[39m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[32m 1253\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28msuper\u001B[39m().recv_into(buffer, nbytes, flags)\n",
|
"File \u001B[0;32m/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py:1216\u001B[0m, in \u001B[0;36mSSLSocket.recv_into\u001B[0;34m(self, buffer, nbytes, flags)\u001B[0m\n\u001B[1;32m 1212\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m flags \u001B[38;5;241m!=\u001B[39m \u001B[38;5;241m0\u001B[39m:\n\u001B[1;32m 1213\u001B[0m \u001B[38;5;28;01mraise\u001B[39;00m \u001B[38;5;167;01mValueError\u001B[39;00m(\n\u001B[1;32m 1214\u001B[0m \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mnon-zero flags not allowed in calls to recv_into() on \u001B[39m\u001B[38;5;132;01m%s\u001B[39;00m\u001B[38;5;124m\"\u001B[39m \u001B[38;5;241m%\u001B[39m\n\u001B[1;32m 1215\u001B[0m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m\u001B[38;5;18m__class__\u001B[39m)\n\u001B[0;32m-> 1216\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mread\u001B[49m\u001B[43m(\u001B[49m\u001B[43mnbytes\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mbuffer\u001B[49m\u001B[43m)\u001B[49m\n\u001B[1;32m 1217\u001B[0m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[1;32m 1218\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28msuper\u001B[39m()\u001B[38;5;241m.\u001B[39mrecv_into(buffer, nbytes, flags)\n",
|
||||||
"\u001B[36mFile \u001B[39m\u001B[32m~/anaconda3/lib/python3.12/ssl.py:1103\u001B[39m, in \u001B[36mSSLSocket.read\u001B[39m\u001B[34m(self, len, buffer)\u001B[39m\n\u001B[32m 1101\u001B[39m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[32m 1102\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m buffer \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m:\n\u001B[32m-> \u001B[39m\u001B[32m1103\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43m_sslobj\u001B[49m\u001B[43m.\u001B[49m\u001B[43mread\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;28;43mlen\u001B[39;49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mbuffer\u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m 1104\u001B[39m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[32m 1105\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28mself\u001B[39m._sslobj.read(\u001B[38;5;28mlen\u001B[39m)\n",
|
"File \u001B[0;32m/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py:1072\u001B[0m, in \u001B[0;36mSSLSocket.read\u001B[0;34m(self, len, buffer)\u001B[0m\n\u001B[1;32m 1070\u001B[0m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[1;32m 1071\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m buffer \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m:\n\u001B[0;32m-> 1072\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_sslobj\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mread\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;28;43mlen\u001B[39;49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mbuffer\u001B[49m\u001B[43m)\u001B[49m\n\u001B[1;32m 1073\u001B[0m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[1;32m 1074\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_sslobj\u001B[38;5;241m.\u001B[39mread(\u001B[38;5;28mlen\u001B[39m)\n",
|
||||||
"\u001B[31mKeyboardInterrupt\u001B[39m: "
|
"\u001B[0;31mKeyboardInterrupt\u001B[0m: "
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"execution_count": 3
|
"execution_count": 16
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user