This project has retired. For details please refer to its Attic page.
Source code
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.driver.evaluator;
020
021import org.apache.reef.annotations.Provided;
022import org.apache.reef.annotations.audience.DriverSide;
023import org.apache.reef.annotations.audience.Public;
024import org.apache.reef.driver.ContextAndTaskSubmittable;
025import org.apache.reef.driver.ContextSubmittable;
026import org.apache.reef.driver.TaskSubmittable;
027import org.apache.reef.io.naming.Identifiable;
028import org.apache.reef.tang.Configuration;
029
030import java.io.File;
031
032/**
033 * Represents an Evaluator that is allocated, but is not running yet.
034 */
035@Public
036@DriverSide
037@Provided
038public interface AllocatedEvaluator
039    extends AutoCloseable, Identifiable, ContextSubmittable, ContextAndTaskSubmittable, TaskSubmittable {
040
041  /**
042   * Puts the given file into the working directory of the Evaluator.
043   *
044   * @param file the file to be copied
045   */
046  void addFile(final File file);
047
048  /**
049   * Puts the given file into the working directory of the Evaluator and adds it to its classpath.
050   *
051   * @param file the file to be copied
052   */
053  void addLibrary(final File file);
054
055  /**
056   * @return the evaluator descriptor of this evaluator.
057   */
058  EvaluatorDescriptor getEvaluatorDescriptor();
059
060  /**
061   * Specify the process to be instantiated for the Evaluator.
062   * Defaults to an EvaluatorProcess instantiated by the binded ProcessFactory.
063   *
064   * @param process
065   */
066  void setProcess(final EvaluatorProcess process);
067
068  /**
069   * Releases the allocated evaluator back to the resource manager.
070   */
071  @Override
072  void close();
073
074  /**
075   * Submits the given Task for execution.
076   * <p>
077   * This generates a ContextConfiguration for the root context with a generated ID derived from the EvaluatorId.
078   *
079   * @param taskConfiguration the Configuration. See TaskConfiguration for details.
080   */
081  @Override
082  void submitTask(final Configuration taskConfiguration);
083
084  @Override
085  void submitContext(final Configuration contextConfiguration);
086
087  @Override
088  void submitContextAndService(final Configuration contextConfiguration,
089                               final Configuration serviceConfiguration);
090
091  @Override
092  void submitContextAndTask(final Configuration contextConfiguration,
093                            final Configuration taskConfiguration);
094
095  @Override
096  void submitContextAndServiceAndTask(final Configuration contextConfiguration,
097                                      final Configuration serviceConfiguration,
098                                      final Configuration taskConfiguration);
099}