public class ExecutionScheduleManager extends Object
Modifier and Type | Field and Description |
---|---|
protected com.sun.jersey.api.client.Client |
ambariClient |
protected com.sun.jersey.api.client.WebResource |
ambariWebResource |
protected static String |
BATCH_REQUEST_JOB_PREFIX |
protected static String |
DEFAULT_API_PATH |
protected static String |
REQUEST_EXECUTION_TRIGGER_PREFIX |
protected static String |
REQUESTS_ABORTED_TASKS_KEY |
protected static String |
REQUESTS_FAILED_TASKS_KEY |
protected static String |
REQUESTS_ID_KEY |
protected static String |
REQUESTS_STATUS_KEY |
protected static String |
REQUESTS_TIMEDOUT_TASKS_KEY |
protected static String |
REQUESTS_TOTAL_TASKS_KEY |
Constructor and Description |
---|
ExecutionScheduleManager(Configuration configuration,
ExecutionScheduler executionScheduler,
InternalTokenStorage tokenStorage,
Clusters clusters,
ActionDBAccessor actionDBAccessor,
com.google.gson.Gson gson) |
Modifier and Type | Method and Description |
---|---|
protected void |
buildApiClient() |
boolean |
continueOnMisfire(org.quartz.JobExecutionContext jobExecutionContext)
Find out by how much did a schedule misfire and decide whether to continue
based on configuration
|
void |
deleteAllJobs(RequestExecution requestExecution)
Delete all jobs and triggers if possible.
|
Long |
executeBatchRequest(long executionId,
long batchId,
String clusterName)
Execute a Batch request and return request id if the server responds with
a request id for long running operations.
|
void |
finalizeBatch(long executionId,
String clusterName)
Marks Request Schedule as COMPLETED, if:
No triggers exist for the first job in the chain OR
If the trigger will never fire again.
|
BatchRequestResponse |
getBatchRequestResponse(Long requestId,
String clusterName)
Get status of a long running operation
|
protected String |
getJobName(Long executionId,
Long orderId) |
boolean |
hasToleranceThresholdExceeded(Long executionId,
String clusterName,
Map<String,Integer> taskCounts)
Check if the allowed threshold for failed tasks has exceeded.
|
boolean |
isSchedulerAvailable()
Is Execution scheduler available for accepting jobs?
|
protected BatchRequestResponse |
performApiGetRequest(String relativeUri,
boolean queryAllFields) |
protected BatchRequestResponse |
performApiRequest(String relativeUri,
String body,
String method) |
protected BatchRequestResponse |
performUriRequest(String url,
String body,
String method) |
void |
scheduleBatch(RequestExecution requestExecution)
Persist jobs based on the request batch and create trigger for the first
job
|
void |
scheduleJob(org.quartz.Trigger trigger)
Add trigger for a job to the scheduler
|
void |
start()
Start Execution scheduler
|
void |
stop()
Stop execution scheduler
|
void |
updateBatchRequest(long executionId,
long batchId,
String clusterName,
BatchRequestResponse batchRequestResponse,
boolean statusOnly) |
void |
updateBatchSchedule(RequestExecution requestExecution)
Delete and re-create all jobs and triggers
Update schedule for a batch
|
void |
validateSchedule(Schedule schedule)
Validate if schedule expression is a valid Cron schedule
|
protected static final String BATCH_REQUEST_JOB_PREFIX
protected static final String REQUEST_EXECUTION_TRIGGER_PREFIX
protected static final String DEFAULT_API_PATH
protected com.sun.jersey.api.client.Client ambariClient
protected com.sun.jersey.api.client.WebResource ambariWebResource
protected static final String REQUESTS_STATUS_KEY
protected static final String REQUESTS_ID_KEY
protected static final String REQUESTS_FAILED_TASKS_KEY
protected static final String REQUESTS_ABORTED_TASKS_KEY
protected static final String REQUESTS_TIMEDOUT_TASKS_KEY
protected static final String REQUESTS_TOTAL_TASKS_KEY
@Inject public ExecutionScheduleManager(Configuration configuration, ExecutionScheduler executionScheduler, InternalTokenStorage tokenStorage, Clusters clusters, ActionDBAccessor actionDBAccessor, com.google.gson.Gson gson)
protected void buildApiClient()
public void start()
public void stop()
public boolean isSchedulerAvailable()
public void scheduleJob(org.quartz.Trigger trigger)
trigger
- public boolean continueOnMisfire(org.quartz.JobExecutionContext jobExecutionContext)
jobExecutionContext
- public void scheduleBatch(RequestExecution requestExecution) throws AmbariException
requestExecution
- AmbariException
public void updateBatchSchedule(RequestExecution requestExecution) throws AmbariException
requestExecution
- AmbariException
public void validateSchedule(Schedule schedule) throws AmbariException
schedule
- AmbariException
public void deleteAllJobs(RequestExecution requestExecution) throws AmbariException
AmbariException
public Long executeBatchRequest(long executionId, long batchId, String clusterName) throws AmbariException
AmbariException
public BatchRequestResponse getBatchRequestResponse(Long requestId, String clusterName) throws AmbariException
AmbariException
public void updateBatchRequest(long executionId, long batchId, String clusterName, BatchRequestResponse batchRequestResponse, boolean statusOnly) throws AmbariException
AmbariException
protected BatchRequestResponse performUriRequest(String url, String body, String method)
protected BatchRequestResponse performApiGetRequest(String relativeUri, boolean queryAllFields)
protected BatchRequestResponse performApiRequest(String relativeUri, String body, String method)
public boolean hasToleranceThresholdExceeded(Long executionId, String clusterName, Map<String,Integer> taskCounts) throws AmbariException
executionId
- clusterName
- taskCounts
- AmbariException
public void finalizeBatch(long executionId, String clusterName) throws AmbariException
executionId
- clusterName
- AmbariException
Copyright © 2014. All rights reserved.