mb.add_job(training_function, deployment_name=, ...)
Creates or updates a training job associated with a deployment. Learn more about training jobs.
CallableThe function used to define the job. It should return a trained model object, or similar.
strThe training job will be added to the deployment identified by this name. If the deployment does not exist it will be created.
Optional[str]: The name of the training job. If no name is supplied the name of
training_functionwill be used.
Optional[str]: Training jobs store their results in files in the deployment's
data/directory for later access. If omitted, the
nameof the training job will be used.
Optional[List[Any]]: If the
training_functionexpect arguments, supply them with
default_arguments. The arguments sent when running the job can be overridden when calling
mb.run_job. Arguments should be numbers or strings.
Optional[bool]: Determines whether to re-deploy the associated deployment upon successful execution of the job. Defaults to
Optional[str]: An email address to notify upon unsuccessful execution of the job.
Optional[str]: The recurring schedule to run the job. Can be
hourly|weekly|daily|monthlyor a valid cron-formatted string. Defaults to
Optional[List[str]]: The list of dataset names to refresh before executing the job.
Optional[str]: The size of the job runner for executing the job. Can be
small|medium|large|xlarge|2xlarge|4xlarge|gpu_small|gpu_medium|gpu_large. Defaults to
Optional[int]: The number of minutes to allow the job to run. Jobs exceeding this runtime will be terminated. Can be
1440minutes. Defaults to 1 day (
The call to
mb.add_job is typically done in an interactive environment, like a Python notebook. The command will print out status, and then show link to open the job in Modelbit.
Adding a job to a deployment
Specifying datasets to refresh
mb.add_job(train_model, deployment_name="example_deployment", refresh_datasets=["leads"])
Specifying a larger job runner
mb.add_job(train_model, deployment_name="example_deployment", size=["xlarge"])