Exemple #1
0
 def handler(self):
     # Load the application callable, the task consumer
     if self.callable:
         self.callable()
     import_modules(self.cfg.tasks_path)
     self.local.scheduler = Scheduler(self)
     return self
Exemple #2
0
 def __init__(self, queue, task_class, tasks_path=None, logger=None,
              schedule_periodic=False):
     if tasks_path:
         import_modules(tasks_path)
     self.schedule_periodic = schedule_periodic
     self._entries = self.setup_schedule()
     self.next_run = datetime.now()
     self.task_class = task_class
     self.queue = queue
     self.logger = logger or LOGGER
Exemple #3
0
 def load(cls, paths):
     self = cls()
     for mod in import_modules(paths, safe=True):
         for name, item in vars(mod).items():
             if name == JOB_LIST:
                 for job_cls in item:
                     self.register(job_cls)
             else:
                 self.register(item)
     return self
Exemple #4
0
 def load(cls, paths):
     self = cls()
     for mod in import_modules(paths, safe=True):
         for name, item in vars(mod).items():
             if name == JOB_LIST:
                 for job_cls in item:
                     self.register(job_cls)
             else:
                 self.register(item)
     return self
Exemple #5
0
 def load(cls, paths):
     self = cls()
     for mod in import_modules(paths, safe=False):
         for name in dir(mod):
             if name == JOB_LIST:
                 for job_cls in getattr(mod, name):
                     self.register(job_cls)
             else:
                 self.register(getattr(mod, name))
     return self
Exemple #6
0
 def load(cls, paths):
     self = cls()
     for mod in import_modules(paths):
         for name in dir(mod):
             self.register(getattr(mod, name))
     return self
Exemple #7
0
 def load(cls, paths):
     self = cls()
     for mod in import_modules(paths):
         for name in dir(mod):
             self.register(getattr(mod, name))
     return self
Exemple #8
0
 def __test_import_modules(self):
     self.assertEqual(import_modules(['gggggggggggg']), [])
     mods = import_modules(['pulsar.async.*'])
     self.assertTrue(mods)