public static String getBaseName(LocalResource lr) { return FilenameUtils.getName(lr.getResource().getFile()); }
public String getBaseName(LocalResource lr) { return FilenameUtils.getName(lr.getResource().getFile()); }
public static void addEnvironmentForResource(LocalResource resource, FileSystem fs, String envPrefix, Map<String, String> env) throws IOException { Path resourcePath = new Path(fs.getHomeDirectory(), resource.getResource().getFile()); FileStatus resourceStatus = fs.getFileStatus(resourcePath); long resourceLength = resourceStatus.getLen(); long resourceTimestamp = resourceStatus.getModificationTime(); env.put(envPrefix + Constants.PATH_SUFFIX, resourcePath.toString()); env.put(envPrefix + Constants.LENGTH_SUFFIX, Long.toString(resourceLength)); env.put(envPrefix + Constants.TIMESTAMP_SUFFIX, Long.toString(resourceTimestamp)); }
private static String toString(org.apache.hadoop.yarn.api.records.URL url) { StringBuffer b = new StringBuffer(); b.append(url.getScheme()).append("://").append(url.getHost()); if(url.getPort() >= 0) { b.append(":").append(url.getPort()); } b.append(url.getFile()); return b.toString(); }
private static String toString(org.apache.hadoop.yarn.api.records.URL url) { StringBuffer b = new StringBuffer(); b.append(url.getScheme()).append("://").append(url.getHost()); if(url.getPort() >= 0) { b.append(":").append(url.getPort()); } b.append(url.getFile()); return b.toString(); }
private static String toString(org.apache.hadoop.yarn.api.records.URL url) { StringBuffer b = new StringBuffer(); b.append(url.getScheme()).append("://").append(url.getHost()); if(url.getPort() >= 0) { b.append(":").append(url.getPort()); } b.append(url.getFile()); return b.toString(); }
/** * Convert a YARN URL into a string value of a normal URL * @param url URL * @return string representatin */ public static String stringify(org.apache.hadoop.yarn.api.records.URL url) { StringBuilder builder = new StringBuilder(); builder.append(url.getScheme()).append("://"); if (url.getHost() != null) { builder.append(url.getHost()).append(":").append(url.getPort()); } builder.append(url.getFile()); return builder.toString(); }
/** * Convert a YARN URL into a string value of a normal URL * @param url URL * @return string representatin */ public static String stringify(org.apache.hadoop.yarn.api.records.URL url) { StringBuilder builder = new StringBuilder(); builder.append(url.getScheme()).append("://"); if (url.getHost() != null) { builder.append(url.getHost()).append(":").append(url.getPort()); } builder.append(url.getFile()); return builder.toString(); }
public String getBaseName(LocalResource lr) { return FilenameUtils.getName(lr.getResource().getFile()); }
@Public @Stable public Path toPath() throws URISyntaxException { return new Path(new URI(getScheme(), getUserInfo(), getHost(), getPort(), getFile(), null, null)); }
@Public @Stable public Path toPath() throws URISyntaxException { return new Path(new URI(getScheme(), getUserInfo(), getHost(), getPort(), getFile(), null, null)); }
/** * return a hadoop path from a given url * * @param url * url to convert * @return path from {@link URL} * @throws URISyntaxException */ public static Path getPathFromYarnURL(URL url) throws URISyntaxException { String scheme = url.getScheme() == null ? "" : url.getScheme(); String authority = ""; if (url.getHost() != null) { authority = url.getHost(); if (url.getUserInfo() != null) { authority = url.getUserInfo() + "@" + authority; } if (url.getPort() > 0) { authority += ":" + url.getPort(); } } return new Path( (new URI(scheme, authority, url.getFile(), null, null)).normalize()); }
/** * return a hadoop path from a given url * * @param url * url to convert * @return path from {@link URL} * @throws URISyntaxException */ public static Path getPathFromYarnURL(URL url) throws URISyntaxException { String scheme = url.getScheme() == null ? "" : url.getScheme(); String authority = ""; if (url.getHost() != null) { authority = url.getHost(); if (url.getUserInfo() != null) { authority = url.getUserInfo() + "@" + authority; } if (url.getPort() > 0) { authority += ":" + url.getPort(); } } return new Path( (new URI(scheme, authority, url.getFile(), null, null)).normalize()); }
if (!pendingResources.containsKey(newRsrc.getResource())) { pendingResources.put(newRsrc.getResource(), cs.submit(download( new Path(newRsrc.getDestinationDirectory().getFile()), newRsrc.getResource(), ugi)));
if (!pendingResources.containsKey(newRsrc.getResource())) { pendingResources.put(newRsrc.getResource(), cs.submit(download( new Path(newRsrc.getDestinationDirectory().getFile()), newRsrc.getResource(), ugi)));
if (!pendingResources.containsKey(newRsrc.getResource())) { pendingResources.put(newRsrc.getResource(), cs.submit(download( new Path(newRsrc.getDestinationDirectory().getFile()), newRsrc.getResource(), ugi)));
if (!pendingResources.containsKey(newRsrc.getResource())) { pendingResources.put(newRsrc.getResource(), cs.submit(download( new Path(newRsrc.getDestinationDirectory().getFile()), newRsrc.getResource(), ugi)));
/** * return a {@link URI} from a given url * * @param url * url to convert * @return path from {@link URL} * @throws URISyntaxException */ @Private public static URI getURIFromYarnURL(URL url) throws URISyntaxException { String scheme = url.getScheme() == null ? "" : url.getScheme(); String authority = ""; if (url.getHost() != null) { authority = url.getHost(); if (url.getUserInfo() != null) { authority = url.getUserInfo() + "@" + authority; } if (url.getPort() > 0) { authority += ":" + url.getPort(); } } return new URI(scheme, authority, url.getFile(), null, null).normalize(); }
} catch (IllegalArgumentException e) { LOG.error("Inorrect path for PRIVATE localization." + next.getResource().getFile(), e); } catch (URISyntaxException e) {