incubator-ambari-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mahadev konar (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (AMBARI-1769) Python REST client to invoke REST calls
Date Mon, 08 Apr 2013 04:07:16 GMT

    [ https://issues.apache.org/jira/browse/AMBARI-1769?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13625114#comment-13625114
] 

Mahadev konar edited comment on AMBARI-1769 at 4/8/13 4:05 AM:
---------------------------------------------------------------

Subin,
 Just got the time to take a look at your patch. Nice work (specifically on the py docs)!
The patch looks good. Some minor nits:

- as metioned earlier the @ author tags and the created tags should be removed
- http_utils.py has ^M characters in the file, not sure why (might want to do dos2unix on
the files you have)
- http_utils does not have an apache header and also says method copied from Django. If you
copied the method, do you know what license/copyright it is? 
- main.py has ^M characters as well, same with init.py, cluster.py, paths.py, utils.py
- the main.py does     ganglia.stop() - i think that might be an oversight on having that
in the main.py. Also why do we need a main.py? 
- the most important one is that to make it part of the main codebase (am sure lot of people
will want to use this), we really need to make sure its maintained, which means unit tests
(atleast testing main features of the client library). Can you please add some? You can also
use the mock libary in ambari-common for python. 
- Also what about adding some help/examples into the codebase as well which will help folks
who want to use the library?



                
      was (Author: mahadev):
    Subin,
 Just got the time to take a look at your patch. Nice work (specifically on the py docs)!
The patch looks good. Some minor nits:

- as metioned earlier the @ author tags and the created tags should be removed
- http_utils.py has ^M characters in the file, not sure why (might want to do dos2unix on
the files you have)
- http_utils does not have an apache header and also says method copied from Django. If you
copied the method, do you know what license/copyright it is? 
- main.py has ^M characters as well, same with init.py, cluster.py, paths.py, utils.py
- the main.py does     ganglia.stop() - i think that might be an oversight on having that
in the main.py 
- the most important one is that to make it part of the main codebase (am sure lot of people
will want to use this), we really need to make sure its maintained, which means unit tests
(atleast testing main features of the client library). Can you please add some? You can also
use the mock libary in ambari-common for python. 
- Also what about adding some help/examples into the codebase as well which will help folks
who want to use the library?



                  
> Python REST client to invoke REST calls
> ---------------------------------------
>
>                 Key: AMBARI-1769
>                 URL: https://issues.apache.org/jira/browse/AMBARI-1769
>             Project: Ambari
>          Issue Type: New Feature
>          Components: controller
>    Affects Versions: 1.3.0
>         Environment: RHEL
>            Reporter: subin m
>              Labels: REST
>             Fix For: 1.3.1
>
>         Attachments: patch.txt
>
>   Original Estimate: 504h
>  Remaining Estimate: 504h
>
> Ambari doesnt have a python REST client to invoke REST calls .Currently users have to
depend upon curl command.
> I have created the Ambari python client and attached as a zip.Please review and give
your feedbacks
> The zip contains a skeleton code with few of the resources supported.The features are
:
> Supported feature
> ===================
> 1)get_all_clusters
> 2)get cluster by name
> 3)get service by nmae
> 4)start/stop service
> Once this skeleton code is reviewed i will checkin the rest of the resources/features
> I currently support creation of cluster via this python client.
> install python client on linux box
> =============================='
> 1)unzip the attachment
> 2)execute 'python setup.py install  --record installation.txt'
> example:
> ==========
> from ambari_client.ambari_api import  AmbariClient 
> client = AmbariClient("localhost", 8080, "admin","admin",version=1)
> all_clusters = client.get_all_clusters()
>    
> cluster = client.get_cluster('test1')
>    
> serviceList = cluster.get_all_services()
>   
>     
> for service in serviceList:
>     print str(service.service_name)+" = "+str(service.state)
>   
> to start/stop service
> -----------------------
> ganglia = cluster.get_service("GANGLIA")       
> ganglia.stop()
> ganglia.start()
>     

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message