Esempio n. 1
0
 def call(self, _, __, proxor: IProcessorAPI) -> CallResult:
     if self._actor._pings_left <= 0:
         return CallResult()
     logging.warning('step: {}, pings_left: {}'.format(
         proxor.step_count, self._actor._pings_left))
     self._actor._pings_left = self._actor._pings_left - 1
     return CallResult([self.create_call()])
Esempio n. 2
0
 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'))
     ])
Esempio n. 3
0
 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])
Esempio n. 4
0
 def call(self, _, __, proxor: IProcessorAPI) -> CallResult:
     if self._actor._pings_left <= 0:
         return proxor.exit()
     logging.warning('PING - time: {}, pings_left: {}'.format(
         repr_time(proxor.time), self._actor._pings_left))
     self._actor._pings_left = self._actor._pings_left - 1
     return CallResult([self.create_call()], 5)
Esempio n. 5
0
 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)])
Esempio n. 6
0
 def call(self, arg: CallArg, __, proxor: IProcessorAPI) -> CallResult:
     logging.warning('{}.{} : {}'.format(self._actor_name, self.name,
                                         self._call_counter))
     self._call_counter = self._call_counter + 1
     self._do_sleep()
     should_emit = self._should_emit()
     if should_emit:
         calls = [
             x.gen_call(self._call_counter, proxor) for x in self._call_gens
         ]
     else:
         calls = []
     step_count = self._step_count + self._jitter_step_count()
     return CallResult([x for x in calls if x is not None],
                       max(1, step_count))
Esempio n. 7
0
 def call(self, arg: CallArg, __, proxor: IProcessorAPI) -> CallResult:
     logging.warning('Sink received value: {}'.format(arg))
     if arg < 3:
         return CallResult()
     return proxor.exit()
Esempio n. 8
0
 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'))
     ])
Esempio n. 9
0
 def call(self, arg: CallArg, _, __) -> CallResult:
     return CallResult([Call(arg, Address(actor='ping'))])
Esempio n. 10
0
 def call(self, arg: CallArg, __, proxor: IProcessorAPI) -> CallResult:
     value_status = self.check_data_status(arg)
     logging.warning('Sink received value: {} : {}'.format(
         arg, value_status))
     return CallResult()
Esempio n. 11
0
 def call(self, arg: CallArg, __, proxor: IProcessorAPI) -> CallResult:
     self._actor.accum.append(arg)
     return CallResult()
Esempio n. 12
0
 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'))])
Esempio n. 13
0
 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)
Esempio n. 14
0
 def call(self, arg: CallArg, _, proxor: IProcessorAPI) -> CallResult:
     return CallResult(
         [Call(self._actor._value, Address(processor='C', actor='sink'))])
Esempio n. 15
0
 def call(self, arg: CallArg, _, proxor: IProcessorAPI) -> CallResult:
     self._actor._value = arg
     return CallResult()
Esempio n. 16
0
 def call(self, arg: CallArg, __, proxor: IProcessorAPI) -> CallResult:
     return CallResult([Call(arg, Address(processor='C', actor='sink'))],
                       random.randint(0, 5))