MCPcopy Index your code
hub / github.com/ScrapeGraphAI/Scrapegraph-ai / get_batch_status

Function get_batch_status

scrapegraphai/utils/batch_api.py:167–187  ·  view source on GitHub ↗

Get the current status of a batch job. Args: client: An initialized OpenAI client. batch_id: The batch ID returned by create_batch. Returns: BatchJobInfo with the current status and counts.

(client: OpenAI, batch_id: str)

Source from the content-addressed store, hash-verified

165
166
167def get_batch_status(client: OpenAI, batch_id: str) -> BatchJobInfo:
168 """Get the current status of a batch job.
169
170 Args:
171 client: An initialized OpenAI client.
172 batch_id: The batch ID returned by create_batch.
173
174 Returns:
175 BatchJobInfo with the current status and counts.
176 """
177 batch = client.batches.retrieve(batch_id)
178
179 return BatchJobInfo(
180 batch_id=batch.id,
181 status=batch.status,
182 total_requests=batch.request_counts.total if batch.request_counts else 0,
183 completed_requests=batch.request_counts.completed if batch.request_counts else 0,
184 failed_requests=batch.request_counts.failed if batch.request_counts else 0,
185 output_file_id=batch.output_file_id,
186 error_file_id=batch.error_file_id,
187 )
188
189
190def poll_batch_until_complete(

Callers 1

Calls 1

BatchJobInfoClass · 0.85

Tested by

no test coverage detected