<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question how to findout which api call to use for updating a specific configuration setting (swagger api v32) in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/how-to-findout-which-api-call-to-use-for-updating-a-specific/m-p/92897#M33745</link>
    <description>&lt;P&gt;I just started using cm_client python for swagger v32. I wonder if I missed something because I found some simple task seemed quite hard to accomplish as a new API user.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, I am trying to use the API to set a Yarn configuration mapreduce.job.split.metainfo.maxsize. In CM GUI I can go to YARN -&amp;nbsp;&amp;nbsp; Configuration - search for such a setting and then update it, quite simple. However, in order to do it in API, I was not sure which "update_config" I should use because there are many of them. I tried "serviceResourceAPi.update_service_config( )" for yarn service but the specific setting was not there. then I thought I should try update_role_config or update_role_config_group. Then I realized I had to inpect the many "read_config" output manually to find out which API may be relavent to the parameter. I could not do it programly because I was not sure&amp;nbsp; how the&amp;nbsp; setting/parameter would be&amp;nbsp; called in API - maybe&amp;nbsp; mapreduce.job.split.metainfo.maxsize would be called mapreduce_job_split_metainfo_max_size or something else.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Am I on a wrong path? how does savy developers find out which API to use to update each specific parameters?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Fri, 16 Sep 2022 14:31:14 GMT</pubDate>
    <dc:creator>Kevin_Z</dc:creator>
    <dc:date>2022-09-16T14:31:14Z</dc:date>
    <item>
      <title>how to findout which api call to use for updating a specific configuration setting (swagger api v32)</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-findout-which-api-call-to-use-for-updating-a-specific/m-p/92897#M33745</link>
      <description>&lt;P&gt;I just started using cm_client python for swagger v32. I wonder if I missed something because I found some simple task seemed quite hard to accomplish as a new API user.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, I am trying to use the API to set a Yarn configuration mapreduce.job.split.metainfo.maxsize. In CM GUI I can go to YARN -&amp;nbsp;&amp;nbsp; Configuration - search for such a setting and then update it, quite simple. However, in order to do it in API, I was not sure which "update_config" I should use because there are many of them. I tried "serviceResourceAPi.update_service_config( )" for yarn service but the specific setting was not there. then I thought I should try update_role_config or update_role_config_group. Then I realized I had to inpect the many "read_config" output manually to find out which API may be relavent to the parameter. I could not do it programly because I was not sure&amp;nbsp; how the&amp;nbsp; setting/parameter would be&amp;nbsp; called in API - maybe&amp;nbsp; mapreduce.job.split.metainfo.maxsize would be called mapreduce_job_split_metainfo_max_size or something else.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Am I on a wrong path? how does savy developers find out which API to use to update each specific parameters?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 14:31:14 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-findout-which-api-call-to-use-for-updating-a-specific/m-p/92897#M33745</guid>
      <dc:creator>Kevin_Z</dc:creator>
      <dc:date>2022-09-16T14:31:14Z</dc:date>
    </item>
    <item>
      <title>Re: how to findout which api call to use for updating a specific configuration setting (swagger api</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-findout-which-api-call-to-use-for-updating-a-specific/m-p/92973#M33746</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/34572"&gt;@Kevin_Z&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The trick is knowing which structure stores the values.&amp;nbsp; In the case of &lt;STRONG&gt;mapreduce.job.split.metainfo.maxsize&lt;/STRONG&gt; you can find it via the REST api like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(assuming your cluster was named &lt;STRONG&gt;cluster&lt;/STRONG&gt; and your YARN service wasnamed &lt;STRONG&gt;yarn&lt;/STRONG&gt;)&lt;BR /&gt;http://cm_host:7180/api/v32/clusters/cluster/services/yarn/roleConfigGroups/yarn-GATEWAY-BASE/config?view=full&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can see the configuration:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;{&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;"name" : "mapreduce_jobtracker_split_metainfo_maxsize",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;"required" : false,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;"default" : "10000000",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;"displayName" : "JobTracker MetaInfo Maxsize",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;"description" : "The maximum permissible size of the split metainfo file. The JobTracker won't attempt to read split metainfo files bigger than the configured value. No limits if set to -1.",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;"relatedName" : "mapreduce.job.split.metainfo.maxsize",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;"sensitive" : false,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;"validationState" : "OK"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;},&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See the comparable command for the REST call above:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://archive.cloudera.com/cm6/6.2.0/generic/jar/cm_api/swagger-html-sdk-docs/python/docs/RoleConfigGroupsResourceApi.html#read_config" target="_blank"&gt;https://archive.cloudera.com/cm6/6.2.0/generic/jar/cm_api/swagger-html-sdk-docs/python/docs/RoleConfigGroupsResourceApi.html#read_config&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cloudera Manager the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Service Configuration (configuration items apply to every role for that service)&lt;/LI&gt;&lt;LI&gt;Role Configuration Groups (Each role will use a role configuration group which defines configuration for all roles belonging to that role config group&lt;/LI&gt;&lt;LI&gt;Overrides (A configuration value can be set for a specific role (overriding other configurations)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the case of "mapreduce.job.split.metainfo.maxsize" it is defined in the default Role Configuration Group for the YARN Gateway Role type.&amp;nbsp; The default value is: 10000000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Via Python, I used the following to ad a "value" that was not None:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;#!/usr/bin/env python

import cm_client
from cm_client.rest import ApiException
from pprint import pprint

# Configure HTTP basic authorization: basic
cm_client.configuration.username = 'admin'
cm_client.configuration.password = 'lizard'
cm_client.configuration.verify_ssl = True
# Path of truststore file in PEM
cm_client.configuration.ssl_ca_cert = '/opt/cloudera/security/cacerts/ClouderaSEC_combined.pem'

# Create an instance of the API class
api_host = 'https://host-10-17-100-224.coe.cloudera.com'
port = '7183'
api_version = 'v30'
# Construct base URL for API
# http://cmhost:7180/api/v30
api_url = api_host + ':' + port + '/api/' + api_version
api_client = cm_client.ApiClient(api_url)
cluster_api_instance = cm_client.ClustersResourceApi(api_client)

# This lists all clusters, so if you have more than one, set "cluster_name" to it.  Otherwise, last one wins
api_response = cluster_api_instance.read_clusters(view='SUMMARY')
for cluster in api_response.items:
    cluster_name = cluster.name

# Get a list of all services and set myserive if the service type is "YARN"
services_api_instance = cm_client.ServicesResourceApi(api_client)
services = services_api_instance.read_services(cluster.name, view='FULL')
for service in services.items:
    if service.type == 'YARN':
        myservice = service

# Get a list of roles and get the GATEWAY type
roles_api_instance = cm_client.RolesResourceApi(api_client)
roles = roles_api_instance.read_roles(cluster_name, myservice.name)
for role in roles.items:
    if role.type == 'GATEWAY':
        myrole = role
# default is summary... this is only relevant if printing out information since full shows all values
# regardless if they have a non-default value or not
view = 'full'

# Uses RoleConfigGroupsResourceApi to retrieve all YARN role config groups
# Sets yarnGatewayBase to be the name of the role config group we want to update
rcg_api_instance = cm_client.RoleConfigGroupsResourceApi(api_client)
rcg_api_response = rcg_api_instance.read_role_config_groups(cluster_name, myservice.name)
pprint(rcg_api_response)
for cfg in rcg_api_response.items:
  if cfg.name == "yarn-GATEWAY-BASE":
       yarnGatewayBase = cfg.name

# read the config and iterate over each config till we find the one we want
# print out the config before update
yarn_gateway_base = rcg_api_instance.read_config(cluster_name, yarnGatewayBase, myservice.name, view=view)
for config in yarn_gateway_base.items:
    if config.related_name == 'mapreduce.job.split.metainfo.maxsize':
       print "mapreduce.job.split.metainfo.maxsize before update:\n===================\n"
       pprint(config)
       print "mapreduce.job.split.metainfo.maxsize after update:\n====================\n"
       config_to_update = config.name

# Set message and new config values where "value" is what we want the new value to be
# use update_config() to update the value
message = 'testing update of mapreduce.job.split.metainfo.maxsize' # str | Optional message describing the changes. (optional)
new_config = cm_client.ApiConfig(name=config_to_update, value="20000000")
new_config_list = cm_client.ApiConfigList([new_config])
try:
    # Updates the config for the given role config group.
    res  = rcg_api_instance.update_config(cluster_name, yarnGatewayBase, myservice.name, message=message, body=new_config_list)
    pprint(res)
except ApiException as e:
    print("Exception when calling RoleConfigGroupsResourceApi-&amp;gt;update_config: %s\n" % e)&lt;/PRE&gt;&lt;P&gt;If you have questions about anything, let us know.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2019 23:23:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-findout-which-api-call-to-use-for-updating-a-specific/m-p/92973#M33746</guid>
      <dc:creator>bgooley</dc:creator>
      <dc:date>2019-07-19T23:23:40Z</dc:date>
    </item>
    <item>
      <title>Re: how to findout which api call to use for updating a specific configuration setting (swagger api</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-findout-which-api-call-to-use-for-updating-a-specific/m-p/92977#M33747</link>
      <description>&lt;P&gt;Thank you &lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/4054"&gt;@bgooley&lt;/a&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 20 Jul 2019 00:09:32 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-findout-which-api-call-to-use-for-updating-a-specific/m-p/92977#M33747</guid>
      <dc:creator>Kevin_Z</dc:creator>
      <dc:date>2019-07-20T00:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: how to findout which api call to use for updating a specific configuration setting (swagger api</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-findout-which-api-call-to-use-for-updating-a-specific/m-p/277698#M207643</link>
      <description>&lt;P&gt;Okaee.. but what is the trick, as far as i see - it's just a dumb way of finding manually which structure stores what config. Not handy for automating. Is there any api which can tell which config belongs to which structure ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2019 16:29:17 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-findout-which-api-call-to-use-for-updating-a-specific/m-p/277698#M207643</guid>
      <dc:creator>visd</dc:creator>
      <dc:date>2019-09-18T16:29:17Z</dc:date>
    </item>
  </channel>
</rss>

