Job Operations

Submit Job

The submit_job function submits a new job to the Perseus server for a previously uploaded file.

Synchronous

submit_job

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

Submits a job for a given file and optional ontology.

Arguments

NameTypeDescriptionDefault
file_idstrThe ID of the file to process.-
ontology_idOptional[str]The ID of the ontology to use.None

Returns

TypeDescription
JobA Job object representing the submitted job.

Example

import perseus_client

# Assume you have a file_id and an optional ontology_id
file_id = "your_file_id"
ontology_id = "your_ontology_id" # or None

try:
    job = perseus_client.submit_job(file_id, ontology_id)
    print(f"Job submitted successfully with ID: {job.id}")
except Exception as e:
    print(f"An error occurred: {e}")

Asynchronous

submit_job_async

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

Asynchronously submits a job for a given file and optional ontology.

Arguments

NameTypeDescriptionDefault
file_idstrThe ID of the file to process.-
ontology_idOptional[str]The ID of the ontology to use.None

Returns

TypeDescription
JobA Job object representing the submitted job.

Example

import asyncio
import perseus_client

# Assume you have a file_id and an optional ontology_id
file_id = "your_file_id"
ontology_id = "your_ontology_id" # or None

async def main():
    try:
        job = await perseus_client.submit_job_async(file_id, ontology_id)
        print(f"Job submitted successfully with ID: {job.id}")
    except Exception as e:
        print(f"An error occurred: {e}")
    finally:
        await perseus_client.close_async()

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