fix: improve batch job monitoring with 1-minute polling

- Change from exponential backoff to fixed 1-minute polling interval
- Log status on EVERY check (not just on status change)
- Show check number and elapsed time in each log
- Increase max timeout to 120 minutes (was 100 attempts with variable times)
- Add better status symbols for completed/failed states

This fixes the issue where batches completed on OpenAI's side but monitoring
appeared to hang because it was waiting too long between checks.

Note: Error files with API tokens are now excluded from commits for security.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
czlonkowski
2025-09-30 10:38:36 +02:00
parent fff47f9f9d
commit 2057f98e76
3 changed files with 27 additions and 141 deletions

Binary file not shown.

View File

@@ -1,112 +0,0 @@
{"id": "batch_req_68db84f9b1608190905d075cdff34e03", "custom_id": "template-3443", "response": {"status_code": 400, "request_id": "8359066bb976124a37c33b780e840d5c", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84fad45c8190a8bb0903beed487a", "custom_id": "template-2415", "response": {"status_code": 400, "request_id": "ee2f767ac83b2d7c0b59837c42e4a20c", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84fac1f08190962b0264cf0a5ded", "custom_id": "template-3654", "response": {"status_code": 400, "request_id": "802eb96d3c255bbb319d4405a3f4651a", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84f9acdc81909c30c1b0262a9701", "custom_id": "template-3657", "response": {"status_code": 400, "request_id": "d4fe9b0253879e061e0b4dda813a01dd", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84f9af5c81908eed58d785b2872f", "custom_id": "template-4968", "response": {"status_code": 400, "request_id": "1f19edc45d0ea8ffd2562ee10fae79be", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84fa0e6081908e24baf2e38fbec3", "custom_id": "template-2907", "response": {"status_code": 400, "request_id": "d9b9404ab4ed27dc93cea01ab545a3a9", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84f9cc748190b4bd0729a36936fc", "custom_id": "template-4452", "response": {"status_code": 400, "request_id": "a380f18bbbdfbde1195b8d28d34317d5", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84f9c2188190ae8a4a4b6befbe23", "custom_id": "template-4635", "response": {"status_code": 400, "request_id": "796bfa695c2178b8c2d9b745ddc6bad5", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84fa04048190aeb6d6930326740f", "custom_id": "template-2463", "response": {"status_code": 400, "request_id": "d0491ad90f65b0bfc5af7d4b5b2c5560", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84faa8908190b454a31038b8b7ce", "custom_id": "template-3796", "response": {"status_code": 400, "request_id": "61f73f1c05307e996ca9ae28e614b2eb", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84fbb8948190a45ba857c2ec11c7", "custom_id": "template-3585", "response": {"status_code": 400, "request_id": "29e47af07c2555700b6b1736e942d6ce", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84fb7fb08190bd18b773b4aa7470", "custom_id": "template-5835", "response": {"status_code": 400, "request_id": "ce38b2d32c2c142a2f160ac034288be6", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84fb76988190a7965ace4186a569", "custom_id": "template-3335", "response": {"status_code": 400, "request_id": "bfd480657d60b3c5b48a9a12f7c81f22", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84fb0f9c819095ad1a76ce40a039", "custom_id": "template-2737", "response": {"status_code": 400, "request_id": "0af82b259d78681f9dc668f9254b98b1", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84fc40848190ae1f4d6aa18097d3", "custom_id": "template-2919", "response": {"status_code": 400, "request_id": "f87aa5b793678f91dd52891050c233f7", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84fb51808190b5ced47d254ab9ff", "custom_id": "template-3010", "response": {"status_code": 400, "request_id": "4742344507233e0785bdf4bf16bfe25b", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84fb6b04819094d8832bcbaf69ba", "custom_id": "template-2424", "response": {"status_code": 400, "request_id": "1651ab4779a2ba9877bb1337e1919f51", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84fc7b5881909d70d2adb910d443", "custom_id": "template-4237", "response": {"status_code": 400, "request_id": "3e1ea83af796b7ff39e1946b035f745b", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84fc0acc81908f3b2c26317fb6cf", "custom_id": "template-4589", "response": {"status_code": 400, "request_id": "d8870f16fee72be27ce38d3c305a99cb", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84fca0ac819096bb92148cbb74db", "custom_id": "template-3195", "response": {"status_code": 400, "request_id": "86d5de9ef23689df1393b9e7999313c2", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84fc6cb08190ac4d055c6de89ac3", "custom_id": "template-3670", "response": {"status_code": 400, "request_id": "a538447256c1206fca7386f2cef1d148", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84fcb03c819093ab53ffc05b2b21", "custom_id": "template-5385", "response": {"status_code": 400, "request_id": "ab80dfbc9433703ec3f506882ddcacf4", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84fcca748190be482766f1af859b", "custom_id": "template-3564", "response": {"status_code": 400, "request_id": "1495d3e38c9a61dbad7b5b6e41c06fbd", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84fdcdb08190a9181b98ea4aaa26", "custom_id": "template-3599", "response": {"status_code": 400, "request_id": "dff0ed669b037885acc41dfaaea3633c", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84fd30bc8190a42a61c1dcb0b024", "custom_id": "template-3829", "response": {"status_code": 400, "request_id": "de5d9430ca60c6d1cfffd2077088b19e", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84fd449481909be67a5c1b3e9b1d", "custom_id": "template-3581", "response": {"status_code": 400, "request_id": "4d01c8aae8d3ca64aa7bbb38e310901e", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84fd714081908e6fcfb047d94422", "custom_id": "template-3725", "response": {"status_code": 400, "request_id": "96850d2d3d5bc1325643b22fa7b15a9e", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84fd84f48190bcf515d89ad12ad6", "custom_id": "template-4152", "response": {"status_code": 400, "request_id": "567809141b1bc8fd127679571e7c20f4", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84fdbf548190a167d4568751d019", "custom_id": "template-4226", "response": {"status_code": 400, "request_id": "0f20a55f06831fae0e00f9de97ecb6d9", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84fe10248190b94dae49381a91fa", "custom_id": "template-5904", "response": {"status_code": 400, "request_id": "22cf13e72a1b1235490435573884c043", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84fdf5ec8190b2b693b5f679459a", "custom_id": "template-8428", "response": {"status_code": 400, "request_id": "d9215cafc3d63b6c237786fce0fe049b", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84fe0b548190be21dfd1ba908db8", "custom_id": "template-2932", "response": {"status_code": 400, "request_id": "387ba03a4ec621cf7419b65b272a38a2", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84fe84208190833aaafc17b63ed4", "custom_id": "template-4004", "response": {"status_code": 400, "request_id": "399f866fcca20032ab3617176c6374b8", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84ff36188190a88c9ae9f4ac5ef7", "custom_id": "template-4744", "response": {"status_code": 400, "request_id": "82922f3b57cfc5c4d895ce9e9bfb6630", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84feb9d88190a880a7a9f85da56a", "custom_id": "template-6653", "response": {"status_code": 400, "request_id": "a9cf310dc718f72ad28a9ca7e8cbc031", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84feb4348190a2d7ddbd3a3d99f2", "custom_id": "template-8326", "response": {"status_code": 400, "request_id": "b2c304a13a4cf219fe9f3c603b02c597", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84feca8481908e24726c0965c842", "custom_id": "template-3794", "response": {"status_code": 400, "request_id": "4f7afb24e633f7a60874de2761745fbd", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84ff6760819089589f56b1078463", "custom_id": "template-4372", "response": {"status_code": 400, "request_id": "e4e4c59a3f64ba65b6fd788ff0688e50", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84ff5f3081909fc60d5dcf5dc0bd", "custom_id": "template-4834", "response": {"status_code": 400, "request_id": "537adf89871f0afd74e88f6545272208", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84ff4e088190b063a3f47dbedd2e", "custom_id": "template-5146", "response": {"status_code": 400, "request_id": "d308c392f5529e4ebae7aac9e7473ae8", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84ff4d848190aff48c247d56368b", "custom_id": "template-3788", "response": {"status_code": 400, "request_id": "c7d52ebe72253b8c76458270cad23da2", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84ff5d4c81908ab675efd7603569", "custom_id": "template-3828", "response": {"status_code": 400, "request_id": "da202a2c5cf38c11da469a6a1da0ab24", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db85013c308190b8b3b9ff0f722571", "custom_id": "template-4564", "response": {"status_code": 400, "request_id": "94e8f5ddf62b145d3d6a830b17eb3847", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84fff7f88190accf02fc9410cdd0", "custom_id": "template-8260", "response": {"status_code": 400, "request_id": "14cfe8c70551a3d88e0d8dcdc00624a6", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db84fff9108190be09631fc849b2ae", "custom_id": "template-8604", "response": {"status_code": 400, "request_id": "429800a0dbeea60c8dad66f86bab6f45", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db850051a081908a75e0d6661fe942", "custom_id": "template-7608", "response": {"status_code": 400, "request_id": "f9ba7bc9464b6721f6a8b7a31e693b5e", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db85009da481908062a78efcf9a416", "custom_id": "template-5103", "response": {"status_code": 400, "request_id": "011e69c3ef9a11d41313e23e90cb0c1f", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db85009e508190a3558be373374ca2", "custom_id": "template-8591", "response": {"status_code": 400, "request_id": "4d471a76797ab9c73c99078919b6262f", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db8500c5cc8190abd8d54be2214645", "custom_id": "template-8450", "response": {"status_code": 400, "request_id": "b4bca43a0a761e8fe238acc59ff2fde2", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db850330dc8190836d7ed2b853c6b8", "custom_id": "template-6840", "response": {"status_code": 400, "request_id": "8145bf9e3583fc39e13dbb639a1d889d", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db8500ab808190839914a4d7aae10f", "custom_id": "template-7480", "response": {"status_code": 400, "request_id": "f23a9ceb15ed5ddbb975b48d650a9da1", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db8501052881908adf93ab1bafb9ab", "custom_id": "template-4503", "response": {"status_code": 400, "request_id": "5539460de0359b55fd41d61f1000222e", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db850150148190909df8e1b1b566ae", "custom_id": "template-4980", "response": {"status_code": 400, "request_id": "50640a00f59c0f461a105f598abc1f7b", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db85013e5081908056243f59315de4", "custom_id": "template-4416", "response": {"status_code": 400, "request_id": "a77181376db74649e83221c63f742adb", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db8501ec508190a1a5b4049ed574d0", "custom_id": "template-3568", "response": {"status_code": 400, "request_id": "873cf619d33adc6716d259ce4a4efaa5", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db8501efac81909e036a510ea6dddb", "custom_id": "template-6915", "response": {"status_code": 400, "request_id": "0e6e6c86e23630f919c2da2656682fde", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db8501ebc081909a0c943166cedd47", "custom_id": "template-3474", "response": {"status_code": 400, "request_id": "311cc0a805259b4b744d9543d5c8d056", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db85020910819085657bd1f13b8eb9", "custom_id": "template-4348", "response": {"status_code": 400, "request_id": "cb07b716652a9a7f8bc67fec8c904726", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db85023f0481909fe958875a52790e", "custom_id": "template-7971", "response": {"status_code": 400, "request_id": "251c4fb970663c87be3a4f3c0cccb3d0", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db850244608190ac9392c45b006812", "custom_id": "template-7607", "response": {"status_code": 400, "request_id": "68c8e9110a908086451b9c5d056c2914", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db850286348190b7d6eb8f7ee3e2df", "custom_id": "template-4762", "response": {"status_code": 400, "request_id": "cb4ab973a1ae4a6ce3928fa3185f6ae4", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db8502d43c81908e64d2b8c5d7449b", "custom_id": "template-4259", "response": {"status_code": 400, "request_id": "9c1b026ac0c4c4fb16b3569fcff61482", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db85029b9081909c43cb49b9e35c5b", "custom_id": "template-6186", "response": {"status_code": 400, "request_id": "b26f2ab40f25a3d873630663f162e14e", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db85034e3c8190ba6187faa0f6a198", "custom_id": "template-6835", "response": {"status_code": 400, "request_id": "b2dfaed72870c8085350bd43ac426008", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db85043f648190bb8c42ae320fe1fa", "custom_id": "template-6767", "response": {"status_code": 400, "request_id": "31edfc6256915312444fbcb1467394b8", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db85033c088190b1637559b5e718ae", "custom_id": "template-8724", "response": {"status_code": 400, "request_id": "149f635bfed116d6a47889bea492be83", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db8504b3ec81909af17cafb7f0ca4e", "custom_id": "template-8500", "response": {"status_code": 400, "request_id": "db8968a5cfd2333a00b680f8dbd6fbe5", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db850385c4819092d4f7fb9dd3468f", "custom_id": "template-4625", "response": {"status_code": 400, "request_id": "5f276595d5e6143111e37097aee330fb", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db85038ed48190b2d088d5ef53b1c6", "custom_id": "template-8773", "response": {"status_code": 400, "request_id": "d35ed0519b284438402a412207b6172b", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db8503ec348190be325eb4f3892d12", "custom_id": "template-5710", "response": {"status_code": 400, "request_id": "4cf9f6dc67cea9f47c354816639593cb", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db850407c08190b62dc8da00225387", "custom_id": "template-5313", "response": {"status_code": 400, "request_id": "364de17b04bb64e3c41b4b9865ef01dd", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db85058cf88190b1938527e530d0c3", "custom_id": "template-5238", "response": {"status_code": 400, "request_id": "4de4218285633d5db29441035186343a", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db85050f708190980237bcbd594730", "custom_id": "template-7381", "response": {"status_code": 400, "request_id": "389f253c49e90857951b366ea62a2a9f", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db8504971c81908b9211ed1b995301", "custom_id": "template-5055", "response": {"status_code": 400, "request_id": "5fda0c473f8b342ac014570058240011", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db85049f8c819089a06257bb9fd3b7", "custom_id": "template-4014", "response": {"status_code": 400, "request_id": "3001b466d02148a63190050bed33c03b", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db8504cf5481909ce2b944e74acfed", "custom_id": "template-8292", "response": {"status_code": 400, "request_id": "be2d5d6d16caa3dcb1c24586800eb32e", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db8504fac48190bd00426b044e40a8", "custom_id": "template-8779", "response": {"status_code": 400, "request_id": "f269a24ae7bce532eeb26108f62e1c12", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db85058f848190a7c08c6eac9625cd", "custom_id": "template-8644", "response": {"status_code": 400, "request_id": "8165ce4e71ffb9fa40eb88c58bb75d5b", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db85055b24819096b64d7ceb79bd2c", "custom_id": "template-6547", "response": {"status_code": 400, "request_id": "613af9b493591fea47ff10f74cbdaf8b", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db8505946c819097196c575d8efd96", "custom_id": "template-6771", "response": {"status_code": 400, "request_id": "b20cc5aa88acadc4f6d8290df64c270a", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db85065eec8190b06d1d0a40e6f0a8", "custom_id": "template-8549", "response": {"status_code": 400, "request_id": "1ff6ea42d3a837cbfd663c9ecf97110c", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db85064b4c8190b488d2ca172a227f", "custom_id": "template-8592", "response": {"status_code": 400, "request_id": "e35391b85e620c3f75aa06177d884cde", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db850612e4819088517a6093f87d55", "custom_id": "template-7038", "response": {"status_code": 400, "request_id": "f5cba3b185ae6da89a14e141a89e3799", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db85062a148190a178d383360d1ae7", "custom_id": "template-8654", "response": {"status_code": 400, "request_id": "88abcf3d6591680a26445e32404f757f", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db850651bc819082a143074d2d93d5", "custom_id": "template-5181", "response": {"status_code": 400, "request_id": "8adc0f35f1f4128191b42c5f69a995c5", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db850673348190b00ebd2758e528cc", "custom_id": "template-8597", "response": {"status_code": 400, "request_id": "faacd390af51cebd7638e65b84f4e79e", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db8506ae3c8190b34ad5f7520100fd", "custom_id": "template-8340", "response": {"status_code": 400, "request_id": "c440ae31bd87d4c6560382a33698fa53", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db8506d3888190be121b1f67e2de78", "custom_id": "template-8414", "response": {"status_code": 400, "request_id": "cb4ed3d0d72b37664a9200daa9c2fbb7", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db8506f4a8819081b0f4ace4a46b0e", "custom_id": "template-6027", "response": {"status_code": 400, "request_id": "cb24562a440aece1a7963386fc510e66", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db8506e2108190b8f19ff16cf47815", "custom_id": "template-3179", "response": {"status_code": 400, "request_id": "206b5cb75186d8c706bff99a513a58fe", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db8507b2248190b1a93b3a26a7250b", "custom_id": "template-8452", "response": {"status_code": 400, "request_id": "d6a20173cebd2e7ff7b4d21c90ada40c", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db850779488190a68155795caeb7ad", "custom_id": "template-8562", "response": {"status_code": 400, "request_id": "bb4f79de3140200fc1544696eb1fecc9", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db8507954481909c5708ef4e1328ff", "custom_id": "template-8676", "response": {"status_code": 400, "request_id": "b12a97a3ed2e46952af0dbc2b8a9b349", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db850928088190ab80b380cc6ce744", "custom_id": "template-8427", "response": {"status_code": 400, "request_id": "d14d6e67a41ba3a4b02583040052913c", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db8507a2b08190b9ead530902652f5", "custom_id": "template-7382", "response": {"status_code": 400, "request_id": "ef4c9dfc239ed14b28e3c472b0ec3f56", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db8508141081909fe88468545181ef", "custom_id": "template-5080", "response": {"status_code": 400, "request_id": "92ec26817a12ebf6b07fa22f1307bd85", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db8507f1ec819092f6ca9df24e4d43", "custom_id": "template-7387", "response": {"status_code": 400, "request_id": "ce83ac950fc363875c300d108c033601", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db850820a08190981fe922ec438e97", "custom_id": "template-8618", "response": {"status_code": 400, "request_id": "625aae4771d5a9d972cea61e1f902f59", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db850833e481908aa522f4210919f1", "custom_id": "template-8272", "response": {"status_code": 400, "request_id": "45bf3fb73ea6c60a48e7f31cc8b3d552", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db85084bc481909f3d8ccd4e705953", "custom_id": "template-8491", "response": {"status_code": 400, "request_id": "ef2e9d44af0523cd5113313eda957acc", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db8508c4b4819081ef3f268bb6a5bf", "custom_id": "template-8721", "response": {"status_code": 400, "request_id": "4acefcd585de93149b63e68eb79625e8", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db85097a488190908158705cfe8ea5", "custom_id": "template-8769", "response": {"status_code": 400, "request_id": "dd3b844de2295f211bcdf500ca240787", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db8509c02881909776efc4bece333a", "custom_id": "template-8904", "response": {"status_code": 400, "request_id": "1ba8a6b95cb55a62d5f6973e8cd9bbac", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db8509491c81908c763cdf6acca99a", "custom_id": "template-6165", "response": {"status_code": 400, "request_id": "75e3d9174dbb794b4043fd5e3bb5d451", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db8509488c8190a8a4094346cbb578", "custom_id": "template-8585", "response": {"status_code": 400, "request_id": "1a1325f0b36d4b23531d5ab44a3e7654", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db850967d881908e2751c7364dd714", "custom_id": "template-7684", "response": {"status_code": 400, "request_id": "534dc7231a9ff8bd329b0a0d175f0be7", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db850a954481909b7889ca7aeb143d", "custom_id": "template-5886", "response": {"status_code": 400, "request_id": "6347769851ffc4631f8a36594f6a88dc", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db850a071881909fe9e8eb2a91e3a3", "custom_id": "template-7510", "response": {"status_code": 400, "request_id": "8c63727f9b9f1d1a14fdf3597b8305e5", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db8509a4388190ab4ab89d5399b8b3", "custom_id": "template-7589", "response": {"status_code": 400, "request_id": "fdbec117ff3444a2c8dce70890e9fa19", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db850a83508190a766ca24c6f61071", "custom_id": "template-7993", "response": {"status_code": 400, "request_id": "d504c4ef8e79f49b95b560adc2a57a25", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db850a838c8190b80c58e4cefb243a", "custom_id": "template-8780", "response": {"status_code": 400, "request_id": "03b3dbc5458a97a65dfe70393af74ca3", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}
{"id": "batch_req_68db8510da6c8190a0ec4162cb69c95b", "custom_id": "template-8015", "response": {"status_code": 400, "request_id": "c64effd348eeeefc022939f0dcdd6405", "body": {"error": {"message": "Unsupported value: 'temperature' does not support 0.3 with this model. Only the default (1) value is supported.", "type": "invalid_request_error", "param": "temperature", "code": "unsupported_value"}}}, "error": null}

View File

@@ -258,54 +258,52 @@ export class BatchProcessor {
} }
/** /**
* Monitor batch job with exponential backoff * Monitor batch job with fixed 1-minute polling interval
*/ */
private async monitorBatchJob(batchId: string): Promise<any> { private async monitorBatchJob(batchId: string): Promise<any> {
// Start with shorter wait times for better UX const pollInterval = 60; // Check every 60 seconds (1 minute)
const waitTimes = [30, 60, 120, 300, 600, 900, 1800]; // Progressive wait times in seconds
let waitIndex = 0;
let attempts = 0; let attempts = 0;
const maxAttempts = 100; // Safety limit const maxAttempts = 120; // 120 minutes max (2 hours)
const startTime = Date.now(); const startTime = Date.now();
let lastStatus = ''; let lastStatus = '';
while (attempts < maxAttempts) { while (attempts < maxAttempts) {
const batchJob = await this.client.batches.retrieve(batchId); const batchJob = await this.client.batches.retrieve(batchId);
const elapsedMinutes = Math.floor((Date.now() - startTime) / 60000);
// Only log if status changed
// Log status on every check (not just on change)
const statusSymbol = batchJob.status === 'in_progress' ? '⚙️' :
batchJob.status === 'finalizing' ? '📦' :
batchJob.status === 'validating' ? '🔍' :
batchJob.status === 'completed' ? '✅' :
batchJob.status === 'failed' ? '❌' : '⏳';
console.log(` ${statusSymbol} Batch ${batchId.slice(-8)}: ${batchJob.status} (${elapsedMinutes} min, check ${attempts + 1})`);
if (batchJob.status !== lastStatus) { if (batchJob.status !== lastStatus) {
const elapsedMinutes = Math.floor((Date.now() - startTime) / 60000); logger.info(`Batch ${batchId} status changed: ${lastStatus} -> ${batchJob.status}`);
const statusSymbol = batchJob.status === 'in_progress' ? '⚙️' :
batchJob.status === 'finalizing' ? '📦' :
batchJob.status === 'validating' ? '🔍' : '⏳';
console.log(` ${statusSymbol} Batch ${batchId.slice(-8)}: ${batchJob.status} (${elapsedMinutes} min)`);
lastStatus = batchJob.status; lastStatus = batchJob.status;
} }
logger.debug(`Batch ${batchId} status: ${batchJob.status} (attempt ${attempts + 1})`);
if (batchJob.status === 'completed') { if (batchJob.status === 'completed') {
const elapsedMinutes = Math.floor((Date.now() - startTime) / 60000); console.log(` ✅ Batch ${batchId.slice(-8)} completed successfully in ${elapsedMinutes} minutes`);
console.log(` ✅ Batch ${batchId.slice(-8)} completed in ${elapsedMinutes} minutes`);
logger.info(`Batch job ${batchId} completed successfully`); logger.info(`Batch job ${batchId} completed successfully`);
return batchJob; return batchJob;
} }
if (['failed', 'expired', 'cancelled'].includes(batchJob.status)) { if (['failed', 'expired', 'cancelled'].includes(batchJob.status)) {
logger.error(`Batch job ${batchId} failed with status: ${batchJob.status}`);
throw new Error(`Batch job failed with status: ${batchJob.status}`); throw new Error(`Batch job failed with status: ${batchJob.status}`);
} }
// Wait before next check // Wait before next check (always 1 minute)
const waitTime = waitTimes[Math.min(waitIndex, waitTimes.length - 1)]; logger.debug(`Waiting ${pollInterval} seconds before next check...`);
logger.debug(`Waiting ${waitTime} seconds before next check...`); await this.sleep(pollInterval * 1000);
await this.sleep(waitTime * 1000);
waitIndex = Math.min(waitIndex + 1, waitTimes.length - 1);
attempts++; attempts++;
} }
throw new Error(`Batch job monitoring timed out after ${maxAttempts} attempts`); throw new Error(`Batch job monitoring timed out after ${maxAttempts} minutes`);
} }
/** /**