def call(self, arg: CallArg, __, proxor: IProcessorAPI) -> CallResult: return CallResult([ Call(arg + 1, Address(actor='source', proc='feed'), call_step=proxor.step_count + 10), Call(arg, Address(processor='C', actor='compute', proc='data1')) ])
def call(self, arg: CallArg, _, proxor: IProcessorAPI) -> CallResult: logging.warning('PONG - time: {}, pong'.format(repr_time(proxor.time))) # Note that busy waiting still happens even though the simulation # hardware of the pong agent is very slow (due to the sleep below) time.sleep(0.2) out_call = Call(arg, Address(processor='A', actor='ping')) return CallResult([out_call])
def call(self, arg: CallArg, _, proxor: IProcessorAPI) -> CallResult: count = int(arg) if count >= 3: return proxor.exit() logging.warning('time: {}, count: {}'.format(repr_time(proxor.time), count)) time.sleep(0.3) return CallResult([Call(count + 1, self._target)])
def create_timer_call(self, proxor: IProcessorAPI, immediate: bool = False) -> Call: call_step_count = int(proxor.frequency / self._timer_freq) if call_step_count <= 0: raise ValueError( "Period freq {} to high for processor freq {}".format( self._timer_freq, proxor.frequency)) call_step_count = call_step_count + self._jitter_call_steps(proxor) call_step = (0 if immediate else (call_step_count + proxor.step_count)) return Call(None, Address(actor=self._actor_name, proc=self.name), call_step=call_step)
def call(self, arg: CallArg, _, __) -> CallResult: return CallResult([Call(arg, Address(actor='ping'))])
def create_call() -> Call: return Call(None, Address(actor='pong'))
def call(self, arg: CallArg, __, proxor: IProcessorAPI) -> CallResult: result = [arg, self._actor.accum] self._actor.accum = [] return CallResult([Call(result, Address(processor='D', actor='sink'))])
def call(self, arg: CallArg, __, proxor: IProcessorAPI) -> CallResult: return CallResult([ Call(None, Address(actor='source', proc='feed')), Call(1, Address(processor='C', actor='compute', proc='data2')) ], 4)
def compute_main(processor: Processor) -> None: processor.add_actor(ComputeActor()) processor.put_calls( [Call(None, Address(actor='compute', proc='send'), call_step=5)])
def actor_C_main(processor: Processor) -> None: processor.add_actor(CountActor(target=Address(processor='A'))) processor.put_calls([Call(0, Address(actor='counter'))])
def call(self, arg: CallArg, _, proxor: IProcessorAPI) -> CallResult: return CallResult( [Call(self._actor._value, Address(processor='C', actor='sink'))])
def call(self, arg: CallArg, __, proxor: IProcessorAPI) -> CallResult: return CallResult([Call(arg, Address(processor='C', actor='sink'))], random.randint(0, 5))
def gen_call(self, arg: CallArg, proxor: IProcessorAPI): return Call(arg, target=self._address)
def ping_main(processor: Processor) -> None: processor.add_actor(PingActor(3)) processor.put_calls([Call(None, Address(actor='ping'))])
def create_call() -> Token: return Call(None, Address(processor='B', actor='pong'))
def call(self, arg: CallArg, __, proxor: IProcessorAPI) -> CallResult: return CallResult([ Call(arg + 1, Address(actor='source', proc='feed')), Call(arg, Address(processor='B', actor='sink')) ])
def source_main(processor: Processor) -> None: processor.add_actor(SourceActor()) processor.put_calls([Call(0, Address(actor='source'))])
def source_main(processor: Processor) -> None: processor.put_calls([ Call('OK', Address(processor='B', actor='compute'), call_step=random.randint(0, 10)) ])