本文整理了Java中org.apache.hadoop.yarn.api.records.URL.toPath()
方法的一些代码示例,展示了URL.toPath()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。URL.toPath()
方法的具体详情如下:
包路径:org.apache.hadoop.yarn.api.records.URL
类名称:URL
方法名:toPath
暂无
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-common
/**
* return a hadoop path from a given url
* This method is deprecated, use {@link URL#toPath()} instead.
*
* @param url
* url to convert
* @return path from {@link URL}
* @throws URISyntaxException
*/
@Public
@Deprecated
public static Path getPathFromYarnURL(URL url) throws URISyntaxException {
return url.toPath();
}
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-nodemanager
remotePath = resource.getResource().toPath();
} catch (URISyntaxException e) {
throw new IOException("Invalid resource", e);
代码示例来源:origin: io.hops/hadoop-yarn-server-nodemanager
remotePath = resource.getResource().toPath();
} catch (URISyntaxException e) {
throw new IOException("Invalid resource", e);
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-common
/**
* Localize files.
* @param destination destination directory
* @throws IOException cannot read or write file
* @throws YarnException subcommand returned an error
*/
private void verifyAndCopy(Path destination)
throws IOException, YarnException {
final Path sCopy;
try {
sCopy = resource.getResource().toPath();
} catch (URISyntaxException e) {
throw new IOException("Invalid resource", e);
}
FileSystem sourceFs = sCopy.getFileSystem(conf);
FileStatus sStat = sourceFs.getFileStatus(sCopy);
if (sStat.getModificationTime() != resource.getTimestamp()) {
throw new IOException("Resource " + sCopy +
" changed on src filesystem (expected " + resource.getTimestamp() +
", was " + sStat.getModificationTime());
}
if (resource.getVisibility() == LocalResourceVisibility.PUBLIC) {
if (!isPublic(sourceFs, sCopy, sStat, statCache)) {
throw new IOException("Resource " + sCopy +
" is not publicly accessible and as such cannot be part of the" +
" public cache.");
}
}
downloadAndUnpack(sCopy, destination);
}
代码示例来源:origin: io.hops/hadoop-mapreduce-client-common
resourcePath = resource.getResource().toPath();
} catch (URISyntaxException e) {
throw new IOException(e);
代码示例来源:origin: org.apache.hadoop/hadoop-mapreduce-client-common
resourcePath = resource.getResource().toPath();
} catch (URISyntaxException e) {
throw new IOException(e);
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-common
final Path sCopy;
try {
sCopy = resource.getResource().toPath();
} catch (URISyntaxException e) {
throw new IOException("Invalid resource", e);
代码示例来源:origin: io.hops/hadoop-yarn-api
@Test
public void testConversion() throws Exception {
Configuration conf = new Configuration();
conf.set(YarnConfiguration.IPC_RECORD_FACTORY_CLASS,
RecordFactoryForTest.class.getName());
String[] pathStrs = new String[] {"/", ".", "foo/bar", "foo",
"/foo/bar/baz", "moo://bar/baz", "moo://bar:123/baz", "moo:///foo",
"moo://foo@bar:123/baz/foo", "moo://foo@bar/baz/foo", "moo://foo@bar",
"moo://foo:123"};
for (String s : pathStrs) {
Path path = new Path(s);
assertEquals(path, URL.fromPath(path, conf).toPath());
}
Path p = new Path("/foo/bar#baz");
assertEquals(p, URL.fromPath(p, conf).toPath());
}
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-api
@Test
public void testConversion() throws Exception {
Configuration conf = new Configuration();
conf.set(YarnConfiguration.IPC_RECORD_FACTORY_CLASS,
RecordFactoryForTest.class.getName());
String[] pathStrs = new String[] {"/", ".", "foo/bar", "foo",
"/foo/bar/baz", "moo://bar/baz", "moo://bar:123/baz", "moo:///foo",
"moo://foo@bar:123/baz/foo", "moo://foo@bar/baz/foo", "moo://foo@bar",
"moo://foo:123"};
for (String s : pathStrs) {
Path path = new Path(s);
assertEquals(path, URL.fromPath(path, conf).toPath());
}
Path p = new Path("/foo/bar#baz");
assertEquals(p, URL.fromPath(p, conf).toPath());
}
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-nodemanager
/**
* Wrap API resource to match against cache of localized resources.
* @param resource Resource requested by container
* @throws URISyntaxException If the path is malformed
*/
public LocalResourceRequest(LocalResource resource)
throws URISyntaxException {
this(resource.getResource().toPath(),
resource.getTimestamp(),
resource.getType(),
resource.getVisibility(),
resource.getPattern());
}
代码示例来源:origin: io.hops/hadoop-yarn-server-nodemanager
/**
* Wrap API resource to match against cache of localized resources.
* @param resource Resource requested by container
* @throws URISyntaxException If the path is malformed
*/
public LocalResourceRequest(LocalResource resource)
throws URISyntaxException {
this(resource.getResource().toPath(),
resource.getTimestamp(),
resource.getType(),
resource.getVisibility(),
resource.getPattern());
}
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-common
@Test
public void testConvertUrlWithNoPort() throws URISyntaxException {
Path expectedPath = new Path("hdfs://foo.com");
URL url = URL.fromPath(expectedPath);
Path actualPath = url.toPath();
assertEquals(expectedPath, actualPath);
}
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-common
@Test
public void testConvertUrlWithUserinfo() throws URISyntaxException {
Path expectedPath = new Path("foo://username:password@example.com:8042");
URL url = URL.fromPath(expectedPath);
Path actualPath = url.toPath();
assertEquals(expectedPath, actualPath);
}
代码示例来源:origin: io.hops/hadoop-yarn-common
@Test
public void testConvertUrlWithNoPort() throws URISyntaxException {
Path expectedPath = new Path("hdfs://foo.com");
URL url = URL.fromPath(expectedPath);
Path actualPath = url.toPath();
assertEquals(expectedPath, actualPath);
}
代码示例来源:origin: io.hops/hadoop-yarn-common
@Test
public void testConvertUrlWithUserinfo() throws URISyntaxException {
Path expectedPath = new Path("foo://username:password@example.com:8042");
URL url = URL.fromPath(expectedPath);
Path actualPath = url.toPath();
assertEquals(expectedPath, actualPath);
}
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-nodemanager
stat.getLocalPath().toPath(), stat.getLocalSize()));
} catch (URISyntaxException e) { }
代码示例来源:origin: io.hops/hadoop-yarn-server-nodemanager
stat.getLocalPath().toPath(), stat.getLocalSize()));
} catch (URISyntaxException e) { }
内容来源于网络,如有侵权,请联系作者删除!