Creating a Job
Create a job for Batch. A job consists of a set of tasks that share the same priority. Tasks within a job can have dependencies on one another.
- On the Batch contexts list page and select the batch context that contains the job pool that you want to create a job in. If you need help finding the list page, see Listing Batch Contexts.
- On the batch context details page, select the Job pools tab.
- Select the job pool that you want to create the job in.
- On the job pool details page, select Add job.
- On the Create job page, provide the following details:
1. Basic information
In the Basic information section, complete the following fields:- Compartment: Select the compartment in which you want to create the job.
- Name: Enter a name.
- Description: Provide a brief description.
- Compartment:
2. Tasks
In the Tasks section, select Add task and complete the following fields:
- 1. Basic information:
- Name: Enter a name.
- Description: Provide a short description.
- 2. Execution:
- Task environment compartment: Select the compartment in which the task profile is available.
- Task environment: Define the runtime configuration the batch tasks require, including which container image to use and how storage is mounted on each container.
- (Optional) Task profile compartment: Select the compartment in which the task profile is available.
- (Optional) Task profile: Select an appropriate task profile for the task.
- Commands
- (Optional) Commands: Select Add command to enter a command that's passed to the container.
- (Optional) Arguments: Select Add argument to enter an argument that's passed to the container.
- (Optional) Entitlement claims: Select an entitlement if the task needs a resource.
Tasks might require entitlements defined in the batch context. A rendering task, for example, might require a license for execution, and a limited number of floating licenses need to be tracked. Getting the license for execution and releasing it after completion ensures the license is held exactly as long as it's needed and freed for other use after the operation.
Based on the entitlement setup, the batch context workflow ensures the number of tasks running in parallel with related entitlement claims don't exceed the limit configured in the entitlement within the batch context. See Create Batch Context. - (Optional)
Environment variables: Select Add environment variable to specify what environment variables are available to the docker image.
- Name: Enter a name.
- Value: Provide a value for the variable.
Note
- To add more tasks, select Add Task.
- To copy a task's details, select Duplicate.
- 3. Policies:
- (Optional)
Fleet assignment policy:
- Best fit: Select a small fleet type that best meets the task requirement.
- Flex fit: Select a large fleet within the user-defined threshold if small fleets are unavailable. Assign the Fleet assignment policy threshold.
Note
If a task's profile requirements can't be matched with any available fleets in the batch context, the task isn't scheduled for execution. Ensure the task profile's resource requirements align with the fleet capacities to avoid this issue.
- (Optional)
Fleet assignment policy:
- 4. Review:
Select Save to create the task.
3. Add Group Task
- Basic information: Enter a name and description.
- Execution:
- Entitlement claims: Select an entitlement if the group task needs a resource.
Group tasks might require entitlements defined in the batch context. A rendering task, for example, might require a license for execution, and a limited number of floating licenses need to be tracked. Getting the license for execution and releasing it after completion ensures the license is held exactly as long as it's needed and freed for other use after the operation. See How Batch Objects Work Together for more information on group tasks.
Based on the entitlement setup, the batch context workflow ensures the number of tasks running in parallel with related entitlement claims don't exceed the limit configured in the entitlement within the batch context. See Create Batch Context. -
Environment variables: Select Add environment variable to specify what environment variables are available to the docker image.
- Name: Enter a name.
- Value: Provide a value for the variable.
- Entitlement claims: Select an entitlement if the group task needs a resource.
- Review:
Select Save to create the group task.
4. Add Task Dependencies
When tasks are defined during the Create job process, you can add task dependencies between the tasks. Dependencies are always specified through task relations such as Task A depends on Task B and Task C, which means Task A can't start executing until Task B and Task C are completed.
- From the , select Add task dependencies.
- On the Create task dependencies page, select Add Dependency, and complete the following fields:
- Task: Select a task which depends on another task.
- Depends on: Select the task on which the task is dependent.
- Select Submit.
5. Environment Variables
In the task environment variables section, you can specify the variables which are shared between all tasks.
- Select Add environment variable.
- In the Environment variables page, complete the following fields:
- Name: Enter a name.
- Value: Provide a numerical value for the variable.
6. (Optional) Tags
In the Tags section, select Add Tag to apply one or more tags to the job. If you have permissions to create a resource, then you also have permissions to apply free-form tags to that resource. To apply a defined tag, you must have permissions to use the tag namespace. For more information about tagging, see Resource Tags. If you're not sure whether to apply tags, skip this option or ask an administrator. You can apply tags later.
7. Review
Select Submit.
The job creation process begins and the job state is set as
Accepted. At this stage, you can cancel the job at any time. When the job is successfully created, the status transitions fromAcceptedtoIn progress.If the job creation process fails, the status transitions to
Failed. Navigate to the WorkRequest tab to see the errors.Note
You can also create a job from the Job monitoring page.To see all statuses and their definitions, go to OCI Batch Lifecycle States Reference.
Actions
In the list table, select the name of a task environment to open its details page, where you can view its status and perform other tasks.
To perform an action on a task environment directly from the list table, select an available option from the Actions menu in the row for that task environment:
- View details: Open the details page for the task environment.
- Copy OCID: Copy the OCID of the task environment to the clipboard.
- Copy image OCID: Copy the image OCID of the task environment to the clipboard.
- Move resource: Move the task environment to another compartment.
- Manage tags: Add one or more tags to the task environment. See Resource Tags.
- Delete: Delete the task environment.
- Edit: Edit the task environment name and description.
- Duplicate: Copy a task's details.
- Add task: Add more tasks to the job.
- Add group task: Create a task within a task group so that multiple similar jobs can run in parallel or in sequence under a single batch job.
- Add task dependencies: Specify the execution order to ensure that prerequisite tasks finish before dependent tasks start.
- Edit: Edit the job.
- Move to group task: Reassign one or more tasks from one task group to another within the same batch job.
- Add child task: Define a task that depends on the completion of another task (its parent) within the same task group.
- Add child group: Create a task group that depends on another task group within the same batch job.
To create a task environment, select Create task environment.
To perform an action on more than one task environment at a time, select the check boxes next to the task environment names and then select an action from the Actions menu above the table.
- Use the oci batch batch-job create command and required parameters to get a create a job:
oci batch batch-job create [OPTIONS]For a complete list of flags and variable options for Batch CLI commands, see the Batch CLI.
Run the CreateBatchJob operation to create a batch job.