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.runtime.local.driver;
020
021import org.apache.reef.annotations.audience.Private;
022
023import java.io.File;
024import java.util.List;
025
026/**
027 * Represents a Container: A slice of a machine.
028 * <p>
029 * In the case of the local resourcemanager, this slice is always the one of the machine where the job was submitted.
030 */
031@Private
032public interface Container extends AutoCloseable {
033
034  /**
035   * Run the given commandLine in the container.
036   *
037   * @param commandLine the command line to execute. It will typically be joined by spaces to form the command line.
038   */
039  void run(final List<String> commandLine);
040
041  /**
042   * Copies the files to the working directory of the container.
043   *
044   * @param files the files to be added to the container.
045   */
046  void addLocalFiles(final Iterable<File> files);
047
048  void addGlobalFiles(final File globalFolder);
049
050  /**
051   * @return true if the Container is currently executing, false otherwise.
052   */
053  boolean isRunning();
054
055  /**
056   * @return the ID of the node this Container is executing on.
057   */
058  String getNodeID();
059
060  /**
061   * @return the ID of this Container.
062   */
063  String getContainerID();
064
065  /**
066   * @return the main memory available to the Container.
067   */
068  int getMemory();
069
070  /**
071   * @return the core available to the Container.
072   */
073  int getNumberOfCores();
074
075  /**
076   * @return the working directory of the Container.
077   */
078  File getFolder();
079
080  /**
081   * Kills the Container.
082   */
083  @Override
084  void close();
085
086  /**
087   * @return the rack name where this container is located
088   */
089  String getRackName();
090
091}