bool TaskListPlugin::loadFile(QString *errorString, const QString &context, const QString &fileName)
{
    clearTasks();

    bool result = parseTaskFile(errorString, context, fileName);
    if (result) {
        SessionManager::setValue(QLatin1String(SESSION_BASE_KEY), context);
        SessionManager::setValue(QLatin1String(SESSION_FILE_KEY), fileName);
    } else {
        stopMonitoring();
    }

    return result;
}
Beispiel #2
0
void AbstractEngine::init() {
  
  log->record(GreasyLog::devel, "AbstractEngine::init", "Entering...");
  
  log->record(GreasyLog::silent,"Start greasing " + taskFile);
  parseTaskFile();
  checkDependencies();
  
  if ((validTasks.size() != taskMap.size())&&(!strictChecking)) {
    log->record(GreasyLog::warning,  "Invalid tasks found. Greasy will ignore them");  
  }
  
  // Only set the number of workers if any subclass has not changed the value before.
  if (nworkers == 0){
    // Set the number of workers
    if (config->keyExists("NWorkers")) {
      log->record(GreasyLog::devel, "Using defined NWorkers: " + toString(nworkers));
      nworkers = fromString(nworkers, config->getValue("NWorkers"));
    } else { 
      getDefaultNWorkers();
      log->record(GreasyLog::warning, "Falling back to the default number of workers " + toString(nworkers));
      log->record(GreasyLog::warning, "Consider setting environment variable GREASY_NWORKERS to the desired cpus to use");
    }
  }
  
  if (!fileErrors) {
    if(nworkers>0) {  
      ready = true;
      log->record(GreasyLog::info,  toUpper(engineType) + " engine is ready to run with "
				  + toString(nworkers) + " workers"); 
    } else {
      log->record(GreasyLog::error,  toUpper(engineType) + " engine has no workers. Please check your greasy setup");
    }
  }
  log->record(GreasyLog::devel,  "Configuration contents:\n\n" + config->printContents()); 
  log->record(GreasyLog::devel,  "End of configuration contents"); 
  
  log->record(GreasyLog::devel, "AbstractEngine::init", "Exiting...");
  
}