Services

Job Service

The JobService handles job-related operations.

import asyncio
from t2g_sdk import T2GClient

async def main():
    async with T2GClient() as client:
        # Now you can access the JobService via client.job
        # Example:
        job = await client.job.run_job(file_id="some-file-id")
        pass

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

The JobService handles job-related operations and is accessed via the job property of an active T2GClient instance.

run_job

Submits a job and waits for its completion.

async def run_job(file_id: str, ontology_id: str = None, polling_interval: int = 5, timeout: int = 300) -> Job
  • file_id: The ID of the file to process.
  • ontology_id (optional): The ID of the ontology to use.
  • polling_interval (optional): The interval in seconds to poll for job status.
  • timeout (optional): The timeout in seconds for the job to complete.

submit_job

Submits a job for processing.

async def submit_job(file_id: str, ontology_id: str = None) -> Job
  • file_id: The ID of the file to process.
  • ontology_id (optional): The ID of the ontology to use.

find_jobs

Finds jobs by their IDs.

async def find_jobs(ids: List[str]) -> List[Job]
  • ids: A list of job IDs to find.

download_job_output

Downloads the output of a completed job.

async def download_job_output(job_id: str, output_path: str = None) -> str
  • job_id: The ID of the job to download the output from.
  • output_path (optional): The path to save the output to.