def rpc_resolve_ideal(self,arg): (type,arg) = action.unmarshal(arg) if type=='sample': return self[3].resolve_name(' '.join(arg)) return action.marshal(())
def __tune_scale(self, subj, dummy, arg): print 'tune scale', arg type, thing = action.crack_ideal(action.arg_objects(arg)[0]) scale = action.marshal(thing) self[2][2].get_policy().set_value(scale) self.illuminator.reference_scale(scale) return action.nosync_return()
def __tune_scale(self,subj,dummy,arg): print 'tune scale',arg type,thing = action.crack_ideal(action.arg_objects(arg)[0]) scale = action.marshal(thing) self[2][2].get_policy().set_value(scale) self.illuminator.reference_scale(scale); return action.nosync_return()
def rpc_resolve_ideal(self,arg): (type,arg) = action.unmarshal(arg) print 'resolving',type,arg if type=='icon': return self[2].resolve_name(' '.join(arg)) return action.marshal(())
def make_schema(at, until, every, delta=0, prefix=None, desc=None): s = [] for (k, (q, v)) in at.items(): if k == 2: at[k] = (q, v + delta) for (k, (q, v)) in every.items(): if k == 2 and not q: every[k] = (q, v + delta) for (k, (q, v)) in at.items(): s.append(T('l', k, v)) if not k in until and not k in every: s.append(T('u', k, v + 1)) for (k, (q, v)) in until.items(): s.append(T('u', k, v)) for (k, (q, v)) in every.items(): if q: if k in at: akv = at[k][1] % v s.append(T('z', k, v, akv, akv + 1)) else: s.append(T('z', k, v, 0, 1)) else: s.append(T('l', k, v)) s.append(T('u', k, v + 1)) if desc: text = desc else: text = describe_schema_list(s) if prefix: text = prefix + ' ' + text return action.marshal(T('schema', text, tuple(s)))
def save_file(self,path,desc=''): def save_tweaker(snap,src_snap): upgrade.set_upgrade(snap,False) upgrade.set_description(snap,desc) tag = os.path.basename(path) yield self.index.sync() agents = set(self.all_agents(self.trunk)) for m in self.index.members(): ma = m.address if ma in agents: yield rpc.invoke_rpc(ma,'presave',action.marshal((tag,))) yield self.index.sync() m = [ c.address for c in self.index.members() ] for i in range(0,self.trunk.agent_count()): agent = self.trunk.get_agent_index(i) address = agent.get_address() if address in m or agent.get_type()!=0: continue print 'parking',address self.trunk.erase_agent(agent) checkpoint = agent.checkpoint() checkpoint.set_type(1) self.trunk.set_agent(checkpoint) self.flush('saved') upgrade.copy_snap2file(self.trunk,path,tweaker=save_tweaker) self.setups_changed(path)
def rpc_resolve_ideal(self, arg): (type, arg) = action.unmarshal(arg) # only support 'impulse' type if type == 'impulse': return self[4].resolve_name(' '.join(arg)) return action.marshal(())
def __tune_scale(self, subj, dummy, arg): print 'set scale', arg type, thing = action.crack_ideal(action.arg_objects(arg)[0]) if not self.__fixed: self[4][7].get_policy().set_value(action.marshal(thing)) return action.nosync_return()
def delete_trigger(self, trigger): assert (self.is_ready()) return self.invoke_rpc('delete_trigger', action.marshal(trigger))