mb.add_job(training_function, deployment_name=, ...)
Creates or updates a training job associated with a deployment. Learn more about training jobs.
Parameters
training_function
:Callable
The function used to define the job. It should return a trained model object, or similar.deployment_name
:str
The training job will be added to the deployment identified by this name. If the deployment does not exist it will be created.name
:Optional[str]
: The name of the training job. If no name is supplied the name oftraining_function
will be used.store_result_as
:Optional[str]
: Training jobs store their results in files in the deployment'sdata/
directory for later access. If omitted, thename
of the training job will be used.default_arguments
:Optional[List[Any]]
: If thetraining_function
expect arguments, supply them withdefault_arguments
. The arguments sent when running the job can be overridden when callingmb.run_job
. Arguments should be numbers or strings.save_on_success
:Optional[bool]
: Determines whether to re-deploy the associated deployment upon successful execution of the job. Defaults toTrue
.email_on_failure
:Optional[str]
: An email address to notify upon unsuccessful execution of the job.schedule
:Optional[str]
: The recurring schedule to run the job. Can behourly|weekly|daily|monthly
or a valid cron-formatted string. Defaults toNone
.refresh_datasets
:Optional[List[str]]
: The list of dataset names to refresh before executing the job.size
:Optional[str]
: The size of the job runner for executing the job. Can besmall|medium|large|xlarge|2xlarge|4xlarge|gpu_small|gpu_medium|gpu_large
. Defaults tosmall
.timeout_minutes
:Optional[int]
: The number of minutes to allow the job to run. Jobs exceeding this runtime will be terminated. Can be5
-1440
minutes. Defaults to 1 day (1440
).python_version
: Seemb.deploy
.python_packages
: Seemb.deploy
.system_packages
: Seemb.deploy
.extra_files
: Seemb.deploy
.
Returns
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.
Examples
Adding a job to a deployment
mb.add_job(train_model, deployment_name="example_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"])