Task: Generate the Report Through the Async Job API
The worker in /root/task needs to generate the monthly report through the async API flow:
- submit the report request,
- poll job status until it is really complete,
- only then fetch the final result,
- save the report to
/root/task/report_output.json.
The starter has already been broken into helpers, but the readiness gate still treats an in-progress task as if it were safe to read.
Start here:
/root/task/README.md/root/task/report_workflow.py/root/task/report_client.py/root/task/status_gate.py/root/task/polling_policy.py/root/task/mock_api.py/root/task/request.json
What I need:
- Use the POST → poll status → GET result async pattern.
- Wait between polls so the status endpoint is not hammered.
- Fetch the result only after the task is completed.
- Save the final report to
/root/task/report_output.json.
Save all edits under /root/task. Do not move the project outside /root/task, and do not replace it with a stub.
Output contract:
- Write
/root/task/report_output.jsonas the final report payload from the completed job'sreportfield, not the polling envelope. - The JSON root must be
{ "month": string, "totals": { "new_signups": number, "revenue": number }, "segments": string[] }. - The observable flow should be POST report request, poll status with waits between polls, then GET the result.