def __init__(self, url): """Class constructor""" JobPluginInterface.__init__(self, name=self._name, schemas=self._schemas) self.bookkeeper = BookKeeper(self)
def __init__(self, url): '''Class constructor''' JobPluginInterface.__init__(self, name=self._name, schemas=self._schemas) self.bookkeeper = BookKeeper(self)
class SGEJobAndSDPlugin(JobPluginInterface, SDPluginInterface): """Implements a job plugin that can submit jobs to remote SGE cluster via SSH """ ## Define adaptor name. Convention is: ## saga.plugin.<package>.<name> _name = "saga.plugin.job.sgessh" ## Define supported url schemas ## _schemas = ["sge+ssh", "sge"] ## Define apis supported by this adaptor ## Exceptions = ["saga.job", "saga.sd"] ###################################################################### ## def __init__(self, url): """Class constructor""" JobPluginInterface.__init__(self, name=self._name, schemas=self._schemas) self.bookkeeper = BookKeeper(self) ###################################################################### ## @classmethod def sanity_check(self): """Implements interface from _PluginBase""" pass ###################################################################### ## def register_service_object(self, service_obj): """Implements interface from _JobPluginBase""" sge_obj = SGEService(self, service_obj) self.bookkeeper.add_service_object(service_obj, sge_obj) self.log_info("Registered new service object %s" % (repr(service_obj))) ###################################################################### ## def unregister_service_object(self, service_obj): """Implements interface from _JobPluginBase""" self.bookkeeper.remove_service_object(service_obj) self.log_info("Unegistered service object %s" % (repr(service_obj))) ###################################################################### ## def register_discoverer_object(self, discoverer_obj): """Implements interface from SDPluginInterface""" sge_obj = SGEService(self, discoverer_obj) self.bookkeeper.add_service_object(discoverer_obj, sge_obj) self.log_info("Registered new discoverer object %s" % (repr(discoverer_obj))) ###################################################################### ## def unregister_discoverer_object(self, discoverer_obj): """Implements interface from SDPluginInterface""" pass ###################################################################### ## def discoverer_list_services(self, discoverer_obj, service_filter, data_filter): """Implements interface from SDPluginInterface""" try: sge = self.bookkeeper.get_sgewrapper_for_service(discoverer_obj) service_info = sge.get_service_info() # triggers ssh connection attempt desc = bliss.saga.sd.ServiceDescription() desc._ServiceDescription__init_from_discoverer(discoverer_obj) ## set values desc._url = discoverer_obj._url desc._type = "org.ogf.saga.service.job" desc._name = "SGE Job Scheduler" # desc._implementor = # desc._site = # desc._uid = return [desc] except Exception, ex: self.log_error_and_raise( bliss.saga.Error.NoSuccess, "Couldn't retreive service list because: %s " % (str(ex)) )
class SGEJobPlugin(JobPluginInterface, SDPluginInterface): '''Implements a job plugin that can submit jobs to remote SGE cluster via SSH ''' ## Define adaptor name. Convention is: ## saga.plugin.<package>.<name> _name = 'saga.plugin.job.sgessh' ## Define supported url schemas ## _schemas = ['sge+ssh', 'sge+gsissh', 'sge'] ## Define apis supported by this adaptor ## _apis = ['saga.job', 'saga.sd'] ###################################################################### ## def __init__(self, url): '''Class constructor''' JobPluginInterface.__init__(self, name=self._name, schemas=self._schemas) self.bookkeeper = BookKeeper(self) ###################################################################### ## @classmethod def sanity_check(self): '''Implements interface from _PluginBase''' pass ###################################################################### ## def register_service_object(self, service_obj): '''Implements interface from _JobPluginBase''' sge_obj = SGEService(self, service_obj) self.bookkeeper.add_service_object(service_obj, sge_obj) self.log_info("Registered new service object %s" \ % (repr(service_obj))) ###################################################################### ## def unregister_service_object(self, service_obj): '''Implements interface from _JobPluginBase''' self.bookkeeper.remove_service_object(service_obj) self.log_info("Unegistered service object %s" \ % (repr(service_obj))) ###################################################################### ## def register_discoverer_object(self, discoverer_obj): '''Implements interface from SDPluginInterface''' sge_obj = SGEService(self, discoverer_obj) self.bookkeeper.add_service_object(discoverer_obj, sge_obj) self.log_info("Registered new discoverer object %s" \ % (repr(discoverer_obj))) ###################################################################### ## def unregister_discoverer_object(self, discoverer_obj): '''Implements interface from SDPluginInterface''' pass ###################################################################### ## def discoverer_list_services(self, discoverer_obj, service_filter, data_filter): '''Implements interface from SDPluginInterface''' try: sge = self.bookkeeper.get_sgewrapper_for_service(discoverer_obj) service_info = sge.get_service_info( ) # triggers ssh connection attempt desc = bliss.saga.sd.ServiceDescription() desc._ServiceDescription__init_from_discoverer(discoverer_obj) ## set values desc._url = discoverer_obj._url desc._type = "org.ogf.saga.service.job" desc._name = "SGE Job Scheduler" #desc._implementor = #desc._site = #desc._uid = return [desc] except Exception, ex: self.log_error_and_raise( bliss.saga.Error.NoSuccess, "Couldn't retreive service list because: %s " % (str(ex)))