def update (self, spec): if spec.has_key("users"): qm = ComponentProxy("queue-manager") try: qm.set_queues([{'name':self.queue,}], {'users':spec['users']}, "bgsched") except ComponentLookupError: logger.error("unable to contact queue manager when updating reservation users") raise # try the above first -- if we can't contact the queue-manager, don't update the users if spec.has_key('cycle') and not self.cycle: #we have just turned this into a cyclic reservation and need a cycle_id. spec['cycle_id'] = self.cycle_id_gen.get() #get the user name of whoever issued the command user_name = None if spec.has_key('__cmd_user'): user_name = spec['__cmd_user'] del spec['__cmd_user'] #if we're defering, pull out the 'defer' entry and send a cobalt db message. #there really isn't a corresponding field to update deferred = False if spec.has_key('defer'): logger.info("Res %s/%s: Deferring cyclic reservation: %s", self.res_id, self.cycle_id, self.name) dbwriter.log_to_db(user_name, "deferred", "reservation", self) del spec['defer'] deferred = True Data.update(self, spec) if not deferred or not self.running: #we only want this if we aren't defering. If we are, the cycle will #take care of the new data object creation. dbwriter.log_to_db(user_name, "modifying", "reservation", self)
def update (self, spec): if spec.has_key("users"): qm = ComponentProxy(self.COMP_QUEUE_MANAGER) try: qm.set_queues([{'name':self.queue,}], {'users':spec['users']}, "bgsched") except ComponentLookupError: logger.error("unable to contact queue manager when updating reservation users") raise # try the above first -- if we can't contact the queue-manager, don't update the users Data.update(self, spec)
def update(self, spec): if spec.has_key("users"): qm = ComponentProxy(self.COMP_QUEUE_MANAGER) try: qm.set_queues([{ 'name': self.queue, }], {'users': spec['users']}, "bgsched") except ComponentLookupError: logger.error( "unable to contact queue manager when updating reservation users" ) raise # try the above first -- if we can't contact the queue-manager, don't update the users Data.update(self, spec)
def update(self, spec): if spec.has_key("users"): qm = ComponentProxy("queue-manager") try: qm.set_queues([{ 'name': self.queue, }], {'users': spec['users']}, "bgsched") except ComponentLookupError: logger.error( "unable to contact queue manager when updating reservation users" ) raise # try the above first -- if we can't contact the queue-manager, # don't update the users if spec.has_key('cycle') and not self.cycle: #just turned this into a cyclic reservation and need a cycle_id spec['cycle_id'] = self.cycle_id_gen.get() #get the user name of whoever issued the command user_name = None if spec.has_key('__cmd_user'): user_name = spec['__cmd_user'] del spec['__cmd_user'] #if we're defering, pull out the 'defer' entry and send a cobalt db #message. There really isn't a corresponding field to update deferred = False if spec.has_key('defer'): logger.info("Res %s/%s: Deferring cyclic reservation: %s", self.res_id, self.cycle_id, self.name) dbwriter.log_to_db(user_name, "deferred", "reservation", self) del spec['defer'] deferred = True Data.update(self, spec) if not deferred or not self.running: #we only want this if we aren't defering. If we are, the cycle will #take care of the new data object creation. dbwriter.log_to_db(user_name, "modifying", "reservation", self)
def test_update(self): warnings.simplefilter("ignore", DeprecationWarning) warnings.simplefilter("ignore", RuntimeWarning) data = Data({'tag': "somedata"}) data.update({'tag': "someotherdata"}) assert data.tag == "someotherdata"
def test_update (self): warnings.simplefilter("ignore", DeprecationWarning) warnings.simplefilter("ignore", RuntimeWarning) data = Data({'tag':"somedata"}) data.update({'tag':"someotherdata"}) assert data.tag == "someotherdata"