def load_spec_file(self, wf_spec_name): from os.path import exists, join path = join(self._spec_path, wf_spec_name+self._spec_suffix) if exists(path): tasks, processes = parseFile(path) self._cache_tasks.update(tasks) self._cache_workflows.update(processes)
def loadspec(apps_list, global_options): from uliweb.core.SimpleFrame import get_app_dir from uliweb import settings from redbreast.core.spec import parse, parseFile SPEC_DIR = settings.REDBREAST.SPEC_DIR SPEC_SUFFIX = settings.REDBREAST.SPEC_SUFFIX all_tasks = {} all_workflows = {} for p in apps_list: spec_dir = os.path.join(get_app_dir(p), SPEC_DIR) if os.path.isdir(spec_dir): for f in os.listdir(spec_dir): if f.endswith(SPEC_SUFFIX): file = os.path.join(spec_dir, f) print "\n* Parsing file %s ...." % file try: tasks, processes = parseFile(file) print tasks print processes except Exception, e: print "[ERROR] ParseError, %s" % e tasks, processes = {}, {} if global_options.verbose: print " tasks, %s, %s" % (len(tasks), [t for t in tasks]) print " workflow, %s, %s" % (len(processes), [t for t in processes]) for name in tasks: if name in all_tasks: print "[WARNING] duplicate definition of Task %s" % ( name) print " will be overwriten by lastest one in %s" % file all_tasks[name] = (tasks[name], file) for name in processes: if name in all_workflows: print "[WARNING] duplicate definition of Workflow %s" % ( name) print " will be overwriten by lastest one in %s" % file all_workflows[name] = (processes[name], file)
def loadspec(apps_list, global_options): from uliweb.core.SimpleFrame import get_app_dir from uliweb import settings from redbreast.core.spec import parse, parseFile SPEC_DIR = settings.GLOBAL.SPEC_DIR SPEC_SUFFIX = settings.GLOBAL.SPEC_SUFFIX all_tasks = {} all_workflows = {} for p in apps_list: spec_dir =os.path.join(get_app_dir(p), SPEC_DIR) if os.path.isdir(spec_dir): for f in os.listdir(spec_dir): if f.endswith(SPEC_SUFFIX): file = os.path.join(spec_dir, f) print "\n* Parsing file %s ...." % file try: tasks, processes = parseFile(file) print tasks print processes except Exception, e: print "[ERROR] ParseError, %s" % e tasks, processes = {}, {} if global_options.verbose: print " tasks, %s, %s" % (len(tasks), [t for t in tasks]) print " workflow, %s, %s" % (len(processes), [t for t in processes]) for name in tasks: if name in all_tasks: print "[WARNING] duplicate definition of Task %s" % (name) print " will be overwriten by lastest one in %s" % file all_tasks[name] = (tasks[name], file) for name in processes: if name in all_workflows: print "[WARNING] duplicate definition of Workflow %s" % (name) print " will be overwriten by lastest one in %s" % file all_workflows[name] = (processes[name], file)
def load_config_file(self, path): tasks, processes = parseFile(path) self._cache_tasks.update(tasks) self._cache_workflows.update(processes)