All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 2m33s
Merges full history from art-dag/mono.git into the monorepo under the artdag/ directory. Contains: core (DAG engine), l1 (Celery rendering server), l2 (ActivityPub registry), common (shared templates/middleware), client (CLI), test (e2e). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> git-subtree-dir: artdag git-subtree-mainline:1a179de547git-subtree-split:4c2e716558
52 lines
1.5 KiB
Python
52 lines
1.5 KiB
Python
"""
|
|
Art DAG Celery Application
|
|
|
|
Streaming video rendering for the Art DAG system.
|
|
Uses S-expression recipes with frame-by-frame processing.
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
from celery import Celery
|
|
from celery.signals import worker_ready
|
|
|
|
# Use central config
|
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
from app.config import settings
|
|
|
|
app = Celery(
|
|
'art_celery',
|
|
broker=settings.redis_url,
|
|
backend=settings.redis_url,
|
|
include=['tasks', 'tasks.streaming', 'tasks.ipfs_upload']
|
|
)
|
|
|
|
|
|
@worker_ready.connect
|
|
def log_config_on_startup(sender, **kwargs):
|
|
"""Log configuration when worker starts."""
|
|
print("=" * 60, file=sys.stderr)
|
|
print("WORKER STARTED - CONFIGURATION", file=sys.stderr)
|
|
print("=" * 60, file=sys.stderr)
|
|
settings.log_config()
|
|
print(f"Worker: {sender}", file=sys.stderr)
|
|
print("=" * 60, file=sys.stderr)
|
|
|
|
app.conf.update(
|
|
result_expires=86400 * 7, # 7 days - allow time for recovery after restarts
|
|
task_serializer='json',
|
|
accept_content=['json', 'pickle'], # pickle needed for internal Celery messages
|
|
result_serializer='json',
|
|
event_serializer='json',
|
|
timezone='UTC',
|
|
enable_utc=True,
|
|
task_track_started=True,
|
|
task_acks_late=True, # Don't ack until task completes - survives worker restart
|
|
worker_prefetch_multiplier=1,
|
|
task_reject_on_worker_lost=True, # Re-queue if worker dies
|
|
task_acks_on_failure_or_timeout=True, # Ack failed tasks so they don't retry forever
|
|
)
|
|
|
|
if __name__ == '__main__':
|
|
app.start()
|