原文连接:http://www.reeline.com/arch/2012/12/05/Client_Basic_API/
前言
虽然OGL设计以命令行+配置文件的方式来提交作业,但还是抽象出一套API用于复杂的客户端处理;本文描述了API的定义及处理过程,并提供了简单的例子用于功能的演示;
OGL 类图:
OGL 通信序列图:
示例代码:
int main(int argc, char** argv){ try { Connection connection; JobProxy* job = connection.addJob(&jobOption); TaskOption taskOption; TaskProxy* task = job->addTask(&taskOption); char buf[BUFSIZ] = { 0}; size_t size = BUFSIZ; task->output(buf, size); cout << buf << endl; } catch (Exception& e) { cout << "*ERROR*: " << e.what() << endl; } return 0;}
CLI 提交作业:
Usage: oglsub -j job name -c commad line [OPTION] Submit a command line as job to Job Manager Server. -j Job name -c Job command Home & Bugs: