/** * Get the output directory to write YourKit snapshots to * * @param context Map context * @return output directory */ public String getYourKitOutputDir(Mapper.Context context) { final String cacheKey = "giraph.yourkit.outputDirCached"; String outputDir = get(cacheKey); if (outputDir == null) { outputDir = getStringVars(YOURKIT_OUTPUT_DIR, YOURKIT_OUTPUT_DIR_DEFAULT, context); set(cacheKey, outputDir); } return outputDir; }
/** * Get string, replacing variables in the output. * * %JOB_ID% => job id * %TASK_ID% => task id * %USER% => owning user name * * @param key name of key to lookup * @param defaultValue value to return if no mapping exists. This can also * have variables, which will be substituted. * @param context mapper context * @return value for key, with variables expanded */ public String getStringVars(String key, String defaultValue, Mapper.Context context) { String value = get(key); if (value == null) { if (defaultValue == null) { return null; } value = defaultValue; } value = value.replace("%JOB_ID%", context.getJobID().toString()); value = value.replace("%TASK_ID%", context.getTaskAttemptID().toString()); value = value.replace("%USER%", get("user.name", "unknown_user")); return value; }
final GiraphConfiguration giraphConf = new GiraphConfiguration(getConf()); final int zkPort = ZOOKEEPER_SERVER_PORT.get(giraphConf); final String zkBasePath = giraphConf.get( GiraphConstants.BASE_ZNODE_KEY, "") + BspService.BASE_DIR; final String[] zkServerList;
File tmpDir) throws Exception { String ns = conf.get(HBaseGraphConfiguration.Keys.GRAPH_NAMESPACE); String prefix = conf.get(HBaseGraphConfiguration.Keys.GRAPH_TABLE_PREFIX); String tablePrefix = (ns != null ? ns + TableName.NAMESPACE_DELIM : "") + (prefix != null ? prefix : ""); conf.set(Constants.EDGE_INPUT_TABLE, tablePrefix + Constants.EDGES);
@Override public int run(String[] args) throws Exception { if (null == getConf()) { conf = new Configuration(); } GiraphConfiguration giraphConf = new GiraphConfiguration(getConf()); YamlConfiguration yamlConfig = new YamlConfiguration(args); yamlConfig.load(); yamlConfig.populateGiraphConfiguration(giraphConf); // set up job for various platforms final String arabesqueComputationName = giraphConf.get(io.arabesque.conf.Configuration.CONF_COMPUTATION_CLASS); final String jobName = "Arabesque: " + arabesqueComputationName; // run the job, collect results if (LOG.isDebugEnabled()) { LOG.debug("Attempting to run computation: " + arabesqueComputationName); } GiraphJob job = getJob(giraphConf, jobName); boolean verbose = yamlConfig.getBoolean("verbose"); return job.run(verbose) ? 0 : -1; }