Job Operations
Find Job
The find_job function allows you to retrieve a single job by its unique ID.
Synchronous
find_job
def find_job(id: str) -> Optional[Job]:Finds a single job by its ID.
Arguments
| Name | Type | Description |
|---|---|---|
id | str | The unique ID of the job. |
Returns
| Type | Description |
|---|---|
Optional[Job] | A Job object if found, otherwise None. |
Example
import perseus_client
try:
job = perseus_client.find_job("your_job_id")
if job:
print(f"Job found with status: {job.status.value}")
else:
print("Job not found.")
except Exception as e:
print(f"An error occurred: {e}")Asynchronous
find_job_async
async def find_job_async(id: str) -> Optional[Job]:Asynchronously finds a single job by its ID.
Arguments
| Name | Type | Description |
|---|---|---|
id | str | The unique ID of the job. |
Returns
| Type | Description |
|---|---|
Optional[Job] | A Job object if found, otherwise None. |
Example
import asyncio
import perseus_client
async def main():
try:
job = await perseus_client.find_job_async("your_job_id")
if job:
print(f"Job found with status: {job.status.value}")
else:
print("Job not found.")
except Exception as e:
print(f"An error occurred: {e}")
finally:
await perseus_client.close_async()
if __name__ == "__main__":
asyncio.run(main())