Managing Work Assignments and Workshifts

With work allocation, you can define constraints on where and when jobs run, as well as the amount of resources that can be used to process the jobs. This process includes creating a work assignment and binding the work assignment to a request processor.

A work assignment consists of a specialization rule and one or more workshifts. The specialization rule defines restrictions on which jobs can be processed. A workshift defines the temporal windows when the jobs can be processed and what resources can be used during those periods. The resources defined in a workshift include threads, which are a local resource of the request processor, and asynchronous workers, a global resource. The number of asynchronous workers can be specified to throttle the use of a shared global resource, such as database jobs.

Binding associates a work assignment with a request processor on a server, determining where the jobs can run. An exclusive binding mode is supported to not only determine when the jobs can run but to prevent them from running anywhere else.

By default, no work assignments are bound. When there is no bound or active work assignment, a virtual default work assignment is started to process all jobs using all available resources. This default work assignment is limited to the number of threads configured for the processor, but there is no default limit for asynchronous workers. To limit asynchronous workers, it is necessary to create and bind one or more work assignments.

This section contains the following topics:

Managing Work Assignments

Work assignments provide the following controls for processing job requests:

  • At runtime, work assignments can be bound to a request processor and can limit the period during which job requests of a certain type can be processed.

  • At runtime, the request processor can be configured to limit the threads that are available to process all job requests.

Determining Active Work Assignments

A bound work assignment is active if it is enabled, has an active workshift and the enabled flag is set on the work assignment definition. A workshift is active if it has an allocation greater than zero and includes a current schedule (where the current time is within a time window defined by the schedule and duration), or the workshift is a 24x7 workshift. If there are no bound work assignments on the server, the default work assignment is active using all threads and having no limits on asynchronous workers.

Determining Work Assignment Thread Allocation

An active work assignment is assigned the thread allocation specified by the active workshift unless the total number of threads required to satisfy the allocations of all active work assignments exceeds the configured thread count. In this case, Oracle Enterprise Scheduler weighs the thread allocation against the percentage of threads allotted to the workshift out of the total number of thread allocations for all work assignments.

For example, suppose work assignment 1 has a thread allocation of 70, work assignment 2 has a thread allocation of 30, and there are 20 processor threads configured. The total desired allocation is 100, so the weight for work assignment 1 is 70 percent while the weight for work assignment 2 is 30 percent. Oracle Enterprise Scheduler allocates 14 threads to work assignment 1 and 6 threads to work assignment 2.

If the default work assignment is active, the number of threads allocated to the work assignment is equal to the configured thread count.

Note:

Each active work assignment is assigned at least one thread.

Processing Active Work Assignments

After determining work assignments and thread allocations, Oracle Enterprise Scheduler begins a thread pool for each active work assignment. The threads are responsible for processing job requests that are specialized to the work assignment, except for requests that are specialized to an exclusive work assignment. The exclusion is effective for all work assignments, including the default work assignment. If an exclusive work assignment is bound to any server in the group, no other work assignment can process job requests specialized to that exclusive work assignment.

Note:

All work assignments bound in exclusive mode are excluded, including disabled work assignments. Exclusive bindings apply even if the server to which they are bound is unavailable. You must unbind an exclusive work assignment if you do not want it to be excluded.

Creating or Editing a Work Assignment

A work assignment includes two primary components that define request processor constraints:

  • Specialization rules: Define restrictions for job request processing on a request processor.

  • Workshifts: Specify temporal windows for processing job requests and thus describe the schedule for when job requests can be processed on a request processor

This combination of work assignment controls, including specialization rules and workshifts gives you the ability to select the kinds of job requests to be processed and decide how to allocate the request processor resources. For example, you can define two workshifts: a day shift and a night shift to allocate processing for these periods. The day shift could have more resources allocated for a peak usage period while the night shift could provide a different mix for its resource allocation.

