Commit bb0a146c authored by Naman Dixit's avatar Naman Dixit

Rearchitected resource daemon to be multithreaded for instrumentation

parent b876af62
......@@ -113,6 +113,9 @@ int main(int argc, char** argv)
tmCommandInit();
instrumentCommandInit();
pthread_t thread_manager;
pthread_create(&thread_manager, NULL, &tmProcessLoop, NULL);
Kafka kafka = {0};
kafka.writer = kafkaCreateWriter(&kafka, "10.129.6.5:9092");
......@@ -219,8 +222,10 @@ int main(int argc, char** argv)
// TODO(naman): Error
} else {
Char *node_id = cJSON_GetObjectItem(root, "node_id")->valuestring;
if (streq(node_id, node_name)) {
if (strequal(node_id, node_name)) {
// FIXME(naman): Fix this placeholder
Thread_Manager_Command tmc = {0};
tmCommandEnqueue(tmc);
/* "resource_id": "logical-entity-id", */
/* "function_id": "unique-function-id", */
/* "timestamp" : "iso-8601-timestamp", */
......@@ -265,6 +270,16 @@ int main(int argc, char** argv)
}
}
{
JSON_Print_Command command = {0};
while (instrumentCommandDequeue(&command)) {
// TODO(naman): Enable this after proper testing
/* if (!kafkaWrite(kafka.writer, command.topic, "resource_daemon", command.msg)) { */
/* return -1; */
/* } */
}
}
{ // Send a heartbeat message if it is time to do so
U64 time_new = timeMilli();
U64 time_passed = time_new - time_begin;
......
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