Creating jobs in deployment spaces
A job is a way of running a batch deployment, or a self-contained asset like a script, notebook, code package, or flow in watsonx.ai Runtime. You can select the input and output for your job and choose to run it manually or on a schedule. From a deployment space, you can create, schedule, run, and manage jobs.
Before you begin
To improve the security for running deployment jobs, task credentials are required for deployment job requests. To learn how to set up your task credentials and generate an API key, see Adding task credentials.
- You must set up your task credentials by generating an API key. For more information, see Managing task credentials.
Creating a batch deployment job
Follow these steps when you are creating a batch deployment job:
- From the Deployments tab, select your deployment and click New job. The Create a job dialog box opens.
- In the Define details section, enter your job name, an optional description, and click Next.
- In the Configure section, select a hardware specification. You can follow these steps to optionally configure environment variables and job run retention settings:
- Optional: If you are deploying a Python script, an R script, or a notebook, then you can enter environment variables to pass parameters to the job. Click Environment variables to enter the key - value pair.
- Optional: To avoid finishing resources by retaining all historical job metadata, follow one of these options:
- Click By amount to set thresholds for saving a set number of job runs and associated logs.
- Click By duration (days) to set thresholds for saving artifacts for a specified number of days.
- Optional: In the Schedule section, toggle the Schedule off button to schedule a run. You can set a date and time for start of schedule and set a schedule for repetition. Click Next.
- Optional: In the Notify section, toggle the Off button to turn on notifications associated with this job. Click Next.
- In the Choose data section, provide inline data that corresponds with your model schema. You can provide input in JSON formator by using a form. Click Next. See Example JSON payload for inline data.
- In the Review and create section, verify your job details, and click Create and run.
Notes:
-
Scheduled jobs display on the Jobs tab of the deployment space.
-
Results of job runs are written to the specified output file and saved as a space asset.
-
A data asset can be a data source file that you promoted to the space, a connected data source, or tables from databases and files from file-based data sources.
-
If you exclude certain weekdays in your job schedule, the job might not run as you would expect. The reason is due to a discrepancy between the time zone of the user who creates the schedule, and the time zone of the main node where the job runs.
-
When you create or modify a scheduled job, an API key is generated. Future runs use this generated API key.
Example JSON payload for inline data
{
"deployment": {
"id": "<deployment id>"
},
"space_id": "<your space id>",
"name": "test_v4_inline",
"scoring": {
"input_data": [{
"fields": ["AGE", "SEX", "BP", "CHOLESTEROL", "NA", "K"],
"values": [[47, "M", "LOW", "HIGH", 0.739, 0.056], [47, "M", "LOW", "HIGH", 0.739, 0.056]]
}]
}
}
Queuing and concurrent job executions
The maximum number of concurrent jobs for each deployment is handled internally by the deployment service. For batch deployment, by default, two jobs can be run concurrently. Any deployment job request for a batch deployment that already has two running jobs is placed in a queue for execution later. When any of the running jobs is completed, the next job in the queue is run. The queue has no size limit.
Limitation on using large inline payloads for batch deployments
Batch deployment jobs that use large inline payload might get stuck in starting
or running
state. For more information, see Known issues and limitations.
Retention of deployment job metadata
Job-related metadata is persisted and can be accessed until the job and its deployment are deleted.
Viewing deployment job details
When you create or view a batch job, the deployment ID and the job ID are displayed.
- The deployment ID represents the deployment definition, including the hardware and software configurations and related assets.
- The job ID represents the details for a job, including input data and an output location and a schedule for running the job.
Use these IDs to refer to the job in watsonx.ai Runtime Data and AI Common Core API requests or in notebooks that use the watsonx.ai Python client library.
Parent topic: Managing predictive deployments