ClusterAccessor clusterAccessor = _connection.createClusterAccessor(ClusterId.from(appName));
Resource resource = clusterAccessor.readResource(resourceId);
LOG.info("Current provisioner config:" + resource.getProvisionerConfig());
ResourceConfig.Delta delta = new ResourceConfig.Delta(resourceId);
YarnProvisionerConfig config = new YarnProvisionerConfig(resourceId);
config.setNumContainers(numContainers);
delta.setProvisionerConfig(config);
delta.setIdealState(resource.getIdealState());
ResourceConfig updatedResourceConfig = clusterAccessor.updateResource(resourceId, delta);
LOG.info("Update provisioner config:" + updatedResourceConfig.getProvisionerConfig());