Checkpoint current transcription pipeline state

This commit is contained in:
Adolfo Reyna
2026-03-16 21:11:51 -04:00
parent 50f58dbc22
commit ffeb996d7e
5 changed files with 68 additions and 31 deletions
+30 -12
View File
@@ -57,18 +57,36 @@ def run_distribution(in_queue, args):
log_debug(lang_msg)
if args.ingest:
delay, max_delay, success = 1, 15, False
while not success:
try:
response = requests.post(INGEST_URL, json=payload, timeout=5)
if response.status_code == 200: success = True
else: print(f"[Distribute Error] {response.status_code}. Retrying...")
except Exception as e:
print(f"[Distribute Error] {e}. Retrying...")
if not success:
time.sleep(delay)
delay = min(delay * 2, max_delay)
# Flat JSON Schema: Keep only what's needed for the server
ingest_payload = {
"original": payload.get("original"),
"speaker": payload.get("speaker"),
"ts": payload.get("ts")
}
has_any_translation = False
for lang in ["es", "fr", "ar", "en"]:
if payload.get(lang):
ingest_payload[lang] = payload[lang]
has_any_translation = True
# If only-translate-llm is on, ONLY send when we have a translation (paragraph-level)
should_send = True
if getattr(args, "only_translate_llm", False) and not has_any_translation:
should_send = False
if should_send:
delay, max_delay, success = 1, 15, False
while not success:
try:
response = requests.post(INGEST_URL, json=ingest_payload, timeout=5)
if response.status_code == 200: success = True
else: print(f"[Distribute Error] {response.status_code}. Retrying...")
except Exception as e:
print(f"[Distribute Error] {e}. Retrying...")
if not success:
time.sleep(delay)
delay = min(delay * 2, max_delay)
except Exception as e:
print(f"[Distribute] Error: {e}")