YARN-9018. Add functionality to AuxiliaryLocalPathHandler to return all locations to read for a given path. Contributed by Kuhu Shukla (kshukla)
(cherry picked from commit 93233a7d6e
)
This commit is contained in:
parent
6304f94bc0
commit
3ba0fd1e50
|
@ -173,6 +173,14 @@ public class TestShuffleHandler {
|
|||
throws IOException {
|
||||
return new Path(ABS_LOG_DIR.getAbsolutePath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Path> getAllLocalPathsForRead(String path)
|
||||
throws IOException {
|
||||
ArrayList<Path> paths = new ArrayList<>();
|
||||
paths.add(new Path(ABS_LOG_DIR.getAbsolutePath()));
|
||||
return paths;
|
||||
}
|
||||
}
|
||||
|
||||
private static class MockShuffleHandler2 extends
|
||||
|
|
|
@ -55,4 +55,12 @@ public interface AuxiliaryLocalPathHandler {
|
|||
* @throws IOException if the path creations fails
|
||||
*/
|
||||
Path getLocalPathForWrite(String path, long size) throws IOException;
|
||||
|
||||
/**
|
||||
* Get all paths from the local FS for reading for a given Auxiliary Service.
|
||||
* @param path the requested path
|
||||
* @return the complete path list to the file on a local disk as an Iterable
|
||||
* @throws IOException if the file read encounters a problem
|
||||
*/
|
||||
Iterable<Path> getAllLocalPathsForRead(String path) throws IOException;
|
||||
}
|
||||
|
|
|
@ -624,6 +624,10 @@ public class LocalDirsHandlerService extends AbstractService {
|
|||
return getPathToRead(pathStr, getLocalDirsForRead());
|
||||
}
|
||||
|
||||
public Iterable<Path> getAllLocalPathsForRead(String pathStr) throws IOException {
|
||||
return localDirsAllocator.getAllLocalPathsToRead(pathStr, getConfig());
|
||||
}
|
||||
|
||||
public Path getLogPathForWrite(String pathStr, boolean checkWrite)
|
||||
throws IOException {
|
||||
return logDirsAllocator.getLocalPathForWrite(pathStr,
|
||||
|
|
|
@ -1644,6 +1644,11 @@ public class ContainerManagerImpl extends CompositeService implements
|
|||
throws IOException {
|
||||
return dirhandlerService.getLocalPathForWrite(path, size, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Path> getAllLocalPathsForRead(String path) throws IOException {
|
||||
return dirhandlerService.getAllLocalPathsForRead(path);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
Loading…
Reference in New Issue