Class ServiceApiUtil
java.lang.Object
org.apache.hadoop.yarn.service.utils.ServiceApiUtil
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final JsonSerDeser<ComponentContainers[]>static final JsonSerDeser<Component[]>static final JsonSerDeser<Container[]>static JsonSerDeser<Service> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringstatic voidcheckServiceDependencySatisified(Service service) static voidcreateDirAndPersistApp(SliderFileSystem fs, org.apache.hadoop.fs.Path appDir, Service service) getComponents(SliderFileSystem fs, String serviceName) static StringgetHostnameSuffix(String serviceName, org.apache.hadoop.conf.Configuration conf) getLiveContainers(Service service, List<String> componentInstances) static org.apache.hadoop.fs.PathgetServiceJsonPath(SliderFileSystem fs, String serviceName) static booleanisUpgradable(Container container) Returns whether the container can be upgraded in the current state.static ServiceloadService(SliderFileSystem fs, String serviceName) static ServiceloadServiceFrom(SliderFileSystem fs, org.apache.hadoop.fs.Path appDefPath) static ServiceloadServiceUpgrade(SliderFileSystem fs, String serviceName, String version) static StringparseAndValidateComponentInstanceName(String instanceOrHostname, String serviceName, org.apache.hadoop.conf.Configuration conf) static StringparseComponentName(String componentInstanceName) resolveCompsDependency(Service service) static voidstatic Collection<Component>sortByDependencies(List<Component> components) validateAndResolveCompsStable(Service liveService, Collection<String> compNames) Validates the components that are requested are stable for upgrade.validateAndResolveCompsUpgrade(Service liveService, Collection<String> compNames) Validates the components that are requested to upgrade require an upgrade.static voidvalidateAndResolveService(Service service, SliderFileSystem fs, org.apache.hadoop.conf.Configuration conf) static voidvalidateCompResourceSize(org.apache.hadoop.yarn.api.records.Resource maxResource, Service service) static voidvalidateInstancesUpgrade(List<Container> liveContainers) Validates that the component instances that are requested to upgrade require an upgrade.static voidvalidateJvmOpts(String jvmOpts) static voidvalidateKerberosPrincipal(KerberosPrincipal kerberosPrincipal) static voidvalidateNameFormat(String name, org.apache.hadoop.conf.Configuration conf) static org.apache.hadoop.fs.PathwriteAppDefinition(SliderFileSystem fs, org.apache.hadoop.fs.Path appDir, Service service) static org.apache.hadoop.fs.PathwriteAppDefinition(SliderFileSystem fs, Service service)
-
Field Details
-
jsonSerDeser
-
CONTAINER_JSON_SERDE
-
COMP_CONTAINERS_JSON_SERDE
-
COMP_JSON_SERDE
-
-
Constructor Details
-
ServiceApiUtil
public ServiceApiUtil()
-
-
Method Details
-
setJsonSerDeser
-
validateAndResolveService
@VisibleForTesting public static void validateAndResolveService(Service service, SliderFileSystem fs, org.apache.hadoop.conf.Configuration conf) throws IOException - Throws:
IOException
-
validateJvmOpts
- Throws:
IllegalArgumentException
-
validateKerberosPrincipal
public static void validateKerberosPrincipal(KerberosPrincipal kerberosPrincipal) throws IOException - Throws:
IOException
-
validateNameFormat
-
getComponents
@VisibleForTesting public static List<Component> getComponents(SliderFileSystem fs, String serviceName) throws IOException - Throws:
IOException
-
loadService
- Throws:
IOException
-
loadServiceUpgrade
public static Service loadServiceUpgrade(SliderFileSystem fs, String serviceName, String version) throws IOException - Throws:
IOException
-
loadServiceFrom
public static Service loadServiceFrom(SliderFileSystem fs, org.apache.hadoop.fs.Path appDefPath) throws IOException - Throws:
IOException
-
getServiceJsonPath
-
validateCompResourceSize
public static void validateCompResourceSize(org.apache.hadoop.yarn.api.records.Resource maxResource, Service service) throws org.apache.hadoop.yarn.exceptions.YarnException - Throws:
org.apache.hadoop.yarn.exceptions.YarnException
-
sortByDependencies
-
createDirAndPersistApp
public static void createDirAndPersistApp(SliderFileSystem fs, org.apache.hadoop.fs.Path appDir, Service service) throws IOException, SliderException - Throws:
IOExceptionSliderException
-
writeAppDefinition
public static org.apache.hadoop.fs.Path writeAppDefinition(SliderFileSystem fs, org.apache.hadoop.fs.Path appDir, Service service) throws IOException - Throws:
IOException
-
writeAppDefinition
public static org.apache.hadoop.fs.Path writeAppDefinition(SliderFileSystem fs, Service service) throws IOException - Throws:
IOException
-
getLiveContainers
public static List<Container> getLiveContainers(Service service, List<String> componentInstances) throws org.apache.hadoop.yarn.exceptions.YarnException - Throws:
org.apache.hadoop.yarn.exceptions.YarnException
-
validateInstancesUpgrade
public static void validateInstancesUpgrade(List<Container> liveContainers) throws org.apache.hadoop.yarn.exceptions.YarnException Validates that the component instances that are requested to upgrade require an upgrade.- Throws:
org.apache.hadoop.yarn.exceptions.YarnException
-
isUpgradable
Returns whether the container can be upgraded in the current state. -
validateAndResolveCompsUpgrade
public static List<Container> validateAndResolveCompsUpgrade(Service liveService, Collection<String> compNames) throws org.apache.hadoop.yarn.exceptions.YarnException Validates the components that are requested to upgrade require an upgrade. It returns the instances of the components which need upgrade.- Throws:
org.apache.hadoop.yarn.exceptions.YarnException
-
validateAndResolveCompsStable
public static List<Container> validateAndResolveCompsStable(Service liveService, Collection<String> compNames) throws org.apache.hadoop.yarn.exceptions.YarnException Validates the components that are requested are stable for upgrade. It returns the instances of the components which are in ready state.- Throws:
org.apache.hadoop.yarn.exceptions.YarnException
-
getHostnameSuffix
-
parseAndValidateComponentInstanceName
public static String parseAndValidateComponentInstanceName(String instanceOrHostname, String serviceName, org.apache.hadoop.conf.Configuration conf) throws IllegalArgumentException - Throws:
IllegalArgumentException
-
parseComponentName
public static String parseComponentName(String componentInstanceName) throws org.apache.hadoop.yarn.exceptions.YarnException - Throws:
org.apache.hadoop.yarn.exceptions.YarnException
-
$
-
resolveCompsDependency
-
checkServiceDependencySatisified
-