Class SimScenario
- java.lang.Object
-
- org.apache.solr.cloud.autoscaling.sim.SimScenario
-
- All Implemented Interfaces:
AutoCloseable
public class SimScenario extends Object implements AutoCloseable
This class represents an autoscaling scenario consisting of a series of autoscaling operations on a simulated cluster.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SimScenario.AddNodes
Add one or more nodes.static class
SimScenario.ApplySuggestions
Apply autoscaling suggestions.static class
SimScenario.Assert
static class
SimScenario.CalculateSuggestions
Calculate autoscaling suggestions.static class
SimScenario.Condition
static class
SimScenario.CreateCluster
Create a simulated cluster.static class
SimScenario.CtxRemove
Remove a context property.static class
SimScenario.CtxSet
Set a context property.static class
SimScenario.Dump
Dump the simulator state to the console.static class
SimScenario.IndexDocs
static class
SimScenario.KillNodes
Kill one or more nodes.static class
SimScenario.LoadAutoscaling
Load autoscaling.json configuration.static class
SimScenario.LoadSnapshot
Create a simulated cluster from an autoscaling snapshot.static class
SimScenario.LoopOp
Loop action.static class
SimScenario.RunSimulator
Run the simulator for a while.static class
SimScenario.RunSolrRequest
Execute a SolrRequest supported bySimCloudManager
.static class
SimScenario.SaveSnapshot
Save an autoscaling snapshot.static class
SimScenario.SetEventListener
Set a temporary listener to wait for a specific trigger event processing.static class
SimScenario.SetNodeMetrics
static class
SimScenario.SetOpDelays
Set delays for specified collection operations in order to simulate slow execution.static class
SimScenario.SetShardMetrics
static class
SimScenario.SimAction
Actions supported by the scenario.static class
SimScenario.SimOp
Base class for implementation of scenario DSL actions.static class
SimScenario.WaitCollection
Wait for a specific collection shape.static class
SimScenario.WaitEvent
Wait for the previously set listener to capture an event.
-
Field Summary
Fields Modifier and Type Field Description boolean
abortLoop
boolean
abortScenario
SimCloudManager
cluster
static String
COLLECTIONS_CTX_PROP
Context variable: List of collections.AutoScalingConfig
config
PrintStream
console
Map<String,Object>
context
static String
LIVE_NODES_CTX_PROP
Context variable: List of live nodes.static String
LOOP_ITER_PROP
Context variable: Current loop iteration or none if outside of loop.List<SimScenario.SimOp>
ops
static String
OVERSEER_LEADER_CTX_PROP
Context variable: Node name of the current Overseer leader.static String
RANDOM_NODE_CTX_PROP
Context variable: Random live node name.static String
RESPONSES_CTX_PROP
Context variable: List of SolrResponses of SOLR_REQUEST operations.static Map<SimScenario.SimAction,Class<? extends SimScenario.SimOp>>
simOps
static String
SUGGESTIONS_CTX_PROP
Context variable: List of calculated suggestions.static String
TRIGGER_EVENT_PREFIX
Last trigger event captured by WAIT_EVENT.boolean
verbose
-
Constructor Summary
Constructors Constructor Description SimScenario()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
static SimScenario
load(String data)
Parse a DSL string and create a scenario ready to run.void
run()
Run the scenario.
-
-
-
Field Detail
-
RANDOM_NODE_CTX_PROP
public static final String RANDOM_NODE_CTX_PROP
Context variable: Random live node name.- See Also:
- Constant Field Values
-
OVERSEER_LEADER_CTX_PROP
public static final String OVERSEER_LEADER_CTX_PROP
Context variable: Node name of the current Overseer leader.- See Also:
- Constant Field Values
-
LIVE_NODES_CTX_PROP
public static final String LIVE_NODES_CTX_PROP
Context variable: List of live nodes.- See Also:
- Constant Field Values
-
COLLECTIONS_CTX_PROP
public static final String COLLECTIONS_CTX_PROP
Context variable: List of collections.- See Also:
- Constant Field Values
-
SUGGESTIONS_CTX_PROP
public static final String SUGGESTIONS_CTX_PROP
Context variable: List of calculated suggestions.- See Also:
- Constant Field Values
-
RESPONSES_CTX_PROP
public static final String RESPONSES_CTX_PROP
Context variable: List of SolrResponses of SOLR_REQUEST operations.- See Also:
- Constant Field Values
-
LOOP_ITER_PROP
public static final String LOOP_ITER_PROP
Context variable: Current loop iteration or none if outside of loop.- See Also:
- Constant Field Values
-
TRIGGER_EVENT_PREFIX
public static final String TRIGGER_EVENT_PREFIX
Last trigger event captured by WAIT_EVENT.- See Also:
- Constant Field Values
-
cluster
public SimCloudManager cluster
-
config
public AutoScalingConfig config
-
ops
public List<SimScenario.SimOp> ops
-
console
public PrintStream console
-
verbose
public boolean verbose
-
abortLoop
public boolean abortLoop
-
abortScenario
public boolean abortScenario
-
simOps
public static Map<SimScenario.SimAction,Class<? extends SimScenario.SimOp>> simOps
-
-
Method Detail
-
load
public static SimScenario load(String data) throws Exception
Parse a DSL string and create a scenario ready to run.- Parameters:
data
- DSL string with commands and parameters- Returns:
- configured scenario
- Throws:
Exception
- on syntax errors
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Throws:
IOException
-
-