Exemplo n.º 1
0
 def load_application(self, package, dispatcher):
     #loading application means loading all the models, controllers, tasks
     logger.debug("Loading app %s", package)
     try:
         try:
             controller_mod = importlib.import_module(".controllers", package=package)
         except ImportError:
             logger.warn("Application '%s' doesn't have controllers module", package)
         else:
             logger.debug("%s model objects loaded from app %s", AutoControllerLoader.load(package,
                                                                                           importlib.import_module(".routing", package=package), 
                                                                                           dispatcher, controller_mod),
                                                                                           package)
         AutoTaskLoader.load(importlib.import_module(".tasks", package=package))
     except:
         logger.error("Failed to load app %s: %s", str(package), traceback.format_exc())
         return False
     else:
         logger.info("Application: '%s' has been loaded", package)
         return True
Exemplo n.º 2
0
def autoLoadTasks():
    global _RACE_PROTECTION
    
    if _RACE_PROTECTION:
        return
    
    _RACE_PROTECTION = True
    apps = eval(j25.config.main.applications)
    if j25.config.main.has_option('applications_in_worker') and eval(j25.config.main.applications_in_worker):
        apps = eval(j25.config.main.applications_in_worker)
    else:
        apps = list(set(apps).difference(set(eval(j25.config.main.excluded_applications_from_worker))))
    logging.debug("Loading tasks from apps %s" % apps)
    count = AutoTaskLoader.load_apps(apps)
    if count:
        logging.info("Loaded tasks from %s app(s)" % count)
    else:
        logging.critical("No Applications were found in this project")
        exit(33)
    _RACE_PROTECTION = False