Python: Add integration tests for durabletask package (#3317)

* Add integration tests

* Fix flaky test

* Fix env viz

* Fix tests and address feedback
This commit is contained in:
Laveesh Rohra
2026-01-21 14:31:24 -08:00
committed by GitHub
Unverified
parent cd77193742
commit e032133748
19 changed files with 1482 additions and 25 deletions
@@ -134,7 +134,14 @@ def content_generation_hitl_orchestration(context: DurableOrchestrationContext)
)
return {"content": content.content}
context.set_custom_status("Content rejected by human reviewer. Incorporating feedback and regenerating...")
context.set_custom_status(
"Content rejected by human reviewer. Incorporating feedback and regenerating..."
)
# Check if we've exhausted attempts
if attempt >= payload.max_review_attempts:
break
rewrite_prompt = (
"The content was rejected by a human reviewer. Please rewrite the article incorporating their feedback.\n\n"
f"Human Feedback: {approval_payload.feedback or 'No feedback provided.'}"
@@ -154,9 +161,15 @@ def content_generation_hitl_orchestration(context: DurableOrchestrationContext)
context.set_custom_status(
f"Human approval timed out after {payload.approval_timeout_hours} hour(s). Treating as rejection."
)
raise TimeoutError(f"Human approval timed out after {payload.approval_timeout_hours} hour(s).")
raise RuntimeError(f"Content could not be approved after {payload.max_review_attempts} iteration(s).")
raise TimeoutError(
f"Human approval timed out after {payload.approval_timeout_hours} hour(s)."
)
# If we exit the loop without returning, max attempts were exhausted
context.set_custom_status("Max review attempts exhausted.")
raise RuntimeError(
f"Content could not be approved after {payload.max_review_attempts} iteration(s)."
)
# 5. HTTP endpoint that starts the human-in-the-loop orchestration.