You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@helix.apache.org by kishore g <g....@gmail.com> on 2014/02/24 18:07:18 UTC
Updating config in 0.7.0
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
Re: Updating config in 0.7.0
Posted by kishore g <g....@gmail.com>.
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 <ka...@hotmail.com>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: g.kishore@gmail.com
> > To: dev@helix.apache.org
> >
> > 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
>
>
RE: Updating config in 0.7.0
Posted by Kanak Biscuitwala <ka...@hotmail.com>.
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: g.kishore@gmail.com
> To: dev@helix.apache.org
>
> 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