By default, no work assignments are bound to a request processor and the request processor processes any ready job request. The default behavior is similar to using a request processor with no specialization rules and a workshift of 24/7 duration, all configured threads are used and there are no limits on the number of asynchronous jobs.

Table 5-6 shows the properties that you can define for specialization rules.


Table 5-6 Specialization Properties Available for Specialization Rules

Specialization Property Description

Application

Specifies the name of the application associated with a job request.

Product

Specifies the name of the product within an application.

Submitted By

Specifies a user who submitted a job request.

Job Definition

Specifies a specific job request name.

Request Category

Specifies labels defined by the system administrator allowing administrators to group job requests for specific requirements. You can include multiple labels that are separated by a delimiting character.

Logical Cluster Name

Specifies the name of the logical cluster.


The following operators are used for creating conditions: equals, not equals, contains, starts with, ends with and NOT (unary).

The following operators can be used to join the conditions of a rule: AND and OR (both of type binary).

Example 5-1 shows sample specialization rules that can be used in a work assignment.

If a job request is specialized to two different work assignments, either of those work assignments may process the job request depending on resource availability. Similarly, if the same work assignment is bound to two different servers, either server may process the job request. In fact, different stages of the same request may be processed on different servers, such as pre-processing on one server and job execution on another server.

Note that the requestCategory value can be several label terms separated by a comma. In this way you can specify labels that mimic the behavior of tags, with specializations based on combinations of labels.

For example, you could define the following labels:

Assuming the preceding labels, you could write a requestCategory expression such as the following examples:

If you use commas to delimit terms, you must enclose every separate label term with the comma on both sides, as shown in Example 5-2. Your requestCategory expression must specify the full term including the commas, as shown in Example 5-3, to ensure that the expression does not select another term that contains the one you specify.

To create or edit a work assignment:

  1. From the navigation pane, expand the Scheduling Services folder and select the Oracle Enterprise Scheduler application.
  2. From the Scheduling Services menu, select Work Allocation and then select Work Assignments.

    The Work Assignments page displays.

  3. Click the Create or Edit buttons to create or edit a work assignment.

    The Create (or Edit) Work Assignment page displays.

  4. Enter a name and description for the work assignment in the relevant text fields.
  5. Select the Enabled check box to enable the work assignment.
  6. Click Create Specialization to add conditions under which the work assignment runs.
  7. In the Workshifts section, click the Add button to add one or more workshifts to the work assignment.
  8. Click OK to save the work assignment.

Example 5-1 Sample Specialization Rules

application = 'EssDemoApp' AND (definition = 'JobDefinition://mypackage/Job_essdemo1' OR definition = 'JobDefinition://mypackage/LongRunningJob')

requestCategory ='Priority'

user = 'sam'
(requestCategory ='LongRunning') AND NOT (definition = 'JobDefinition://mypackage/LongRunningJob')

Example 5-2 Request Category Labels That Combine Terms

",NODE1,CRITICAL,"
",NODE1,STANDARD,"
",NODE1,IMPORTANT,"

Example 5-3 requestCategory Expressions That Use Multiple Combined Labels

(requestCategory contains ',NODE1,') AND (requestCategory contains ',CRITICAL,')

(requestCategory contains ',STANDARD,') OR (requestCategory contains ',IMPORTANT,') OR (requestCategory contains ',CRITICAL,')

Deleting a Work Assignment

You can delete a work assignment from the list of work assignments. Before deleting a work assignment, make sure that it is not bound to a request processor.

To delete a work assignment:

  1. From the navigation pane, expand the Scheduling Services folder and select the Oracle Enterprise Scheduler application.
  2. From the Scheduling Services menu, select Work Allocation and then select Work Assignments.

    The Work Assignments page displays.

  3. Select the work assignment you want to delete and click Delete.

Managing Workshifts

