YARN-9557. Application fails in diskchecker when ReadWriteDiskValidator is configured. Contributed by Bilwa S T.
This commit is contained in:
parent
60c95e9b6a
commit
2263ead365
@ -133,7 +133,7 @@ public ContainerLocalizer(FileContext lfs, String user, String appId,
|
|||||||
this.localDirs = localDirs;
|
this.localDirs = localDirs;
|
||||||
this.localizerId = localizerId;
|
this.localizerId = localizerId;
|
||||||
this.recordFactory = recordFactory;
|
this.recordFactory = recordFactory;
|
||||||
this.conf = new YarnConfiguration();
|
this.conf = initConfiguration();
|
||||||
this.diskValidator = DiskValidatorFactory.getInstance(
|
this.diskValidator = DiskValidatorFactory.getInstance(
|
||||||
YarnConfiguration.DEFAULT_DISK_VALIDATOR);
|
YarnConfiguration.DEFAULT_DISK_VALIDATOR);
|
||||||
this.appCacheDirContextName = String.format(APPCACHE_CTXT_FMT, appId);
|
this.appCacheDirContextName = String.format(APPCACHE_CTXT_FMT, appId);
|
||||||
@ -142,6 +142,12 @@ public ContainerLocalizer(FileContext lfs, String user, String appId,
|
|||||||
"token file name cannot be null");
|
"token file name cannot be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
@Private
|
||||||
|
Configuration initConfiguration() {
|
||||||
|
return new YarnConfiguration();
|
||||||
|
}
|
||||||
|
|
||||||
@Private
|
@Private
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public LocalizationProtocol getProxy(final InetSocketAddress nmAddr) {
|
public LocalizationProtocol getProxy(final InetSocketAddress nmAddr) {
|
||||||
@ -250,7 +256,8 @@ Callable<Path> download(Path destDirPath, LocalResource rsrc,
|
|||||||
if (rsrc.getVisibility() == LocalResourceVisibility.PRIVATE) {
|
if (rsrc.getVisibility() == LocalResourceVisibility.PRIVATE) {
|
||||||
createParentDirs(destDirPath);
|
createParentDirs(destDirPath);
|
||||||
}
|
}
|
||||||
diskValidator.checkStatus(new File(destDirPath.toUri().getRawPath()));
|
diskValidator
|
||||||
|
.checkStatus(new File(destDirPath.getParent().toUri().getRawPath()));
|
||||||
return new FSDownloadWrapper(lfs, ugi, conf, destDirPath, rsrc);
|
return new FSDownloadWrapper(lfs, ugi, conf, destDirPath, rsrc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,12 +70,14 @@
|
|||||||
import org.apache.hadoop.security.UserGroupInformation;
|
import org.apache.hadoop.security.UserGroupInformation;
|
||||||
import org.apache.hadoop.security.token.Token;
|
import org.apache.hadoop.security.token.Token;
|
||||||
import org.apache.hadoop.test.GenericTestUtils;
|
import org.apache.hadoop.test.GenericTestUtils;
|
||||||
|
import org.apache.hadoop.util.DiskChecker.DiskErrorException;
|
||||||
import org.apache.hadoop.util.Shell;
|
import org.apache.hadoop.util.Shell;
|
||||||
import org.apache.hadoop.util.Shell.ShellCommandExecutor;
|
import org.apache.hadoop.util.Shell.ShellCommandExecutor;
|
||||||
import org.apache.hadoop.yarn.api.records.LocalResource;
|
import org.apache.hadoop.yarn.api.records.LocalResource;
|
||||||
import org.apache.hadoop.yarn.api.records.LocalResourceType;
|
import org.apache.hadoop.yarn.api.records.LocalResourceType;
|
||||||
import org.apache.hadoop.yarn.api.records.LocalResourceVisibility;
|
import org.apache.hadoop.yarn.api.records.LocalResourceVisibility;
|
||||||
import org.apache.hadoop.yarn.api.records.URL;
|
import org.apache.hadoop.yarn.api.records.URL;
|
||||||
|
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
||||||
import org.apache.hadoop.yarn.exceptions.YarnException;
|
import org.apache.hadoop.yarn.exceptions.YarnException;
|
||||||
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
|
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
|
||||||
import org.apache.hadoop.yarn.factories.RecordFactory;
|
import org.apache.hadoop.yarn.factories.RecordFactory;
|
||||||
@ -235,6 +237,33 @@ public void testMainFailure() throws Exception {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDiskCheckFailure() throws Exception {
|
||||||
|
Configuration conf = new Configuration();
|
||||||
|
conf.set(YarnConfiguration.DISK_VALIDATOR, "read-write");
|
||||||
|
FileContext lfs = FileContext.getLocalFSFileContext(conf);
|
||||||
|
Path fileCacheDir = lfs.makeQualified(new Path(basedir, "filecache"));
|
||||||
|
lfs.mkdir(fileCacheDir, FsPermission.getDefault(), true);
|
||||||
|
RecordFactory recordFactory = mock(RecordFactory.class);
|
||||||
|
ContainerLocalizer localizer = new ContainerLocalizer(lfs,
|
||||||
|
UserGroupInformation.getCurrentUser().getUserName(), "application_01",
|
||||||
|
"container_01", String.format(ContainerExecutor.TOKEN_FILE_NAME_FMT,
|
||||||
|
"container_01"), new ArrayList<>(), recordFactory){
|
||||||
|
@Override
|
||||||
|
Configuration initConfiguration() {
|
||||||
|
return conf;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
LocalResource rsrc = mock(LocalResource.class);
|
||||||
|
Path destDirPath = new Path(fileCacheDir, "11");
|
||||||
|
try {
|
||||||
|
localizer.download(destDirPath, rsrc,
|
||||||
|
UserGroupInformation.getCurrentUser());
|
||||||
|
} catch (DiskErrorException ex) {
|
||||||
|
fail(ex.getCause().toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void testLocalizerTokenIsGettingRemoved() throws Exception {
|
public void testLocalizerTokenIsGettingRemoved() throws Exception {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user