Get the status of an async job. Args: job_id: The job ID returned from async execution Returns: Dictionary containing the job status Raises: SimStudioError: If getting the status fails
(self, job_id: str)
| 377 | self._session.close() |
| 378 | |
| 379 | def get_job_status(self, job_id: str) -> Dict[str, Any]: |
| 380 | """ |
| 381 | Get the status of an async job. |
| 382 | |
| 383 | Args: |
| 384 | job_id: The job ID returned from async execution |
| 385 | |
| 386 | Returns: |
| 387 | Dictionary containing the job status |
| 388 | |
| 389 | Raises: |
| 390 | SimStudioError: If getting the status fails |
| 391 | """ |
| 392 | url = f"{self.base_url}/api/jobs/{job_id}" |
| 393 | |
| 394 | try: |
| 395 | response = self._session.get(url) |
| 396 | |
| 397 | self._update_rate_limit_info(response) |
| 398 | |
| 399 | if not response.ok: |
| 400 | try: |
| 401 | error_data = response.json() |
| 402 | error_message = error_data.get('error', f'HTTP {response.status_code}: {response.reason}') |
| 403 | error_code = error_data.get('code') |
| 404 | except (ValueError, KeyError): |
| 405 | error_message = f'HTTP {response.status_code}: {response.reason}' |
| 406 | error_code = None |
| 407 | |
| 408 | raise SimStudioError(error_message, error_code, response.status_code) |
| 409 | |
| 410 | return response.json() |
| 411 | |
| 412 | except requests.RequestException as e: |
| 413 | raise SimStudioError(f'Failed to get job status: {str(e)}', 'STATUS_ERROR') |
| 414 | |
| 415 | def execute_with_retry( |
| 416 | self, |