Job Operations

Find Latest Succeeded Job

The find_latest_succeeded_job function finds the most recent successfully completed job for a given file and optional ontology.

Synchronous

find_latest_succeeded_job

def find_latest_succeeded_job(
    file_id: str,
    ontology_id: Optional[str] = None,
) -> Optional[Job]:

Finds the latest succeeded job for a file and optional ontology.

Arguments

NameTypeDescriptionDefault
file_idstrThe ID of the file.-
ontology_idOptional[str]The ID of the ontology used.None

Returns

TypeDescription
Optional[Job]The latest succeeded Job object if one exists, else None.

Example

import perseus_client

file_id = "your_file_id"

try:
    latest_job = perseus_client.find_latest_succeeded_job(file_id)
    if latest_job:
        print(f"Latest succeeded job ID: {latest_job.id}")
    else:
        print("No succeeded job found for this file.")
except Exception as e:
    print(f"An error occurred: {e}")

Asynchronous

find_latest_succeeded_job_async

async def find_latest_succeeded_job_async(
    file_id: str,
    ontology_id: Optional[str] = None,
) -> Optional[Job]:

Asynchronously finds the latest succeeded job for a file and optional ontology.

Arguments

NameTypeDescriptionDefault
file_idstrThe ID of the file.-
ontology_idOptional[str]The ID of the ontology used.None

Returns

TypeDescription
Optional[Job]The latest succeeded Job object if one exists, else None.

Example

import asyncio
import perseus_client

file_id = "your_file_id"

async def main():
    try:
        latest_job = await perseus_client.find_latest_succeeded_job_async(file_id)
        if latest_job:
            print(f"Latest succeeded job ID: {latest_job.id}")
        else:
            print("No succeeded job found for this file.")
    except Exception as e:
        print(f"An error occurred: {e}")
    finally:
        await perseus_client.close_async()

if __name__ == "__main__":
    asyncio.run(main())