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 pool in.
- On the job pool details page, select Add job.
- On the Create job page, provide the following details:
1. Details
In the Details section, complete the following fields:- Name: Enter a name.
- Description: Provide a brief description.
- Compartment: Select the compartment in which you want to create the job.
2. Tasks
In the Tasks section, select Add Tasks and complete the following fields:- Name: Enter a name.
- Description: Provide a short description.
- Compartment: Select the compartment in which you want to create the task. The task must be in the same compartment as the task environment.
- Task environment compartment: Select the compartment in which the task profile is available
- Task Environment: Select a task environment to run the task.
- (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) Task profile compartment: Select the compartment in which the task profile is available.
- (Optional) Task profile: Select an appropriate task profile for the task.
- (Optional)
Fleet assignment policy: Select one of the following options:
- 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.
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) 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)
Task Environment Variables: Select Add task 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.
- Select Add to create the task.
3. Add Task Dependencies
When tasks are defined during 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.
- Select Add task dependencies.
- On the Create Task Dependencies page, 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.
4. Environment Variables
In the task environment variables section, you can specify the variables which are shared between all tasks.
- Select Add task environment variable.
- In the Task environment variables page, complete the following fields:
- Name: Enter a name.
- Value: Provide a numerical value for the variable.
5. (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.
6. 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.- 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.