public abstract class BaseTaskScheduler extends Object implements TaskScheduler
TaskScheduler interface.| Modifier and Type | Field and Description |
|---|---|
protected boolean |
disconnect
Whether to disconnect from gemfire on normal exit
|
protected boolean |
haltIfBadResult
Whether to halt when a (non-hang) fatal task error occurs.
|
protected com.gemstone.gemfire.LogWriter |
log |
protected String |
name
The name of this scheduler
|
protected String |
purpose
The purpose of this scheduler
|
protected Vector |
tasks
The tasks for this scheduler
|
protected String |
termination
reason this scheduler is terminating
|
protected Map |
vms
The client vm records for this scheduler
|
| Constructor and Description |
|---|
BaseTaskScheduler(String name,
Vector tasks,
String purpose)
Creates a task scheduler by the given name for the purpose of executing
the given set of tasks.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
assignTask(ClientRecord client,
TestTask task)
Asks the client to execute the task.
|
void |
createClients(Map cds,
Map tgs)
Asks this scheduler to create vm and client records based on the client
descriptions and map clients to threadgroups.
|
protected boolean |
exceededMaxResultWaitSec(ClientRecord client,
long now)
Returns true if the client is still busy and has run out of time.
|
protected boolean |
exceededMaxResultWaitSec(Collection clients,
long now)
Returns true if any clients are still busy and have run out of time.
|
protected boolean |
exceededMaxResultWaitSec(long now)
Returns true if any clients are still busy and have run out of time.
|
protected boolean |
executedNormally()
Returns true if the scheduler executed normally up to this point.
|
protected boolean |
executedNormallyOrNoHaltOrder()
Returns true if the scheduler executed normally up to this point or
should continue in spite of fatal task error.
|
protected abstract boolean |
executeTasks()
Executes the tasks using the existing clients.
|
boolean |
executeTasks(boolean haltIfBadResult,
long maxResultWaitSec)
Executes the tasks for this scheduler using existing clients.
|
protected static void |
fakeKillResults(ClientVmRecord vm)
Called by dynamic stopper threads to fake task results for the busy
clients in a killed vm so the scheduler will not wait for them to finish.
|
protected int |
getTsid()
Returns the task scheduler id.
|
protected ClientVmRecord |
getVm(Integer vmid)
Returns the client vm record with the given id.
|
protected Map |
getVms()
Returns the client vm records.
|
protected boolean |
hadDynamicActionError()
Returns true if there has been an error during a dynamic action.
|
protected boolean |
hadDynamicActionHang()
Returns true if there has been a hang during a dynamic action.
|
protected boolean |
hadFatalTaskErrorAndHaltOrder()
Returns true if any client has encountered a fatal task error and the
test is configured to halt.
|
protected boolean |
hadStatMonitorError()
Returns true if a monitored condition was violated or there was an error
in the statistics monitor.
|
protected void |
initClientRuntime()
Initializes client runtime state prior to task execution.
|
protected void |
initExecutionParameters(boolean haltIfBadResult,
long maxResultWaitSec)
Initializes task execution fields.
|
protected boolean |
isFinished(ClientRecord client,
long now)
Returns true if a client has finished its task or encountered a failure.
|
protected void |
pauseBlocking()
Used to pause a terminating scheduler when it is waiting for dynamic
schedulers to complete.
|
protected void |
pauseScheduling()
Used to pause an active scheduler when it has had an unfruitful pass
through the live client list.
|
protected void |
pauseWaiting()
Used to pause a terminating scheduler when it is waiting for currently
busy clients to complete their tasks.
|
protected void |
printBlockingReport(long now)
Periodically logs that scheduler is waiting for dynamic actions to finish.
|
void |
printReport()
Asks this scheduler to log the result of executing its tasks, including
the number of times the task was assigned and a summary of response times.
|
protected void |
printSchedulingReport(long now)
Periodically logs that scheduler is waiting for idle eligible clients.
|
protected void |
printWaitingReport(long now)
Periodically logs that scheduler is waiting for busy clients to finish.
|
protected static void |
processDynamicActionError(Throwable t)
Triggers the test to halt due to an error during a dynamic action.
|
protected static void |
reportResult(int tsid,
int vmid,
int tid,
TestTaskResult result)
Called remotely by client threads to pass back task results.
|
protected boolean |
schedulerResult()
Returns the pass/fail outcome of running the scheduler and prints the
reason the scheduler terminated.
|
protected static void |
setDynamicActionError(Throwable t)
Sets the global dynamic action error flag and local termination condition.
|
protected static void |
setDynamicActionHang(Throwable t)
Sets the global dynamic action hang flag and local termination condition.
|
protected static void |
setStatMonitorError(Throwable t)
Sets the global statistics monitor error flag and local termination
condition.
|
protected void |
setTermination(String reason)
Sets the reason for terminating the scheduler.
|
void |
startClients()
Asks this scheduler to start clients previously created.
|
void |
startClientsForced()
Asks this scheduler to start clients previously created, regardless of
whether there have been fatal task errors or hangs in earlier phases of
the test.
|
void |
stopClients()
Asks this scheduler to stop the clients, rather than leaving them running
for another scheduler to use later.
|
protected long |
waitForClientsToFinish()
Waits for clients in all vms to finish their tasks or encounter a failure.
|
protected long |
waitForClientsToFinish(Vector clients)
Waits for clients in a vm to finish their tasks or encounter a failure.
|
protected long |
waitForClientToFinish(ClientRecord client)
Waits for a client to finish its task or encounter a failure.
|
protected String name
protected Map vms
protected Vector tasks
protected String purpose
protected boolean haltIfBadResult
protected boolean disconnect
protected String termination
protected com.gemstone.gemfire.LogWriter log
public void createClients(Map cds, Map tgs)
createClients in interface TaskSchedulercds - the ClientDescription describes the client vms and threadstgs - the thread groups to map clients to.public void startClients()
startClients in interface TaskSchedulerHydraInternalException - if there are no clients, or any are runningHydraTimeoutException - if the clients do not start within
Prms.maxClientStartupWaitSecpublic void startClientsForced()
startClientsForced in interface TaskSchedulerHydraTimeoutException - if the clients do not start within
Prms.maxClientStartupWaitSecpublic void stopClients()
stopClients in interface TaskSchedulerHydraTimeoutException - if the clients do not stop within
Prms.maxClientShutdownWaitSecpublic boolean executeTasks(boolean haltIfBadResult,
long maxResultWaitSec)
executeTasks in interface TaskSchedulerhaltIfBadResult - whether to terminate on a fatal task errormaxResultWaitSec - the maximum amount of time to wait for any one
task to completeHydraInternalException - if there are no tasks or no clientsprotected void initExecutionParameters(boolean haltIfBadResult,
long maxResultWaitSec)
protected void initClientRuntime()
protected abstract boolean executeTasks()
protected int getTsid()
protected Map getVms()
protected ClientVmRecord getVm(Integer vmid)
protected void assignTask(ClientRecord client, TestTask task)
protected long waitForClientsToFinish()
protected long waitForClientsToFinish(Vector clients)
protected long waitForClientToFinish(ClientRecord client)
protected boolean isFinished(ClientRecord client, long now)
protected boolean hadFatalTaskErrorAndHaltOrder()
protected static void setStatMonitorError(Throwable t)
protected boolean hadStatMonitorError()
protected static void processDynamicActionError(Throwable t)
protected static void setDynamicActionError(Throwable t)
protected static void setDynamicActionHang(Throwable t)
protected boolean hadDynamicActionError()
protected boolean hadDynamicActionHang()
protected boolean exceededMaxResultWaitSec(long now)
protected boolean exceededMaxResultWaitSec(Collection clients, long now)
protected boolean exceededMaxResultWaitSec(ClientRecord client, long now)
protected void setTermination(String reason)
protected boolean executedNormallyOrNoHaltOrder()
protected boolean executedNormally()
protected boolean schedulerResult()
protected static void reportResult(int tsid,
int vmid,
int tid,
TestTaskResult result)
protected static void fakeKillResults(ClientVmRecord vm)
protected void printSchedulingReport(long now)
protected void pauseScheduling()
protected void printWaitingReport(long now)
protected void pauseWaiting()
protected void printBlockingReport(long now)
protected void pauseBlocking()
public void printReport()
printReport in interface TaskSchedulerCopyright © 2010-2015 Pivotal Software, Inc. All rights reserved.