Thanks Kanak. This can serve as one of the data points while we work on improving the apis.
On Mon, Feb 24, 2014 at 10:13 AM, Kanak Biscuitwala <[email protected]>wrote: > > The current method of updating a resource is incredibly error-prone from > an implementation standpoint. It requires changes in 3-4 places just to > support updating a new field. I was just thinking about how to simplify > this last night, and I really want to fix this as part of the API > improvements. > > For the time being, I have fixed the issue in the helix-provisioning > branch. It required a change to ResourceAccessor#setResource. > > ---------------------------------------- > > Date: Mon, 24 Feb 2014 09:07:18 -0800 > > Subject: Updating config in 0.7.0 > > From: [email protected] > > To: [email protected] > > > > Hi, > > > > I am trying to update the provisioner configuration. > > > > public void setNumContainers(String appName, String serviceName, int > > numContainers) { > > ResourceId resourceId = ResourceId.from(serviceName); > > > > ResourceAccessor resourceAccessor = > > _connection.createResourceAccessor(ClusterId.from(appName)); > > Resource resource = resourceAccessor.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); > > ResourceConfig updatedResourceConfig = > > resourceAccessor.updateResource(resourceId, delta); > > LOG.info("Update provisioner config:"+ > > updatedResourceConfig.getProvisionerConfig()); > > > > } > > > > Am i doing something wrong. This code is in helix-provisioning branch. > > > > thanks, > > Kishore G > >
