Commit f68f392a authored by Michael Ott's avatar Michael Ott

Introduce new parameter -o to set MQTT timeout

parent 537cf1c0
......@@ -38,10 +38,6 @@
#include "dcdb/version.h"
#include "version.h"
#define SLURMJOBTIMEOUT 60000000000
int msgId = -1;
bool done = false;
......@@ -64,6 +60,7 @@ void usage() {
std::cout << "Options:" << std::endl;
std::cout << " -b<hosts> List of MQTT brokers [default: localhost:1883]" << std::endl;
std::cout << " -q<qos> MQTT QoS to use [default: 0]" << std::endl;
std::cout << " -o<timeout> MQTT timeout in seconds [default: 10]" << std::endl;
std::cout << " -c<hosts> List of Cassandra hosts [default: none]" << std::endl;
std::cout << " -u<username> Cassandra username [default: none]" << std::endl;
std::cout << " -p<password> Cassandra password [default: none]" << std::endl;
......@@ -178,10 +175,11 @@ int main(int argc, char** argv) {
std::string substitution="";
int maxJobLength = -1;
int qos = 0;
int timeout = 10;
uint64_t ts=0;
// Defining options
const char *opts = "b:q:c:u:p:n:t:j:i:s:m:h";
const char *opts = "b:q:o:c:u:p:n:t:j:i:s:m:h";
char ret;
while ((ret = getopt(argc, argv, opts))!=-1) {
......@@ -214,6 +212,9 @@ int main(int argc, char** argv) {
case 'q':
qos = atoi(optarg);
break;
case 'o':
timeout = atoi(optarg);
break;
case 'c':
cassandra = true;
splitHostList(optarg, hostList);
......@@ -446,7 +447,7 @@ int main(int argc, char** argv) {
retCode = 1;
goto exit;
}
} while(!done && getTimestamp() - startTs < SLURMJOBTIMEOUT);
} while(!done && getTimestamp() - startTs < S_TO_NS(timeout));
}
//hasta la vista
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment