Commit f68f392a authored by Michael Ott's avatar Michael Ott
Browse files

Introduce new parameter -o to set MQTT timeout

parent 537cf1c0
...@@ -38,10 +38,6 @@ ...@@ -38,10 +38,6 @@
#include "dcdb/version.h" #include "dcdb/version.h"
#include "version.h" #include "version.h"
#define SLURMJOBTIMEOUT 60000000000
int msgId = -1; int msgId = -1;
bool done = false; bool done = false;
...@@ -64,6 +60,7 @@ void usage() { ...@@ -64,6 +60,7 @@ void usage() {
std::cout << "Options:" << std::endl; std::cout << "Options:" << std::endl;
std::cout << " -b<hosts> List of MQTT brokers [default: localhost:1883]" << 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 << " -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 << " -c<hosts> List of Cassandra hosts [default: none]" << std::endl;
std::cout << " -u<username> Cassandra username [default: none]" << std::endl; std::cout << " -u<username> Cassandra username [default: none]" << std::endl;
std::cout << " -p<password> Cassandra password [default: none]" << std::endl; std::cout << " -p<password> Cassandra password [default: none]" << std::endl;
...@@ -178,10 +175,11 @@ int main(int argc, char** argv) { ...@@ -178,10 +175,11 @@ int main(int argc, char** argv) {
std::string substitution=""; std::string substitution="";
int maxJobLength = -1; int maxJobLength = -1;
int qos = 0; int qos = 0;
int timeout = 10;
uint64_t ts=0; uint64_t ts=0;
// Defining options // 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; char ret;
while ((ret = getopt(argc, argv, opts))!=-1) { while ((ret = getopt(argc, argv, opts))!=-1) {
...@@ -214,6 +212,9 @@ int main(int argc, char** argv) { ...@@ -214,6 +212,9 @@ int main(int argc, char** argv) {
case 'q': case 'q':
qos = atoi(optarg); qos = atoi(optarg);
break; break;
case 'o':
timeout = atoi(optarg);
break;
case 'c': case 'c':
cassandra = true; cassandra = true;
splitHostList(optarg, hostList); splitHostList(optarg, hostList);
...@@ -446,7 +447,7 @@ int main(int argc, char** argv) { ...@@ -446,7 +447,7 @@ int main(int argc, char** argv) {
retCode = 1; retCode = 1;
goto exit; goto exit;
} }
} while(!done && getTimestamp() - startTs < SLURMJOBTIMEOUT); } while(!done && getTimestamp() - startTs < S_TO_NS(timeout));
} }
//hasta la vista //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