YARN-7985. Removed duplicate service name validation in Yarn Service.

Contributed by Chandni Singh
This commit is contained in:
Eric Yang 2018-02-28 20:48:55 -05:00
parent 315f48e791
commit 17f387e3c2
2 changed files with 4 additions and 4 deletions

View File

@ -26,6 +26,7 @@
import org.apache.hadoop.yarn.service.api.records.Service; import org.apache.hadoop.yarn.service.api.records.Service;
import org.apache.hadoop.yarn.service.client.ServiceClient; import org.apache.hadoop.yarn.service.client.ServiceClient;
import org.apache.hadoop.yarn.service.utils.ServiceApiUtil; import org.apache.hadoop.yarn.service.utils.ServiceApiUtil;
import org.apache.hadoop.yarn.service.utils.SliderFileSystem;
/** /**
* A mock version of ServiceClient - This class is design * A mock version of ServiceClient - This class is design
@ -49,9 +50,9 @@ public Configuration getConfig() {
} }
@Override @Override
public ApplicationId actionCreate(Service service) { public ApplicationId actionCreate(Service service) throws IOException {
String serviceName = service.getName(); ServiceApiUtil.validateAndResolveService(service,
ServiceApiUtil.validateNameFormat(serviceName, getConfig()); new SliderFileSystem(conf), getConfig());
return ApplicationId.newInstance(System.currentTimeMillis(), 1); return ApplicationId.newInstance(System.currentTimeMillis(), 1);
} }

View File

@ -210,7 +210,6 @@ public int actionLaunch(String fileName, String serviceName, Long lifetime,
public ApplicationId actionCreate(Service service) public ApplicationId actionCreate(Service service)
throws IOException, YarnException { throws IOException, YarnException {
String serviceName = service.getName(); String serviceName = service.getName();
ServiceApiUtil.validateNameFormat(serviceName, getConfig());
ServiceApiUtil.validateAndResolveService(service, fs, getConfig()); ServiceApiUtil.validateAndResolveService(service, fs, getConfig());
verifyNoLiveAppInRM(serviceName, "create"); verifyNoLiveAppInRM(serviceName, "create");
Path appDir = checkAppNotExistOnHdfs(service); Path appDir = checkAppNotExistOnHdfs(service);