Job classification

When you submit a job to Job Router, you can either specify the queue, priority, and worker selectors manually or you can specify a classification policy to drive these values.

If you choose to use a classification policy, you receive a JobClassified Event or a JobClassificationFailed Event with the result. Once the job has been successfully classified, it's automatically queued. If the classification process fails, you need to intervene to fix it.

The process of classifying a Job involves optionally setting the following properties:

  • Priority
  • Worker Selectors
  • Queue ID

Fallback queue

The fallback queue is used when queue selectors, resulting from queue selector attachments, are unable to select a queue and the job does not have a queueId. In this case, if the fallback queue is defined, the job is assigned to it.

Prioritization rule

The priority of a Job can be resolved during classification using one of many rule engines.

For more information, see the Rule concepts page.

Worker selectors

Each job carries a collection of worker selectors that's evaluated against the worker labels. These conditions need to be true of a worker to be a match. You can use the classification policy to attach these conditions to a job; you can do it by specifying one or more selector attachments.

For more information, see, the section: using label selector attachments.

Queue selectors

You can also specify a collection of label selector attachments to select the Queue based on its labels.

For more information, see, the section: using label selector attachments.

Using label selector attachments

The following label selector attachments are available:

Static label selector - Always attaches the given LabelSelector to the Job.

Conditional label selector - Evaluates a condition defined by a rule. If it resolves to true, then the specified collection of selectors are attached to the Job.

Passthrough label selector - Attaches a selector to the Job with the specified key and operator but gets the value from the Job label of the same key.

Rule label selector - Sources a collection of selectors from one of many rule engines. Read the RouterRule concepts page, for more information.

Weighted allocation label selector - Enables you to specify a percentage-based weighting and a collection of selectors to attach based on the weighting allocation. For example, you may want 30% of the Jobs to go to "Vendor 1" and 70% of Jobs to go to "Vendor 2".

Reclassifying a job

Once a Job has been classified, it can be reclassified in the following ways:

  1. You can update the Job labels, which cause the Job Router to evaluate the new labels with the previous Classification Policy.
  2. You can update the Classification Policy ID of a Job, which causes Job Router to process the existing Job against the new policy.
  3. An Exception Policy trigger can take the action of requesting a Job be reclassified.
  4. You can Reclassify the job, which causes the Job Router to re-evaluate the current labels and Classification Policy.