A workshift indicates the operating, active times for a request processor. Specifically, a workshift defines a sequence of temporal windows in which resources or threads, are made available for processing job requests. When a work assignment is bound to a request processor, one or more workshifts are associated with the work assignment. At runtime, Oracle Enterprise Scheduler determines the resource allocation for the workshifts within the work assignment.

You can use different amounts of resources during different periods of time by using multiple workshifts, each with a different time window and resource limits. For example, you can create daytime workshift that starts at 8 a.m. and has your daytime thread allocation and async job limits; and you can create a nighttime workshift that starts at 6 p.m. and has your nighttime thread allocation and async job limits.

Note that workshifts may overlap, but Oracle Enterprise Scheduler chooses one workshift as the current workshift.

While there is at most one currently active workshift for a given work assignment, there may still be active requests for a workshift that is no longer active. This can happen if a request runs beyond the defined operating window for the workshift it started running in. For example, if a request started running while the daytime workshift was active and that request is still running when the nighttime workshift starts. Oracle Enterprise Scheduler uses the limits of the currently active workshift and accounts for all active requests that started during any workshift in the work assignment. If the number of active requests exceeds the current limit, no more requests are run until the number of active requests drops below the limit.

A workshift defines the following resources:

  • Thread allocation

  • Asynchronous job limits for asynchronous Java and PL/SQL jobs

Thread allocation specifies the number of threads that can be used by the request processor. These threads are used to perform local tasks, including processing synchronous jobs, initiating and finalizing asynchronous jobs, pre- and post-processing of job requests and updating events. When the workshift in a work assignment is active, each request processor for the work assignment can use the specified number of threads. For example, suppose a work assignment includes a 24x7 workshift with a thread allocation of 15. If that work assignment were bound to three request processors, each request processor could use 15 threads, for a total of 45 threads across all three servers.

Asynchronous, PL/SQL, and asynchronous Java jobs use a global resource that must be shared across the entire system. The workshift can specify limits on the number of PL/SQL jobs and asynchronous Java jobs that can be active for the work assignment. This limit applies across all request processors for the work assignment in the entire system. For example, suppose a work assignment includes a 24x7 workshift with a PL/SQL job limit of ten. If that work assignment were bound to three request processors, all three request processors share the ten PL/SQL asynchronous workers, for a maximum of ten PL/SQL jobs active for that work assignment.

An asynchronous job reserves and holds an asynchronous worker before pre-processing starts and through finalization. In the case of pre-process delay, the async worker is released during the delay and reserved when the delay ends. A request that submits a subrequest and pauses, releases its async worker and the async worker is reserved when the request is resumed. A BLOCKED request does not hold an async worker.

When deciding on thread allocation and asynchronous job limits for a workshift, take note of the types of jobs specialized to the work assignment where the workshift is to be used.

This section contains the following topics:

Creating or Editing a Workshift

Creating a workshift involves the following:

  • Schedule: Associate a schedule with the workshift.

  • Duration: Enter a duration for the workshift.

  • Thread allocation: Specify the number of threads you want to allocate to the workshift.

  • Asynchronous job limits: Specify limits on the number of asynchronous Java jobs and PL/SQL jobs that can be active for the work assignment.

