예제 #1
0
파일: configrepo.py 프로젝트: pid0/sibt
def readSchedulers(dirs, loader, schedulerWrapper, initArgs,
    paths, makeErrorLoggerWithPrefix):
  def loadScheduler(path, name):
    newInitArgs = initArgs._replace(
        logger=makeErrorLoggerWithPrefix("sibt ({0})".format(name)),
        varDir=makeSchedulerVarDir(paths, name))
    ret = loadSchedulerFromModule(loader, path, name, newInitArgs)
    return schedulerWrapper(ret)

  return ConfigurableList(collectFilesInDirs(dirs, lambda path, fileName:
      LazyConfigurable(fileName, lambda: loadScheduler(path, fileName))))
예제 #2
0
  def _readInstancesFromBaseRule(self, baseRulePath, baseRuleName):
    if any(baseRuleName.endswith(extension) for extension in 
        self.extensionsToIgnore):
      return None

    instances =  collectFilesInDirs([self.enabledDir], functools.partial(
      self._buildLazyInstance, baseRulePath, baseRuleName, True))

    if len(instances) == 0:
      disabledRule = self._buildLazyInstance(baseRulePath, baseRuleName, False, 
        baseRulePath, "@" + baseRuleName)
      if disabledRule is not None:
        return [disabledRule]

    return instances
예제 #3
0
 def read(self):
   return [rule for instancesList in collectFilesInDirs([self.rulesDir], 
     self._readInstancesFromBaseRule) for rule in instancesList]
예제 #4
0
파일: configrepo.py 프로젝트: pid0/sibt
def createHashbangAwareProcessRunner(runnersDir, processRunner):
  runners = collectFilesInDirs([runnersDir], 
      lambda path, fileName: Runner(fileName, path))
  return HashbangAwareProcessRunner(runners, processRunner)
예제 #5
0
파일: configrepo.py 프로젝트: pid0/sibt
def readSynchronizers(dirs, processRunner):
  def load(path, fileName):
    return LazyConfigurable(fileName,
        lambda: loadSynchronizer(processRunner, path, fileName))

  return ConfigurableList(collectFilesInDirs(dirs, load))