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 java.util.List;
022
023/**
024 * Defines the setup of an evaluator's process.
025 * Users can set custom options via {@link #setMemory(int)} and process-type specific methods.
026 * Runtimes can also set options, but should not do so if users have set options by
027 * checking {@link #isOptionSet()}.
028 */
029public interface EvaluatorProcess {
030  /**
031   * @return the launch command line
032   */
033  List<String> getCommandLine();
034
035  /**
036   * @return the type of the evaluator
037   */
038  EvaluatorType getType();
039
040  /**
041   * Set memory size of process in megabytes.
042   *
043   * @param megaBytes
044   * @return this
045   */
046  EvaluatorProcess setMemory(final int megaBytes);
047
048  /**
049   * Check whether custom options have been set for the process.
050   * Options are memory given via {@link #setMemory(int)} and any other custom options
051   * supported by the specific type of evaluator process.
052   *
053   * @return whether custom options have been set for the process
054   */
055  boolean isOptionSet();
056
057  /**
058   * Set the name of the configuration file for the Launcher. This file is assumed to exist in the working directory of
059   * the process launched with this command line.
060   *
061   * @param configurationFileName
062   * @return this
063   */
064  EvaluatorProcess setConfigurationFileName(final String configurationFileName);
065
066  /**
067   * Names a file to which stdout will be redirected.
068   *
069   * @param standardOut
070   * @return this
071   */
072  EvaluatorProcess setStandardOut(final String standardOut);
073
074  /**
075   * Names a file to which stderr will be redirected.
076   *
077   * @param standardErr
078   * @return this
079   */
080  EvaluatorProcess setStandardErr(final String standardErr);
081}