Master Configuration

This page details some environment variables you can use to configure the Optimization Server. To learn how to add environment variables, please read the following pages:

Label limits

Limits are specified at Master application level, a set of label names per group (groups being arbitrary strings) can be set by configuration.

Label limits are expressed as a maximum number of concurrent jobs per label (compounds of a label name and a label value).

Each worker task can belong to a group (group is optional).

Here is an example:

  • As the Master application admin

    • I have a task: “MyTask” in the “cplex” group

    • I want to limit the concurrent “cplex” jobs to 2 per factory.

      I know this limit at deployment time. When I deploy the application, I specify for the “cplex” group, a label limit of 2 per “factory”.

  • As a Master application user

    • I want to run a new job from a task in the “cplex” group.

      When I create this new job (only per API for now), I need to give a string value to each of the label names included in the limits of this group. In this case, I need to tell to which “factory” I am related.

Set Task Group

The worker task group is set on the worker.yml as follows:

tasks:
  - id: MyTask
   implementationClassName: com.decisionbrain.worker.MyTask
   group: cplex
   ...

In this example the task MyTask belongs to the group cplex.

Configure Master limits

Group limits can be defined with the following environment variables on master :

OPTIMSERVER_SERVICE_TASKGROUP_GROUPS_0_NAME=cplex
OPTIMSERVER_SERVICE_TASKGROUP_GROUPS_0_LABELLIMITS_FACTORY=2
OPTIMSERVER_SERVICE_TASKGROUP_GROUPS_1_NAME=mycustomlimit
OPTIMSERVER_SERVICE_TASKGROUP_GROUPS_1_LABELLIMITS_LABELNAME1=2
OPTIMSERVER_SERVICE_TASKGROUP_GROUPS_1_LABELLIMITS_LABELNAME2=5
  • groups are “cplex” and “mycustomlimit”
  • label names are “factory”, “labelname1”, “labelname2”
  • label limits are the number defined in front of the label name

In this example the label limit for the “factory” label name is 2. Which means, the maximum number of tasks is 2 with the label “factory = NewYork” and 2 with the label “factory = MyFactory” and so on. There is more than two tasks if they don’t have the same label value for the “factory” label name.

Create a Job

When creating a Job all the label names should be configured with a label value, if one is missing or one doesn’t exist the Job will be created with the status REJECTED.

Example of label name and value pairs:

  • factory = NewYork
  • factory = MyFactory
  • labelNameX = labelValueY

Then when the Job is started the Master application will check the limits to queue or launch the Job execution.

Job status workflow:

Status Diagram