/** * @file WorkflowTool.h * @brief 工作流辅助工具(支持脚本生成jar submit) * @author huojidong */ #ifndef PAI_HOME_WORKFLOWENGINE_WORKFLOWTOOLS_H #define PAI_HOME_WORKFLOWENGINE_WORKFLOWTOOLS_H #include namespace pai { namespace workflow { class CWorkflowTool { public: CWorkflowTool(); ~CWorkflowTool(); public: /** * @brief 生成一个jar包 * @param jsonfilepath 传入的json路径(绝对路径) * @param jarfilename 输入的jar包文件名(可以不填) */ bool GenerateJarFile(const std::string &jsonfilepath,const std::string&jarfilename,const std::string &destjarpath); /** * @brief 得到要存放Jar包文件路径 */ std::string GetDestJarPath()const {return destJarPath;} /** * @brief 设置要存放Jar包的路径 */ void SetDestJarPath(std::string inputJarPath){inputJarPath.append("/");destJarPath=inputJarPath;} private: /** *@brief 将json文件拷贝到临时目录的之下(吻合compiler下的GeneratorJobFile函数) *@param strFilePath json路径 *@param strCompileTmpDir 临时文件夹路径 */ bool SaveJsonToLocalCompileTmp(const std::string& strFilePath,const std::string& strCompileTmpDir); /** *@brief 将生成的jar文件拷贝到PAI_HOME下的res目录下(脚本执行的当前目录) *@param strCompileTmpDir 临时目录 *@param jarfilename 目标jar包文件名 *@param jardestpath jar包存储路径 */ bool CopyJarFileToDestFilePath(const std::string&strCompileTmpDir,const std::string& jarfilename); private: std::string destJarPath;//目标路径地址 }; } } #endif