001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.reef.vortex.protocol.workertomaster; 020 021import org.apache.reef.annotations.Unstable; 022 023import java.util.ArrayList; 024import java.util.Collections; 025import java.util.List; 026 027/** 028 * Report of a tasklet exception on aggregation. 029 */ 030@Unstable 031public final class TaskletAggregationFailureReport implements WorkerToMasterReport { 032 private List<Integer> taskletIds; 033 private Exception exception; 034 035 /** 036 * No-arg constructor required for Kryo to serialize/deserialize. 037 */ 038 TaskletAggregationFailureReport() { 039 } 040 041 /** 042 * @param taskletIds of the failed tasklet(s). 043 * @param exception that caused the tasklet failure. 044 */ 045 public TaskletAggregationFailureReport(final List<Integer> taskletIds, final Exception exception) { 046 this.taskletIds = Collections.unmodifiableList(new ArrayList<>(taskletIds)); 047 this.exception = exception; 048 } 049 050 /** 051 * @return the type of this TaskletReport. 052 */ 053 @Override 054 public Type getType() { 055 return Type.TaskletAggregationFailure; 056 } 057 058 /** 059 * @return the taskletIds that failed on aggregation. 060 */ 061 public List<Integer> getTaskletIds() { 062 return taskletIds; 063 } 064 065 /** 066 * @return the exception that caused the tasklet aggregation failure. 067 */ 068 public Exception getException() { 069 return exception; 070 } 071}