Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use a certifi ssl context for r2 uploads #306

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions horde_worker_regen/process_management/process_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import os
import queue
import random
import ssl
import sys
import time
from asyncio import CancelledError, Task
Expand All @@ -22,6 +23,7 @@

import aiohttp
import aiohttp.client_exceptions
import certifi
import PIL
import PIL.Image
import psutil
Expand Down Expand Up @@ -89,6 +91,8 @@
)
from horde_worker_regen.process_management.worker_entry_points import start_inference_process, start_safety_process

sslcontext = ssl.create_default_context(cafile=certifi.where())

# This is due to Linux/Windows differences in the multiprocessing module
try:
from multiprocessing.connection import PipeConnection as Connection # type: ignore
Expand Down Expand Up @@ -2469,6 +2473,7 @@ async def _do_upload(new_submit: PendingSubmitJob, image_in_buffer_bytes: bytes)
data=image_in_buffer_bytes,
skip_auto_headers=["content-type"],
timeout=aiohttp.ClientTimeout(total=10),
ssl=sslcontext,
) as response:
if response.status != 200:
logger.error(f"Failed to upload image to R2: {response}")
Expand Down
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
numpy==1.26.4
torch==2.3.1
qrcode==7.4.2
qrcode==7.4.2 # >8 breaks horde-engine 2.15.3 via the qr code generation nodes

certifi # Required for SSL cert resolution

horde_sdk~=0.14.11
horde_safety~=0.2.3
Expand Down
Loading