kumoai.trainer.BatchPredictionJob#
- class kumoai.trainer.BatchPredictionJob[source]#
Bases:
KumoFuture
[BatchPredictionJobResult
]Represents an in-progress batch prediction job.
A
BatchPredictionJob
object can either be created as the result ofpredict()
withnon_blocking=True
, or directly with a batch prediction job ID (e.g. of a job created asynchronously in a different environment).import kumoai # See `Trainer` documentation: trainer = kumoai.Trainer(...) # If a Trainer `predict` is called in nonblocking mode, the response # will be of type `BatchPredictionJob`: prediction_job = trainer.predict(..., non_blocking=True) # You can also construct a `BatchPredictionJob` from a job ID, e.g. one # that is present in the Kumo Jobs page: prediction_job = kumoai.BatchPredictionJob("bp-job-...") # Get the status of the job: print(prediction_job.status()) # Attach to the job, and poll progress updates: prediction_job.attach() # Attaching to batch prediction job <id>. To track this job... # Predicting (job_id=..., start=..., elapsed=..., status=...). Stage: ... # Cancel the job: prediction_job.cancel() # Wait for the job to complete, and return a `BatchPredictionJobResult`: prediction_job.result()
- Parameters:
job_id (
str
) – The batch prediction job ID to await completion of.
- result()[source]#
Returns the resolved state of the future.
- Raises:
Exception – If the future is complete but in a failed state due to an exception being raised, this method will raise the same exception.
- Return type:
- future()[source]#
Returns the
concurrent.futures.Future
object wrapped by this future. It is not recommended to access this object directly.
- property tracking_url: str#
Returns a tracking URL pointing to the UI that can be used to monitor the status of an ongoing or completed job.
- attach()[source]#
Allows a user to attach to a running batch prediction job, and view its progress inline.
- Return type:
- progress()[source]#
Returns the progress of an ongoing or completed batch prediction job.
- Return type:
PredictionProgress
- status()[source]#
Returns the status of a running batch prediction job.
- Return type:
JobStatusReport
- cancel()[source]#
Cancels a running batch prediction job, and returns
True
if cancellation succeeded.- Return type:
- static __new__(cls, *args, **kwds)#
- done()#
Returns
True
if this future has been resolved withresult()
, orFalse
if this future is still in-progress. Note that this method will returnTrue
if the future is complete, but in a failed state, and that this method will returnFalse
if the job is complete, but the future has not been awaited.- Return type: