diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2021-01-24 21:43:30 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2021-01-24 21:43:30 +0100 |
commit | 0037e24177fe9fc28809b8afd67a881af94037c0 (patch) | |
tree | 57de3f5c3ed2e06272d2a80086375176df4d5f3d /module/acme/src/main/resources/io | |
parent | 35942469a41df149fe35b113d6f228b654616757 (diff) | |
download | rules-sandbox-0037e24177fe9fc28809b8afd67a881af94037c0.tar.gz rules-sandbox-0037e24177fe9fc28809b8afd67a881af94037c0.tar.bz2 rules-sandbox-0037e24177fe9fc28809b8afd67a881af94037c0.tar.xz rules-sandbox-0037e24177fe9fc28809b8afd67a881af94037c0.zip |
WIP: Optaplanner.
Diffstat (limited to 'module/acme/src/main/resources/io')
-rw-r--r-- | module/acme/src/main/resources/io/trygvis/acme/apps/apps.drl | 22 | ||||
-rw-r--r-- | module/acme/src/main/resources/io/trygvis/acme/planning/machine/solver-config.xml | 18 |
2 files changed, 31 insertions, 9 deletions
diff --git a/module/acme/src/main/resources/io/trygvis/acme/apps/apps.drl b/module/acme/src/main/resources/io/trygvis/acme/apps/apps.drl index e7bdfe3..670079f 100644 --- a/module/acme/src/main/resources/io/trygvis/acme/apps/apps.drl +++ b/module/acme/src/main/resources/io/trygvis/acme/apps/apps.drl @@ -1,9 +1,13 @@ -package io.trygvis.acme.apps; +package io.trygvis.acme.apps import io.trygvis.rules.machine.Machine; import io.trygvis.rules.dba.Cluster; import io.trygvis.rules.dba.Container import io.trygvis.rules.dns.DnsZone; +import io.trygvis.rules.machine.Machine +import io.trygvis.rules.machine.MachineSpecification +import io.trygvis.rules.dba.Cluster +import io.trygvis.rules.dba.Container dialect "mvel" @@ -13,8 +17,8 @@ when then var cluster = new Cluster("acme-ops"); insert(cluster); - insert(new Container(cluster, "pdb", "ops", "postgresql", "11")); - insert(new Container(cluster, "n8n", "ops", "n8n", "0.84.1")); + insert(new Container(cluster, "pdb", "ops", "postgresql", "11", null)); + insert(new Container(cluster, "n8n", "ops", "n8n", "0.84.1", null)); end rule "MyApp" @@ -31,10 +35,10 @@ then var db = $app.environment + "-db"; var tag = $app.dockerTag; - insert(new Container(cluster, "statera", app, "statera", tag)); - insert(new Container(cluster, "statera-console", app, "statera-console", tag)); - insert(new Container(cluster, "4tune-web", app, "4tune-web", tag)); - insert(new Container(cluster, "4tune-api", app, "4tune-api", tag)); - insert(new Container(cluster, "pdb", db, "postgresql", "13")); - insert(new Container(cluster, "mdb", db, "mongodb", "3.2")); + insert(new Container(cluster, "statera", app, "statera", tag, new MachineSpecification(200, 1000))); + insert(new Container(cluster, "statera-console", app, "statera-console", tag, new MachineSpecification(100, 50))); + insert(new Container(cluster, "4tune-web", app, "4tune-web", tag, new MachineSpecification(100, 50))); + insert(new Container(cluster, "4tune-api", app, "4tune-api", tag, new MachineSpecification(200, 200))); + insert(new Container(cluster, "pdb", db, "postgresql", "13", new MachineSpecification(500, 500))); + insert(new Container(cluster, "mdb", db, "mongodb", "3.2", new MachineSpecification(500, 200))); end diff --git a/module/acme/src/main/resources/io/trygvis/acme/planning/machine/solver-config.xml b/module/acme/src/main/resources/io/trygvis/acme/planning/machine/solver-config.xml new file mode 100644 index 0000000..81ae8ed --- /dev/null +++ b/module/acme/src/main/resources/io/trygvis/acme/planning/machine/solver-config.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<solver xmlns="https://www.optaplanner.org/xsd/solver" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="https://www.optaplanner.org/xsd/solver https://www.optaplanner.org/xsd/solver/solver.xsd"> + <!-- Domain model configuration --> + <solutionClass>io.trygvis.acme.planning.machine.CloudBalance</solutionClass> + <entityClass>io.trygvis.acme.planning.machine.CloudProcess</entityClass> + + <!-- Score configuration --> + <scoreDirectorFactory> + <easyScoreCalculatorClass>io.trygvis.acme.planning.machine.CloudBalancingEasyScoreCalculator</easyScoreCalculatorClass> + <!--<scoreDrl>org/optaplanner/examples/cloudbalancing/solver/cloudBalancingConstraints.drl</scoreDrl>--> + </scoreDirectorFactory> + + <!-- Optimization algorithms configuration --> + <termination> + <secondsSpentLimit>3</secondsSpentLimit> + </termination> +</solver> |