Red Hat Training
A Red Hat training course is available for Red Hat Decision Manager
Deploying the employee roster starter application for Red Hat Business Optimizer on Red Hat OpenShift Container Platform
Red Hat Customer Content Services
brms-docs@redhat.com
Abstract
Preface
As a business rules developer, you can test and interact with the Red Hat Business Optimizer functionality by quickly deploying the employee-rostering
starter project included in the Red Hat Decision Manager distribution to OpenShift.
Prerequisites
-
You have downloaded the Red Hat Decision Manager add-ons distribution, which includes the
employee-rostering
starter application - You have access to a deployed OpenShift environment. For details, see the documentation for the OpenShift product that you use.
Chapter 1. Installing and running the employee rostering demonstration on OpenShift
You can deploy the Red Hat Business Optimizer Employee Rostering starter application to an OpenShift instance.
Preparing deployment files
-
Unzip the add-ons distribution (
rhdm-7.0.0-add-ons.zip
). Unzip the employee-rostering zip file that is extracted from the add-ons archive.
NoteWhen you unzip the employee-rostering zip file, the
optashift-employee-rostering-7.5.0.Final-redhat-4
folder is created. This folder is the base folder in subsequent steps. File and folder names may have higher version numbers than specifically noted in this document.
There are two options for quickly deploying this application to OpenShift:
- Using the Source to Image (S2I) template. This template pulls the source for the application from a Git repository and builds it during the deployment.
- Using the pre-built binary application archive that is provided in the distribution. In this case, a template prepares the environment but does not rebuild the application.
The S2I approach requires significantly more resources to complete than the binary deployment. If your OpenShift environment has less than 2GB of memory available, for example, when using the OpenShift Online Starter tier, you must follow the binary deployment approach.
1.1. Deploying using the Source to Image (S2I) template
Procedure
- Log in to the OpenShift web console and click Import YAML/JSON in the upper right corner.
- Select the project to add to from the Add to Project drop down menu, or select Create Project to create a new one. If creating a new project, enter a new project name, display name, and description.
-
Click the Browse button and navigate to the
optashift-employee-rostering-template.yaml
file. Starting from theoptashift-employee-rostering-7.5.0.Final-redhat-4
folder, access the file by clicking sources > openshift > templates. Click Create.
Figure 1.1. Upload template window
In the Add Template dialog box, click Continue to accept the default settings.
Figure 1.2. Add template window
In the Import YAML/JSON dialog box, click Create to accept the default settings.
Figure 1.3. Configure template window
- In the Success dialog box, click Close.
Wait for the build and deployment to complete. This might take several minutes. When the deployment completes, click the link in the upper right corner and above the shaded bar to open the application.
Figure 1.4. Completed deployment and resulting link
NotePerform a hard refresh of your browser page if the web app does not open after clicking the link.
1.2. Deploying with pre-built binary
Procedure
Prepare the binary deployment.
NoteYou must conduct binary deployments using the oc command line tools. See the OpenShift documentation for installation steps.
-
Working from the
optashift-employee-rostering-7.5.0.Final-redhat-4
distribution folder, open thebinaries
folder. -
Copy the
optashift-employee-rostering-webapp-7.5.0.Final-redhat-4.war
to thesources
folder. -
Rename the file to
ROOT.war
. The updated name instructs the application server to deploy the file to the root context of the server.
-
Working from the
-
Using the command line, change to the
sources
folder. Create a project using the following command:
oc new-project optashift-demo --display-name="Employee Rostering Demo"
NoteAlternatively, you can use an existing project. In this case, replace all instances of
optashift-demo
in this procedure with your project name.Create a build and deployment configuration. Use the
optashift-employee-rostering-template-binary.yaml
template file to set the OpenShift configuration, such as the route to expose the application to make it accessible to browsers.oc process -f openshift/templates/optashift-employee-rostering-template-binary.yaml -n optashift-demo | oc create -f - -n optashift-demo
Upload the binary file to begin a deployment.
oc start-build employee-rostering --from-file=ROOT.war
Use the OpenShift web UI to view the details for the deployed application. Click the link in the Routes section to open the starter application.
Figure 1.5. OpenShift web console with deployed Employee Rostering starter application
Chapter 2. Overview of the employee rostering starter application
The employee rostering starter application assigns employees to shifts on various positions in an organization. For example, you can use the application to distribute shifts in a hospital between nurses, shifts in a diner between its employees, or shifts on an assembly line between workers.
Optimal employee rostering must take a number of variables into account. For example, different skills can be necessary for shifts in different positions. Also, some employees might be unavailable for some time slots or might prefer a particular time slot. You can specify inputs for these variables using the tabs along the top of the application window.
In the current release, the employee rostering starter application fills a fixed amount of shifts in predefined dates. You can not change the dates or shifts. Therefore, it is not possible to use this application for production tasks. You can, however, update any skill, spot, or employee value after you have added them to the system.
Figure 2.1. Employee rostering toolbar
2.1. Entering source information for employee rostering
Tenants
In the TENANT field at the top right corner of the application window, you can select one of the predefined tenants. Each tenant represents an independent set of data; any change in the data for one tenant does not affect any other tenants.
You can switch between tenants to use several independent data sets, for example, to prepare employee rosters for different locations.
Skills
In the skills section, you can set all skills that can be necessary in any position within the roster. For example, a 24-hour diner would require cooking, serving, bussing, and hosting skills, in addition to skills such as general human resources and restaurant operations.
To enter these skills, click the Skills tab.
For each skill:
- Type the name of the skill individually into the Skill Name field.
- Click Add.
Spots
Spots refer to the various positions at the business. For a diner, spots include the bar, the bussing stations, the front counter, the various kitchen stations, the serving areas, and the office. For each spot, you can select a required skill from the list that you entered in the Skills tab. The following table shows a sample list of spots and skills for every spot:
Table 2.1. Spots Example
Name | Required Skill |
Bar | Serving |
Bussing Station 1 | Bussing |
Bussing Station 2 | Bussing |
Front Counter | Hosting, Cash register |
Grill | Cooking |
Prep | Food prep |
Soups | Cooking |
Serving area 1 | Serving |
Serving area 2 | Serving |
Office | HR |
For each spot:
- Enter the spot name into the Spot Name field at the bottom of the screen.
-
Select a required skill from the Required Skill drop-down menu.
- Click Add.
Figure 2.2. Spot name example
Employees
The Employees tab contains a list of all people employed by the business and the skills they possess. In this list, you can set multiple skills for an employee if necessary.
For each employee:
- Enter the name in the Employee Name field at the bottom of the screen.
- Specify a relevant skill by typing in the Skills field and selecting an item from the suggestion list that appears. To specify several skills, repeat this process before proceeding.
- Click Add.
Figure 2.3. Employee name field
Spot Roster
The Spot Roster is a table of all shifts (time slots) during which the business is open and all spots that must be manned during each shift. Each required spot is represented by a red rectangle.
Spots can support multiple employees per shift. If a spot is not required for a shift, you can remove the spot completely from the roster.
Click the blue + icon in any cell to add a new spot for the given shift. To remove a required spot completely from a shift, click the blue X icon in the corresponding cell of the grid.
Figure 2.4. Spot roster example
Figure 2.5. Spot icons detail (lock, edit, remove, add)
2.2. Creating an optimal employee roster
Procedure
Populate your shifts and spots with required employees as necessary.
- Click the edit icon of a spot to open the "Select employee" modal window.
- Choose the employee from the list and click the Assign button.
- The employee is now locked for the given spot and will not be changed by the solver.
- Click the lock icon on the spot to allow the solver to change an assignment.
- Click the remove icon to undo an employee assignment to a spot.
- Click the Solve button to create an optimized solution.
The engine takes up to 30 seconds to create a fully optimal result.
When the optimal result is available, the Spot Roster window displays the name of the assigned employee for each spot and shift.
Employee Roster
The Employee Roster displays the same schedule columns as the Spot Roster, but the rows contain employee names and the spots each employee is scheduled for during a given shift.
Figure 2.6. Employee roster example
2.3. Setting employee availability
You can use the Employee Roster screen to set the shift preferences of employees. The engine attempts to accommodate the preferences when creating the optimal solution. You can click one of three buttons in a shift to declare preference for an employee.
Figure 2.7. Employee shift preferences
From left to right in the figure above, you can select the following options for an employee:
- Unavailable
- Undesired but available
- Desired
Making no selection means the employee has no preference for the given shift.
After making changes to employee availability, click the Solve button to create a new schedule.
The Unavailable option also applies for employees who call in sick or are on vacation. If an employee calls out just before a shift, a manager can indicate the scheduled employee’s unavailability and then create a new schedule.
2.4. Constraints
The Red Hat Business Optimizer rules for this starter application use both hard and soft constraints. During an optimization, the engine may not violate hard constraints, for example, if an employee is unavailable (out sick), or that an employee cannot work two spots in a single shift. The engine tries to adhere to soft constraints, such as an employee’s preference to not work a specific shift, but can violate them if the optimal solution requires it.
Appendix A. Versioning information
Documentation last updated on: Monday, October 1, 2018.