def move_one_step(self, scancmd, numthreads=1, validate=False): if scancmd.stopped: return pool=ThreadPool(scancmd,numthreads) pool.add_task(super(LoopDeviceStepNode, self).move_one_step, scancmd, validate) for item in self.simuldevs: pool.add_task(item.move_one_step, scancmd, validate) pool.join_all() if self.current_index==len(self.positions)-1: self.atend=True
def move_to_start(self, scancmd, numthreads=1, validate=False): if scancmd.stopped: return pool=ThreadPool(scancmd, numthreads) pool.add_task( super(LoopDeviceStepNode, self).move_to_start, scancmd, validate) for item in self.simuldevs: pool.add_task(item.move_to_start, scancmd, validate) pool.join_all() self.atend=False
def move_one_step(self, scancmd, numthreads=1, validate=False): if scancmd.stopped: return if validate: super(LoopDeviceStepNode, self).move_one_step(scancmd, validate) for item in self.simuldevs: item.move_one_step(scancmd, validate) if not self.check_pos(self.current_pos): self.atend=True return pool=ThreadPool(scancmd,numthreads) pool.add_task(super(LoopDeviceStepNode, self).move_one_step, scancmd, validate) for item in self.simuldevs: pool.add_task(item.move_one_step, scancmd, validate) pool.join_all() if not self.check_pos(self.current_pos): self.atend=True
def execute(self,*args,**kwargs): arguments=[args[i:i+self.numbaseargs] for i in range(0,len(args),self.numbaseargs)] pool=ThreadPool(self,self.numthreads, persist=False) for args_ in arguments: pool.add_task(self.call_each_execute, *args_) pool.join_all()