+void Launcher::signalUSR2() throw(anna::RuntimeException) {
+
+ LOGNOTICE(
+ std::string msg = "Captured signal SIGUSR2. Reading tasks at '";
+ msg += SIGUSR2_TASKS_INPUT_FILENAME;
+ msg += "' (results will be written at '";
+ msg += SIGUSR2_TASKS_OUTPUT_FILENAME;
+ msg += "')";
+ anna::Logger::notice(msg, ANNA_FILE_LOCATION);
+ );
+
+ // Operation:
+ std::string line;
+ std::string response_content;
+
+ std::ifstream in_file (SIGUSR2_TASKS_INPUT_FILENAME);
+ std::ofstream out_file (SIGUSR2_TASKS_OUTPUT_FILENAME);
+
+ if (!in_file.is_open()) throw RuntimeException("Unable to read tasks", ANNA_FILE_LOCATION);
+ if (!out_file.is_open()) throw RuntimeException("Unable to write tasks", ANNA_FILE_LOCATION);
+
+ while (getline (in_file, line))
+ {
+ LOGDEBUG(
+ std::string msg = "Processing line: ";
+ msg += line;
+ anna::Logger::debug(msg, ANNA_FILE_LOCATION);
+ );
+
+ try {
+ eventOperation(line, response_content);
+ } catch (RuntimeException &ex) {
+ ex.trace();
+ }
+ out_file << response_content;
+ }
+ in_file.close();
+ out_file.close();
+}
+
+