Definition at line 14 of file mainJobRunner.cpp. References Impala::CmdOptions::AddOption(), Impala::atol(), Impala::Job::Runner::Connect(), Impala::Job::Runner::Disconnect(), Impala::CmdOptions::GetArg(), Impala::CmdOptions::GetBool(), Impala::CmdOptions::GetInstance(), Impala::CmdOptions::GetInt(), Impala::Job::Runner::GetJobList(), Impala::CmdOptions::GetString(), ILOG_ERROR, ILOG_INFO, ILOG_VAR, Impala::CmdOptions::Initialise(), Impala::CmdOptions::ParseArgs(), Impala::Job::Runner::PoisonServer(), Impala::Job::Runner::RunJobs(), and Impala::Job::Runner::StopServer(). Referenced by main(). 00015 { 00016 CmdOptions& options = CmdOptions::GetInstance(); 00017 options.Initialise(false, false, true); 00018 String usageStr = "jobServerAddress \n\n"; 00019 options.AddOption(0, "maxJobs", "nr", "0"); 00020 options.AddOption(0, "maxIdle", "sec", "0"); 00021 options.AddOption(0, "maxJobTime", "min", "0"); 00022 options.AddOption(0, "sleepIntervalSec", "sec", "10"); 00023 options.AddOption(0, "poisonServer", "", "0"); 00024 options.AddOption(0, "stopServer", "", "0"); 00025 options.AddOption(0, "cmdLineExtension", "string", ""); 00026 if (! options.ParseArgs(argc, argv, usageStr, 1)) 00027 return 1; 00028 00029 ILOG_VAR(Impala.Application.mainJobRunner); 00030 00031 String serverAddr = options.GetArg(0); 00032 //int port = atol(options.GetArg(1)); 00033 int colonPos = serverAddr.find(":"); 00034 if (colonPos <= 0) 00035 { 00036 ILOG_ERROR("Not a valid server address (port number is missing): " << 00037 serverAddr); 00038 return 2; 00039 } 00040 int port = atol(serverAddr.substr(colonPos + 1)); 00041 serverAddr = serverAddr.substr(0, colonPos); 00042 //int verbose = options.GetInt("verb"); 00043 int maxJobs = options.GetInt("maxJobs"); 00044 int maxIdleTimeSec = options.GetInt("maxIdle"); 00045 int maxJobTime = options.GetInt("maxJobTime"); 00046 int sleepIntervalSec = options.GetInt("sleepIntervalSec"); 00047 String passwordFile = options.GetString("passwordFile"); 00048 String cmdLineExtension = options.GetString("cmdLineExtension"); 00049 00050 bool poisonServer = options.GetBool("poisonServer"); 00051 bool stopServer = options.GetBool("stopServer"); 00052 00053 // main code for JobRunner application 00054 Job::Runner jobRunner; 00055 if (jobRunner.Connect(serverAddr, port, passwordFile)) 00056 { 00057 if (stopServer) 00058 jobRunner.StopServer(); 00059 else if (poisonServer) 00060 jobRunner.PoisonServer(); 00061 else 00062 { 00063 jobRunner.RunJobs(maxJobs, maxIdleTimeSec, maxJobTime, 00064 sleepIntervalSec, cmdLineExtension); 00065 jobRunner.Disconnect(); 00066 } 00067 } 00068 00069 const std::list<String>& jobsDone = jobRunner.GetJobList(); 00070 //std::list<String>::iterator iter = jobsDone.begin(); 00071 //while (iter != jobsDone.end()) 00072 //{ 00073 // ILOG_INFO(*iter); 00074 // iter++; 00075 //} 00076 int jobCount = jobsDone.size(); 00077 ILOG_INFO("Jobs run: " << jobCount); 00078 }
Here is the call graph for this function:
|