Пример #1
0
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
def createHashbangAwareProcessRunner(runnersDir, processRunner):
  runners = collectFilesInDirs([runnersDir], 
      lambda path, fileName: Runner(fileName, path))
  return HashbangAwareProcessRunner(runners, processRunner)
Пример #5
0
def readSynchronizers(dirs, processRunner):
  def load(path, fileName):
    return LazyConfigurable(fileName,
        lambda: loadSynchronizer(processRunner, path, fileName))

  return ConfigurableList(collectFilesInDirs(dirs, load))