On Pollination, a job's status can be checked by using the job's id, owner name, project name, and the API key. You get a job's id once the job is created and submitted to Pollination. Check here to learn how to create and submit a job.
classSimStatus(Enum): NOTSTARTED =0 INCOPLETE =1 COMPLETE =2 FAILED =3 CANCELLED =4defget_job_status(api_key:str,owner:str,project:str,job_id:str) -> Tuple[SimStatus,str]:"""Get the status of a job from Pollination. args: api_key: The API key of the user. owner: The owner of the Pollination account. project: The name of the project inside which the job was created. job_id: The id of the job. returns: A tuple of two items: - The status of the job. - URL of the job on Pollination. """ job =Job(owner, project, job_id, client=ApiClient(api_token=api_key)) url = f'https://app.pollination.cloud/projects/{owner}/{project}/jobs/{job_id}'if job.status.status in [ JobStatusEnum.pre_processing, JobStatusEnum.running, JobStatusEnum.created, JobStatusEnum.unknown]:return SimStatus.INCOPLETE, urlelif job.status.status == JobStatusEnum.failed:return SimStatus.FAILED, urlelif job.status.status == JobStatusEnum.cancelled:return SimStatus.CANCELLED, urlelse:return SimStatus.COMPLETE, url
The Streamlit form above will render the following interface;
Providing API key, owner, project and job_id in the form above will serve the following result;