Job Operations
Download Job Output
The download_job_output function downloads the output of a completed job.
Synchronous
download_job_output
def download_job_output(
job_id: str, output_path: Optional[str] = None
) -> str:Downloads the output of a specific job.
Arguments
| Name | Type | Description | Default |
|---|---|---|---|
job_id | str | The ID of the job whose output you want to download. | - |
output_path | Optional[str] | The local path to save the file to. | None |
Returns
| Type | Description |
|---|---|
str | The path to the downloaded output file. |
Example
import perseus_client
job_id = "your_completed_job_id"
try:
output_file_path = perseus_client.download_job_output(job_id, "./output.json")
print(f"Job output downloaded to: {output_file_path}")
except Exception as e:
print(f"An error occurred: {e}")Asynchronous
download_job_output_async
async def download_job_output_async(
job_id: str, output_path: Optional[str] = None
) -> str:Asynchronously downloads the output of a specific job.
Arguments
| Name | Type | Description | Default |
|---|---|---|---|
job_id | str | The ID of the job whose output you want to download. | - |
output_path | Optional[str] | The local path to save the file to. | None |
Returns
| Type | Description |
|---|---|
str | The path to the downloaded output file. |
Example
import asyncio
import perseus_client
job_id = "your_completed_job_id"
async def main():
try:
output_file_path = await perseus_client.download_job_output_async(job_id, "./output.json")
print(f"Job output downloaded to: {output_file_path}")
except Exception as e:
print(f"An error occurred: {e}")
finally:
await perseus_client.close_async()
if __name__ == "__main__":
asyncio.run(main())