void NullJob::startImpl(const std::shared_ptr<ProcessCreator> &) { LOG(Info, "Null starting"); { QMutexLocker l(&m_mutex); } emitStatusChanged(AdvancedStatus(AdvancedStatusEnum::Starting)); emitStarted(); emitStatusChanged(AdvancedStatus(AdvancedStatusEnum::Processing)); openstudio::path outpath; try { outpath = outdir(true); boost::filesystem::create_directories(outpath); setErrors(JobErrors(ruleset::OSResultValue::Success, std::vector<std::pair<runmanager::ErrorType, std::string> >() )); } catch (const std::exception &e) { LOG(Error, "NullJob error starting job: " << e.what() << ". Job path is: " << toString(outpath)); std::vector<std::pair<runmanager::ErrorType, std::string> > err; err.push_back(std::make_pair(runmanager::ErrorType::Error, e.what())); setErrors(JobErrors(ruleset::OSResultValue::Fail, err)); } }
void EnergyPlusPostProcessJob::startImpl(const boost::shared_ptr<ProcessCreator> &) { openstudio::path outpath = outdir(); QWriteLocker l(&m_mutex); JobErrors errors; errors.result = ruleset::OSResultValue::Success; try { m_sql = sqlFile(); resetFiles(m_files, m_sql); } catch (const std::exception &e) { std::vector<std::pair<ErrorType, std::string> > err; err.push_back(std::make_pair(ErrorType::Error, e.what())); errors = JobErrors(ruleset::OSResultValue::Fail, err); } if (m_sql) { LOG(Info, "EnergyPlusPostProcess starting, filename: " << toString(m_sql->fullPath)); } LOG(Info, "EnergyPlusPostProcess starting, outdir: " << toString(outpath)); l.unlock(); emitStatusChanged(AdvancedStatus(AdvancedStatusEnum::Starting)); emitStarted(); emitStatusChanged(AdvancedStatus(AdvancedStatusEnum::Processing)); if (errors.result == ruleset::OSResultValue::Fail) { setErrors(errors); return; } SqlFile sqlFile(m_sql->fullPath); try { boost::filesystem::create_directories(outpath); std::vector<Attribute> attributes = PostProcessReporting::go(sqlFile); if (attributes.empty()) { LOG(Warn, "No attributes loaded for report"); } Attribute report("Report", attributes); bool result = report.saveToXml(outpath / openstudio::toPath("report.xml")); if (!result){ LOG_AND_THROW("Failed to write report.xml"); } } catch (const std::exception &e) { LOG(Error, "Error with EnergyPlusPostProcessJob: " + std::string(e.what())); errors.addError(ErrorType::Error, "Error with EnergyPlusPostProcessJob: " + std::string(e.what())); errors.result = ruleset::OSResultValue::Fail; } // Change this to whatever output files you generate emitOutputFileChanged(RunManager_Util::dirFile(outpath / openstudio::toPath("report.xml"))); setErrors(errors); }