Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
*
* * Copyright 2015 Skymind,Inc.
* *
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
* *
* * http://www.apache.org/licenses/LICENSE-2.0
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* * limitations under the License.
*
*/
package org.deeplearning4j.iterativereduce.runtime.yarn.client;
import org.deeplearning4j.iterativereduce.runtime.ConfigFields;
import org.deeplearning4j.iterativereduce.runtime.Utils;
import org.deeplearning4j.iterativereduce.runtime.yarn.ResourceManagerHandler;
import org.apache.commons.lang.time.StopWatch;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
import org.apache.hadoop.yarn.api.records.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Properties;
public class Client extends Configured implements Tool {
private static final Logger LOG = LoggerFactory.getLogger(Client.class);
/**
* TODO: consider the scenarios where we dont get enough containers
* - we need to re-submit the job till we get the containers alloc'd
*
*/
@Override
public int run(String[] args) throws Exception {
//System.out.println("IR: Client.run() [start]");
if (args.length < 1)
LOG.info("No configuration file specified, using default ("
+ ConfigFields.DEFAULT_CONFIG_FILE + ")");
long startTime = System.currentTimeMillis();
String configFile = (args.length < 1) ? ConfigFields.DEFAULT_CONFIG_FILE : args[0];
Properties props = new Properties();
Configuration conf = getConf();
try {
FileInputStream fis = new FileInputStream(configFile);
props.load(fis);
} catch (FileNotFoundException ex) {
throw ex; // TODO: be nice
} catch (IOException ex) {
throw ex; // TODO: be nice
}
// Make sure we have some bare minimums
ConfigFields.validateConfig(props);
if (LOG.isDebugEnabled()) {
LOG.debug("Loaded configuration: ");
for (Map.Entry