public class TaskService extends Object
ClusterTask
s.Modifier and Type | Method and Description |
---|---|
void |
completeJob(ClusterJob job,
Cluster cluster)
Sets the status of the given job to
ClusterJob.Status.COMPLETE and the status of the given cluster to
Cluster.Status.ACTIVE . |
void |
completeTask(ClusterTask clusterTask,
int status)
Complete a task by setting the status of the task to
ClusterTask.Status.COMPLETE and the status time to
the current timestamp and the status code to the given code. |
void |
dropTask(ClusterTask clusterTask)
Drop a task by setting the status of the task to
ClusterTask.Status.DROPPED and the status time to the
current timestamp. |
void |
failJob(ClusterJob job)
Sets the status of the given job to
ClusterJob.Status.FAILED and persists it to the store. |
void |
failJobAndSetClusterStatus(ClusterJob job,
Cluster cluster)
Sets the status of the given job to
ClusterJob.Status.FAILED and the status of the cluster to the default
failure status as given in ClusterAction.getFailureStatus() . |
void |
failJobAndSetClusterStatus(ClusterJob job,
Cluster cluster,
Cluster.Status status,
String message)
Sets the status of the given job to
ClusterJob.Status.FAILED and the status of the cluster to some given
status. |
void |
failJobAndTerminateCluster(ClusterJob job,
Cluster cluster,
String message)
Sets the status of the given job to
ClusterJob.Status.FAILED and the status of the given cluster to
Cluster.Status.TERMINATED . |
void |
failTask(ClusterTask clusterTask,
int status)
Fail a task by setting the status of the task to
ClusterTask.Status.FAILED and the status time to the
current timestamp and the status code to the given code. |
List<ClusterTask> |
getRetryTask(ClusterTask task)
Get tasks that must be run in order to retry the given task that failed on a given node in a given cluster.
|
void |
startJob(ClusterJob job,
Cluster cluster)
Sets the status of the given job to
ClusterJob.Status.RUNNING and add it to the queue to be run. |
void |
startTask(ClusterTask clusterTask)
Starts a task by setting the status of the task to
ClusterTask.Status.IN_PROGRESS and the submit time
to the current timestamp. |
public List<ClusterTask> getRetryTask(ClusterTask task)
task
- Task that failed and must be retried.public void failJobAndSetClusterStatus(ClusterJob job, Cluster cluster, Cluster.Status status, String message) throws IOException, IllegalAccessException
ClusterJob.Status.FAILED
and the status of the cluster to some given
status.job
- Job to fail.cluster
- Cluster to set the status for.status
- Status to set the cluster to.message
- Error message.IOException
IllegalAccessException
public void failJobAndSetClusterStatus(ClusterJob job, Cluster cluster) throws IOException, IllegalAccessException
ClusterJob.Status.FAILED
and the status of the cluster to the default
failure status as given in ClusterAction.getFailureStatus()
.job
- Job to fail.cluster
- Cluster to set the status for.IOException
IllegalAccessException
public void failJobAndTerminateCluster(ClusterJob job, Cluster cluster, String message) throws IOException, IllegalAccessException
ClusterJob.Status.FAILED
and the status of the given cluster to
Cluster.Status.TERMINATED
.job
- Job to fail.cluster
- Cluster to terminate.message
- Error message.IOException
IllegalAccessException
public void failJob(ClusterJob job) throws IOException
ClusterJob.Status.FAILED
and persists it to the store.job
- Job to fail.IOException
public void startJob(ClusterJob job, Cluster cluster) throws IOException
ClusterJob.Status.RUNNING
and add it to the queue to be run.job
- Job to start.cluster
- Cluster the job is for.IOException
public void completeJob(ClusterJob job, Cluster cluster) throws IOException, IllegalAccessException
ClusterJob.Status.COMPLETE
and the status of the given cluster to
Cluster.Status.ACTIVE
.job
- Job to complete.cluster
- Cluster the job was for.IOException
IllegalAccessException
public void startTask(ClusterTask clusterTask) throws IOException
ClusterTask.Status.IN_PROGRESS
and the submit time
to the current timestamp.clusterTask
- Task to start.IOException
public void dropTask(ClusterTask clusterTask) throws IOException
ClusterTask.Status.DROPPED
and the status time to the
current timestamp. Tasks can be dropped if there is no longer any point in executing them. For example, if another
task in the same stage has failed, the entire job cannot complete so there is no point in executing any
unexecuted task in the job.clusterTask
- Task to drop.IOException
public void failTask(ClusterTask clusterTask, int status) throws IOException
ClusterTask.Status.FAILED
and the status time to the
current timestamp and the status code to the given code.clusterTask
- Task to fail.status
- Status code of the failed task.IOException
public void completeTask(ClusterTask clusterTask, int status) throws IOException
ClusterTask.Status.COMPLETE
and the status time to
the current timestamp and the status code to the given code.clusterTask
- Task to complete.status
- Status code of the completed task.IOException
Copyright © 2013-2016 Cask Data, Inc. Licensed under the Apache License, Version 2.0.