def on_startup(self): print("INIT: Init v1.0 (part of System y) started") for elem in self.initlist: if len(elem) == 4: user, group, name, cls = elem args = () kwargs = {} if len(elem) == 5: user, group, name, cls, args = elem kwargs = {} if len(elem) == 6: user, group, name, cls, args, kwargs = elem if isinstance(cls, str): # attempt an import try: mod = importlib.import_module('.'.join( cls.split('.')[:-1])) cls = getattr(mod, cls.split('.')[-1]) except (ImportError, AttributeError): print("INIT: Failed to import", cls) continue Tasklet.start(cls, name, group, user, None, *args, **kwargs) print("INIT:", len(self.initlist), "tasklets spawned, exiting")
def on_startup(self): print ("INIT: Init v1.0 (part of System y) started") for elem in self.initlist: if len(elem) == 4: user, group, name, cls = elem; args = (); kwargs = {} if len(elem) == 5: user, group, name, cls, args = elem; kwargs = {} if len(elem) == 6: user, group, name, cls, args, kwargs = elem if isinstance(cls, str): # attempt an import try: mod = importlib.import_module('.'.join(cls.split('.')[:-1])) cls = getattr(mod, cls.split('.')[-1]) except (ImportError, AttributeError): print("INIT: Failed to import", cls) continue Tasklet.start(cls, name, group, user, None, *args, **kwargs) print("INIT:", len(self.initlist), "tasklets spawned, exiting")
def on_readable(self, sock, newconn): Tasklet.start(MultiTaskletServerTasklet.ClientTasklet, 'client', None, None, None, newconn)
def on_startup(self): me = Tasklet.me() print('Hello World! My name is %s.%s.%s, TID is %s' % (me.user, me.group, me.name, me.tid)) Tasklet.start(BabyTasklet, 'baby', None, None, self.on_spawned)
def on_startup(self): Tasklet.start(ChildTasklet, None, None, None, self.on_child_open)
def on_message(self, source, syncMsg): Tasklet.start( ChildDelegateTasklet, "childDelegate", None, None, lambda child: self.on_delegate_started(syncMsg, child) )
def on_startup(self): Tasklet.start(ChildTasklet, "childTasklet", None, None, self.on_child_started)
def on_startup(self): Tasklet.start(WorkerTasklet, 'baby', None, None, self.on_spawned)