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.mastertoworker; 020 021import org.apache.reef.annotations.Unstable; 022import org.apache.reef.annotations.audience.DriverSide; 023import org.apache.reef.annotations.audience.Private; 024 025/** 026 * A request from the Vortex Driver to run an aggregate-able function. 027 */ 028@Unstable 029@Private 030@DriverSide 031public final class TaskletAggregateExecutionRequest<TInput> implements MasterToWorkerRequest { 032 private TInput input; 033 private int aggregateFunctionId; 034 private int taskletId; 035 036 /** 037 * No-arg constructor required for Kryo to serialize/deserialize. 038 */ 039 TaskletAggregateExecutionRequest() { 040 } 041 042 public TaskletAggregateExecutionRequest(final int taskletId, 043 final int aggregateFunctionId, 044 final TInput input) { 045 this.taskletId = taskletId; 046 this.input = input; 047 this.aggregateFunctionId = aggregateFunctionId; 048 } 049 050 /** 051 * @return input of the request. 052 */ 053 public TInput getInput() { 054 return input; 055 } 056 057 /** 058 * @return tasklet ID corresponding to the tasklet request. 059 */ 060 public int getTaskletId() { 061 return taskletId; 062 } 063 064 /** 065 * @return the AggregateFunctionID of the request. 066 */ 067 public int getAggregateFunctionId() { 068 return aggregateFunctionId; 069 } 070 071 @Override 072 public Type getType() { 073 return Type.ExecuteAggregateTasklet; 074 } 075}