kumoai.trainer.TrainingJob#

class kumoai.trainer.TrainingJob[source]#

Bases: KumoFuture[TrainingJobResult]

Represents an in-progress training job.

A TrainingJob object can either be created as the result of fit() with non_blocking=True, or directly with a training job ID (e.g. of a job created asynchronously in a different environment).

import kumoai

# See `Trainer` documentation:
trainer = kumoai.Trainer(...)

# If a Trainer is `fit` in nonblocking mode, the response will be of
# type `TrainingJob`:
training_job = trainer.fit(..., non_blocking=True)

# You can also construct a `TrainingJob` from a job ID, e.g. one that
# is present in the Kumo Jobs page:
training_job = kumoai.TrainingJob("trainingjob-...")

# Get the status of the job:
print(training_job.status())

# Attach to the job, and poll progress updates:
training_job.attach()
# Training: 70%|█████████    | [300s<90s, trial=4, train_loss=1.056, val_loss=0.682, val_mae=35.709, val_mse=7906.239, val_rmse=88.917

# Cancel the job:
training_job.cancel()

# Wait for the job to complete, and return a `TrainingJobResult`:
training_job.result()
Parameters:

job_id (str) – The training job ID to await completion of.

__init__(job_id)[source]#
property id: str#

The unique ID of this training job.

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:

TrainingJobResult

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 training job, and view its progress inline.

Return type:

TrainingJobResult

Example

>>> job_future = kumoai.TrainingJob(job_id="...")  
>>> job_future.attach()  
Attaching to training job <id>. To track this job...
Training: 70%|█████████    | [300s<90s, trial=4, train_loss=1.056, val_loss=0.682, val_mae=35.709, val_mse=7906.239, val_rmse=88.917
progress()[source]#

Returns the progress of an ongoing or completed training job.

Return type:

AutoTrainerProgress

status()[source]#

Returns the status of a running training job.

Return type:

JobStatusReport

cancel()[source]#

Cancels a running training job, and returns True if cancellation succeeded.

Return type:

bool

Example

>>> job_future = kumoai.TrainingJob(job_id="...")  
>>> job_future.cancel()  
delete_tags(tags)[source]#

Removes the tags from the job.

Parameters:

tags (List[str]) – The tags to remove.

Return type:

bool

update_tags(tags)[source]#

Updates the tags of the job.

Parameters:

tags (Mapping[str, Optional[str]]) – The tags to update. Note that the value ‘none’ will remove the tag. If the tag is not present, it will be added.

Return type:

bool

static __new__(cls, *args, **kwds)#
done()#

Returns True if this future has been resolved with result(), or False if this future is still in-progress. Note that this method will return True if the future is complete, but in a failed state, and that this method will return False if the job is complete, but the future has not been awaited.

Return type:

bool