From 993a919021af9b912812d756ae74f2b18a9f7f6f Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Tue, 9 Jun 2009 13:58:39 +0000 Subject: [PATCH] initial checkin of getNodes script --- cmdline/getNodes.py | 52 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 cmdline/getNodes.py diff --git a/cmdline/getNodes.py b/cmdline/getNodes.py new file mode 100644 index 00000000..8367978c --- /dev/null +++ b/cmdline/getNodes.py @@ -0,0 +1,52 @@ +#!/usr/bin/python +import sys +import os +import traceback +from datetime import datetime +from optparse import OptionParser +from geni.util.rspec import Rspec + +sfi_dir = os.path.expanduser("~/.sfi/") + +def create_parser(): + command = sys.argv[0] + argv = sys.argv[1:] + usage = "%(command)s [options]" % locals() + description = """getNodes will query comon and generate a list of nodes +(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'] + + + parser = OptionParser(usage=usage,description=description) + for opt in options: + parser.add_option("--%s" % opt, dest="%s" % opt, action="store_true", + help = "available options [%s]" % ",".join(cmp_options)) + return parser + +def get_comon_data() + date = datetime.now() + year = str(date.year) + month = str(date.month) + day = str(date.day) + for num in [year, month, day]: + if len(num) == 1: + num = "0" + num + + comon_data_file = sfi_dir + os.sep + "comon_data.dat" + comon_url = "http://comon.cs.princeton.edu/status/dump_comon_%s%s%s" % (year, month, day) + + # wget comon data and save it + # wget(comon_url) + # + +def main(): + parser = create_parser() + + get_comon_data() + + +if __name__ == '__main__': + main() -- 2.47.0