Job Operations
Find Jobs
The find_jobs function allows you to retrieve a list of jobs by their IDs.
Synchronous
find_jobs
def find_jobs(ids: List[str]) -> List[Job]:Finds jobs matching the provided list of IDs.
Arguments
| Name | Type | Description |
|---|---|---|
ids | List[str] | A list of job IDs to retrieve. |
Returns
| Type | Description |
|---|---|
List[Job] | A list of Job objects that match the query. |
Example
import perseus_client
try:
jobs = perseus_client.find_jobs(ids=["job_id_1", "job_id_2"])
print(f"Found {len(jobs)} jobs.")
except Exception as e:
print(f"An error occurred: {e}")Asynchronous
find_jobs_async
async def find_jobs_async(ids: List[str]) -> List[Job]:Asynchronously finds jobs matching the provided list of IDs.
Arguments
| Name | Type | Description |
|---|---|---|
ids | List[str] | A list of job IDs to retrieve. |
Returns
| Type | Description |
|---|---|
List[Job] | A list of Job objects that match the query. |
Example
import asyncio
import perseus_client
async def main():
try:
jobs = await perseus_client.find_jobs_async(ids=["job_id_1", "job_id_2"])
print(f"Found {len(jobs)} jobs.")
except Exception as e:
print(f"An error occurred: {e}")
finally:
await perseus_client.close_async()
if __name__ == "__main__":
asyncio.run(main())