Esempio n. 1
0
    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")
Esempio n. 2
0
    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")
Esempio n. 3
0
 def on_readable(self, sock, newconn):
     Tasklet.start(MultiTaskletServerTasklet.ClientTasklet, 'client', None, None, None, newconn)
Esempio n. 4
0
    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)
Esempio n. 5
0
 def on_startup(self):
     Tasklet.start(ChildTasklet, None, None, None, self.on_child_open)
Esempio n. 6
0
 def on_message(self, source, syncMsg):
     Tasklet.start(
         ChildDelegateTasklet, "childDelegate", None, None, lambda child: self.on_delegate_started(syncMsg, child)
     )
Esempio n. 7
0
 def on_startup(self):
     Tasklet.start(ChildTasklet, "childTasklet", None, None, self.on_child_started)
Esempio n. 8
0
 def on_readable(self, sock, newconn):
     Tasklet.start(MultiTaskletServerTasklet.ClientTasklet, 'client', None,
                   None, None, newconn)
Esempio n. 9
0
 def on_startup(self):
     Tasklet.start(WorkerTasklet, 'baby', None, None, self.on_spawned)
Esempio n. 10
0
 def on_startup(self):
     Tasklet.start(WorkerTasklet, 'baby', None, None, self.on_spawned)
Esempio n. 11
0
 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)