Job Service
The JobService handles job-related operations.
The JobService handles job-related operations and is accessed via the job property of an active PerseusClient instance.
Run Job
Submits a job and waits for its completion. This is a high-level function that encapsulates submit_job and polling for completion.
async def run_job(file_id: str, ontology_id: Optional[str] = None, polling_interval: int = 5, timeout: int = 3600) -> Jobdef run_job(file_id: str, ontology_id: Optional[str] = None, polling_interval: int = 5, timeout: int = 3600) -> JobParameters:
file_id(str): The ID of the file to process.ontology_id(Optional[str]): The ID of the ontology to use.polling_interval(int): The interval in seconds to poll for job status. Defaults to5.timeout(int): The maximum time in seconds to wait. Defaults to3600.
Output:
The completed Job object, with its status updated to SUCCEEDED or FAILED.
Submit Job
Submits a job for processing.
async def submit_job(file_id: str, ontology_id: Optional[str] = None) -> Jobdef submit_job(file_id: str, ontology_id: Optional[str] = None) -> JobParameters:
file_id(str): The ID of the file to process.ontology_id(Optional[str]): The ID of the ontology to use.
Output:
The initial Job object with a PENDING status.
Find Jobs
Finds jobs by their IDs.
async def find_jobs(ids: List[str]) -> List[Job]def find_jobs(ids: List[str]) -> List[Job]Parameters:
ids(List[str]): A list of job IDs to find.
Output:
A list of Job objects matching the criteria. Returns an empty list if no jobs are found.
Find Job
Finds a single job by its ID.
async def find_job(id: str) -> Optional[Job]def find_job(id: str) -> Optional[Job]Parameters:
id(str): The ID of the job to find.
Output:
A Job object if a job with the given ID is found, otherwise None.
Find Latest Job
Finds the latest successfully completed job for a given file and optional ontology.
async def find_latest_job(file_id: str, ontology_id: Optional[str] = None) -> Optional[Job]def find_latest_job(file_id: str, ontology_id: Optional[str] = None) -> Optional[Job]Parameters:
file_id(str): The ID of the file.ontology_id(Optional[str]): The ID of the ontology.
Output:
The latest Job object with a SUCCEEDED status, or None if no such job exists.
Download Job Output
Downloads the output files (.ttl and .cql) of a completed job.
async def download_job_output(job_id: str, output_path: Optional[str] = None) -> strdef download_job_output(job_id: str, output_path: Optional[str] = None) -> strParameters:
job_id(str): The ID of the job.output_path(Optional[str]): The local path (without extension) to save the output files to. Defaults to the job ID in the/tmpfolder.
Output:
A str representing the base path where the output files (.ttl and .cql) were saved. For example, if output_path is "my_output", it will return "my_output" and create my_output.ttl and my_output.cql.