X-Git-Url: http://git.onelab.eu/?p=sface.git;a=blobdiff_plain;f=sface%2Fsfiprocess.py;h=cfa11093f6fb2929bfae463bd12df5f57a1a43fc;hp=108530cca8e10855881b3e9fb27c16c6a9687185;hb=7bc9576fe11f712b7ff8b5565bf5ad8d59ff06ab;hpb=312ec1d8972acfdd51b2bc6c26ba7f89b6096303 diff --git a/sface/sfiprocess.py b/sface/sfiprocess.py index 108530c..cfa1109 100644 --- a/sface/sfiprocess.py +++ b/sface/sfiprocess.py @@ -5,7 +5,7 @@ import time from PyQt4.QtCore import * from sface.config import config -from sface.xmlrpcwindow import XmlrpcTracker, XmlrpcReader +from sface.xmlrpcwindow import get_tracker, XmlrpcReader def find_executable(exec_name): """find the given executable in $PATH""" @@ -29,7 +29,6 @@ class SfiProcess(QObject): self.processFinished) self.xmlrpcreader = XmlrpcReader() # this one is for parsing XMLRPC responses - self.xmlrpctracker = XmlrpcTracker() # this one is for the debug window # holds aggregate output from processStandardOutput(); used by xmlrpc # tracker. @@ -120,20 +119,38 @@ class SfiProcess(QObject): self.start() return filename + def retrieveResources(self): + mgr = config.getSlicemgr() + # Write RSpec to file + filename = config.getResourcesRSpecFile() + try: + os.remove(filename) + except: + pass + args = ["-u", config.getUser(), "-a", config.getAuthority(), + "-r", config.getRegistry(), "-s", mgr, "resources", + "-o", filename] + + self.__init_command(args) + self.start() + return filename + def listRecords(self, hrn, rectype=None, filename=None): args = ["-u", config.getUser(), "-a", config.getAuthority(), - "-r", config.getRegistry(), "-s", config.getSlicemgr(), "list", hrn] + "-r", config.getRegistry(), "-s", config.getSlicemgr(), "list", "-F", "xmllist", hrn] - if filename: - # we can't tell whether SFI will create one file or many, so delete - # leftovers from last time, then we'll know what we got, after we get it. - if os.path.exists(filename): - os.remove(filename) - if os.path.exists(filename + ".1"): - os.remove(filename + ".1") - args.append("-o") - args.append(filename) + if not filename: + filename = config.getAuthorityListFile() + + # we can't tell whether SFI will create one file or many, so delete + # leftovers from last time, then we'll know what we got, after we get it. + if os.path.exists(filename): + os.remove(filename) + if os.path.exists(filename + ".1"): + os.remove(filename + ".1") + args.append("-o") + args.append(filename) if rectype: args.append("-t") @@ -183,10 +200,13 @@ class SfiProcess(QObject): self.__init_command(args) self.start() - def renewSlivers(self, expiration): + def renewSlivers(self, expiration, slice=None): + if not slice: + slice = config.getSlice() + args = ["-u", config.getUser(), "-a", config.getAuthority(), "-r", config.getRegistry(), "-s", config.getSlicemgr(), "renew", - config.getSlice(), expiration] + slice, expiration] self.__init_command(args) self.start() @@ -212,5 +232,5 @@ class SfiProcess(QObject): # command = "%s %s" % (self.exe, self.args.join(" ")) print time.strftime('%H:%M:%S'),"Done [%.3f s]"%(time.time()-self._trace) if config.debug: - self.xmlrpctracker.getAndPrint(self.output) + get_tracker().getAndPrint(self.output)