To create or edit a workshift:

  1. From the navigation pane, expand the Scheduling Services folder and select the Oracle Enterprise Scheduler application.

  2. From the Scheduling Services menu, select Work Allocation and then select Workshifts.

    The Workshifts page displays.

  3. Click the Create or Edit buttons to create or edit a workshift.

    The Create (or Edit) Workshift page displays.

  4. Enter the following information for the workshift.

    • Schedule Name: Enter a name for the workshift.

    • Schedule Description: Enter a description for the workshift.

  5. In the Active Period section, select one of the following activation periods for the workshift.

    • Active 24x7: Select to always enable the workshift. Selecting this option disables the Duration text field.

    • Use existing schedule: Select to enable the workshift using a schedule you created previously. Click the Browse button to display the Select Schedule window and search for the schedule using the Name and Package fields.

      In the Duration text field, enter the duration of the workshift in minutes.

    • Specify schedule: Select to create a schedule for the workshift. Enter a name and description for the schedule in the text fields provided.

      Choose a frequency from the Frequency dropdown list. You are presented with different options based on which frequency item you choose.

      From the Time Zone dropdown list, select a time zone for the schedule.

      In the Start Date field, click the Calendar button to select a date and time.

      In the Duration text field, enter the duration of the workshift in minutes.

  6. Expand the Advanced region. Specify the thread allocation and the asynchronous job limits.

    1. In the Thread Allocation field, enter the number of threads to be allocated to the processor when the workshift is active. If the total thread allocation of the active workshifts exceeds the number of available threads, then the threads are allocated proportionately to this workshift.

    2. In the Asynchronous Job Limits region, enter the number of asynchronous Java and PL/SQL jobs that can be active for the work assignment. This limit applies across all processors to which the work assignment is bound.

  7. Click OK to save the workshift.

Deleting a Workshift

You can delete a workshift from the list of workshifts. Before attempting to delete a work assignment, make sure that it is not bound to a work assignment.

To delete a workshift:

  1. From the navigation pane, expand the Scheduling Services folder and select the Oracle Enterprise Scheduler application.
  2. From the Scheduling Services menu, select Work Allocation and then select Workshifts.

    The Workshifts page displays.

  3. Select the workshift you want to delete and click Delete.

Managing Schedules

Schedules are used to configure the start and end times as well as the frequency of work allocations and purge policies.

Note:

For information about scheduling job request execution, see Creating or Editing Predefined Job Schedules.

This section contains the following topics:

Creating a Schedule

A job schedule specifies a predefined time or recurrence for execution. Work allocation and purge policy schedules are defined separately from job schedules. A job schedule can be associated with one or more jobs

To create a schedule:

  1. From the navigation pane, expand the Scheduling Services folder and select the Oracle Enterprise Scheduler application.
  2. There two ways to create schedules:
    • To create a schedule for job requests, select Job Requests and then select Define Schedules from the Scheduling Services menu.

    • To create a schedule for work assignments and purge policies, select Work Allocation and then select Schedules from the Scheduling Services menu.

  3. Click Create to define a new schedule.

    The Create Schedule page displays.

  4. Enter the following information:
    • Name: Enter a name for the schedule.

    • Description: Optionally, add descriptive text for the schedule.

    • Choose a frequency from the Frequency dropdown list. You are presented with different options based on which frequency item you choose.

    • From the Time Zone dropdown list, select a time zone for the schedule.

    • In the Start Date field, use the Calendar button to select a date and time.

  5. Click OK to save the schedule.

Editing a Schedule

To modify an existing schedule:

  1. From the navigation pane, expand the Scheduling Services folder and select the Oracle Enterprise Scheduler application.
  2. From the Scheduling Services menu, select Work Allocation and then select Schedules.

    The Schedules page displays.

  3. Select a schedule from the table and click Edit.

    The Edit Schedule page displays.

  4. Edit the following information:
    • Description: Optionally, change the descriptive text for the schedule.

    • Click the Change Frequency button. You are presented with different options based on which frequency item you choose.

    • From the Time Zone dropdown list, select a time zone for the schedule.

    • In the Start Date field, use the Calendar button to select a date and time.

  5. Click OK to save the schedule.

Deleting a Schedule

You can delete a schedule from the list of schedules.

To delete a schedule:

  1. From the navigation pane, expand the Scheduling Services folder and select the Oracle Enterprise Scheduler application.
  2. From the Scheduling Services menu, select Job Request and then select Schedules.

    The Schedules page displays.

  3. Select the schedule you want to delete and click the Delete button.

    Note:

    To delete a work assignment or purge policy schedule, from the Scheduling Services menu, select Work Allocation and then select Schedules.