added generate comon url method
authorTony Mack <tmack@cs.princeton.edu>
Wed, 10 Jun 2009 02:35:51 +0000 (02:35 +0000)
committerTony Mack <tmack@cs.princeton.edu>
Wed, 10 Jun 2009 02:35:51 +0000 (02:35 +0000)
cmdline/getNodes.py

index be429f8..2675152 100644 (file)
@@ -17,9 +17,8 @@ def create_parser():
 (plain or rspec) that meet the specified crieteria. If no criteria is 
 specified, the default action is to return node comon considers 'alive' 
 (resptime > 0)"""
-    options = ['alive']
     cmp_options = ['rwfs', 'uptime', 'loads', 'meminfo', 'kernver', 'cpuspeed', 'txrate', 'rxrate', 'numslices', 'liveslices']
-     
+    option = ['numslices', 'liveslices', 'gbfree'] 
 
     parser = OptionParser(usage=usage,description=description)
     for opt in options:
@@ -36,6 +35,18 @@ def download_file(url, localFile):
     localFile.close()    
     
 
+def generate_comon_url(options):
+    url = "select = 'resptime > 0"
+    query_dict = {}
+    query_dict['numslices'] = 'numslices %s= %s'
+    query_dict['liveslices'] = 'liveslices %s= %s'
+    query_dict['gbfree'] = 'gbfree %s= %s'
+    
+    if options.numslices:
+        full_value = options.numslices
+         
+    url += "'"
+
 def get_comon_data():
     date = datetime.now()
     year = str(date.year)
@@ -56,6 +67,7 @@ def get_comon_data():
         
 def main():
     parser = create_parser()
+    (options, args) = parser.parse_args()
     comon_file = get_comon_data()