Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs for Scheduled and PeriodicEffectorPolicy #213

Merged
merged 2 commits into from
Sep 16, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 43 additions & 1 deletion guide/blueprints/policies.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Common uses of a policy include the following:
* invoke effectors (management policies) or,
* cause the entity associated with the policy to emit sensor values (enricher policies).

Entities can have zero or more ``Policy`` instances attached to them.
Entities can have zero or more `Policy` instances attached to them.


Off-the-Shelf Policies
Expand Down Expand Up @@ -100,6 +100,48 @@ The ConnectionFailureDetector is an HA policy for monitoring an http connection,

### Optimization Policies

#### PeriodicEffector Policy

- org.apache.brooklyn.policy.action.PeriodicEffectorPolicy

The `PeriodicEffectorPolicy` calls an effector with a set of arguments at a specified time and date. The policy monitors the
sensor configured by `start.sensor` and will only start when this is set to `true`. The default sensor checked is `service.isUp`,
so that the policy will not execute the effector until the entity is started. The following example calls a `resize` effector
to resize a cluster up to 10 members at 8am and then down to 1 member at 6pm.

- type: org.apache.brooklyn.policy.action.PeriodicEffectorPolicy
brooklyn.config:
effector: resize
args:
desiredSize: 10
period: 1 day
time: 08:00:00
- type: org.apache.brooklyn.policy.action.PeriodicEffectorPolicy
brooklyn.config:
effector: resize
args:
desiredSize: 1
period: 1 day
time: 18:00:00

#### ScheduledEffector Policy

- org.apache.brooklyn.policy.action.ScheduledEffectorPolicy

The `ScheduledEffectorPolicy` calls an effector at a specific time. The policy monitors the sensor configured by `start.sensor`
and will only execute the effector at the specified time if this is set to `true`.

There are two modes of operation, one based solely on policy configuration where the effector will execute at the time set
using the `time` key or after the duration set using the `wait` key, or by monitoring sensors. The policy monitors the
`scheduler.invoke.now` sensor and will execute the effector immediately when its value changes to `true`.
When the `scheduler.invoke.at` sensor changes, it will set a time in the future when the effector should be executed.

The following example calls a `backup` effector every night at midnight.

- type: org.apache.brooklyn.policy.action.ScheduledEffectorPolicy
brooklyn.config:
effector: backup
time: 00:00:00

#### FollowTheSun Policy

Expand Down