Search in sources :

Example 6 with Joblet

use of org.apache.hyracks.control.nc.Joblet in project asterixdb by apache.

the class CleanupJobletWork method run.

@Override
public void run() {
    if (LOGGER.isLoggable(Level.INFO)) {
        LOGGER.info("Cleaning up after job: " + jobId);
    }
    final List<IPartition> unregisteredPartitions = new ArrayList<IPartition>();
    ncs.getPartitionManager().unregisterPartitions(jobId, unregisteredPartitions);
    ncs.getExecutor().execute(new Runnable() {

        @Override
        public void run() {
            for (IPartition p : unregisteredPartitions) {
                try {
                    // Put deallocate in a try block to make sure that every IPartition is de-allocated.
                    p.deallocate();
                } catch (Exception e) {
                    if (LOGGER.isLoggable(Level.WARNING)) {
                        LOGGER.log(Level.WARNING, e.getMessage(), e);
                    }
                }
            }
        }
    });
    Map<JobId, Joblet> jobletMap = ncs.getJobletMap();
    Joblet joblet = jobletMap.remove(jobId);
    if (joblet != null) {
        joblet.cleanup(status);
    }
}
Also used : ArrayList(java.util.ArrayList) IPartition(org.apache.hyracks.api.partitions.IPartition) JobId(org.apache.hyracks.api.job.JobId) Joblet(org.apache.hyracks.control.nc.Joblet)

Aggregations

Joblet (org.apache.hyracks.control.nc.Joblet)6 JobId (org.apache.hyracks.api.job.JobId)4 ArrayList (java.util.ArrayList)3 TaskAttemptId (org.apache.hyracks.api.dataflow.TaskAttemptId)2 ActivityClusterGraph (org.apache.hyracks.api.job.ActivityClusterGraph)2 Task (org.apache.hyracks.control.nc.Task)2 InetSocketAddress (java.net.InetSocketAddress)1 UnknownHostException (java.net.UnknownHostException)1 List (java.util.List)1 INCServiceContext (org.apache.hyracks.api.application.INCServiceContext)1 IFrameWriter (org.apache.hyracks.api.comm.IFrameWriter)1 IPartitionCollector (org.apache.hyracks.api.comm.IPartitionCollector)1 IPartitionWriterFactory (org.apache.hyracks.api.comm.IPartitionWriterFactory)1 PartitionChannel (org.apache.hyracks.api.comm.PartitionChannel)1 ActivityId (org.apache.hyracks.api.dataflow.ActivityId)1 IActivity (org.apache.hyracks.api.dataflow.IActivity)1 IConnectorDescriptor (org.apache.hyracks.api.dataflow.IConnectorDescriptor)1 IOperatorNodePushable (org.apache.hyracks.api.dataflow.IOperatorNodePushable)1 TaskId (org.apache.hyracks.api.dataflow.TaskId)1 IConnectorPolicy (org.apache.hyracks.api.dataflow.connectors.IConnectorPolicy)1