hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
DRCEMessageConst.hpp
Go to the documentation of this file.
1 
14 #ifndef DRCE_MESSAGE_CONST_HPP
15 #define DRCE_MESSAGE_CONST_HPP
16 
17 #include <vector>
18 #include <string>
19 
20 namespace HCE
21 {
22 namespace drce
23 {
24 namespace message_const
25 {
26 //-----------------------------------------------------------------------------
27  enum
28  {
90  PID,
104  };
105 
106  const char delimiter = ':';
107  const char space = ' ';
108  const char point = '.';
109 
110  const std::string badJsonFormat = "Bad json format. Not found field: ";
111  const std::string badJsonFieldContent = "Bad json format. Bad content of field: ";
112 
113  const std::string createDefaultJson = "CREATE DefaultJSON";
114  const std::string serializationOutputJsonMessageError = "Serialization error of output json message";
115  const std::string emptyCommandLine = "Empty command line";
116  const std::string executeCommandFail = "Execute command fail";
117  const std::string unknownSessionType = "Unknown session type";
118  const std::string objectInstanceWasNotCreated = "Object instance was not created";
119  const std::string emptyObjectInstance = "Empty object instance";
120  const std::string setHomeDir = "Set HomeDir";
121  const std::string error = "Error";
122  const std::string errorMsg = "ERROR_MSG";
123  const std::string errorCode = "ERROR_CODE";
124  const std::string command = "COMMAND";
125 
126  const std::string createFileFail = "Create file fail";
127  const std::string readFileFail = "Read file fail";
128  const std::string deleteFileFail = "Delete file fail";
129  const std::string errorReadDataFile = "Error read data file";
130  const std::string errorReadRequestFile = "Error read request file";
131  const std::string dataFileNotExists = "File of data not exists";
132  const std::string requestFileNotExists = "File of request not exists";
133  const std::string badFileContent = "Bad file's content";
134  const std::string shellScriptNotExist = "Shell script not exist";
135  const std::string shellScriptCannotExecute = "Shell script cannot execute";
136 
137  const std::string wrongTypeTaskRequest = "Wrong type of task request";
138  const std::string wrongTypeThreadMode = "Wrong type of thread mode";
139  const std::string executeShellHostCommandFail = "Execute Shell Host command fail";
140  const std::string shellHostCommandReturnError = "Shell Host command return error";
141  const std::string wrongTypeRemoteExecution = "Wrong type of remote execution";
142  const std::string wrongCheckType = "Wrong check type for return status information";
143  const std::string wrongFetchType = "Wrong fetch type for get data request";
144  const std::string wrongAlgorithmType = "Wrong algorithm type for terminate task request";
145  const std::string badCommandParams = "Bad command params";
146  const std::string badTaskId = "Bad task ID";
147  const std::string dataNotRange = "Task Id not in range";
148  const std::string searchTask = "Search task fail";
149  const std::string cancelTask = "Cancel task fail";
150  const std::string invalidPidProcess = "Invalid pid process";
151  const std::string readDataFile = "Read data file fail";
152  const std::string errorExecuteNotification = "Error execute notification";
153 
154  const std::string taskContinuesToRun = "Task continues to run";
155  const std::string taskNotFound = "Task not found";
156  const std::string taskDataNotFound = "Task data not found";
157  const std::string processWasNotStopped = "Process wasn't stopped";
158  const std::string changeState = "Change state";
159  const std::string taskTimeExpired = "Task's time expired";
160  const std::string taskCanceled = "Task canceled";
161  const std::string exceededCpuLoad = "Exceeded max allowed value of CPU load";
162  const std::string exceededIOWaitLoad = "Exceeded max allowed value of iowait load";
163  const std::string presentLoading = "Present loading is";
164  const std::string exceededDiskSpace = "Exceeded min size of disk space";
165  const std::string usage = "Usage";
166  const std::string free = "Free";
167  const std::string bytes = "bytes";
168  const std::string percents = "percents";
169  const std::string exceededResourceRAM = "Exceeded min size of resource RAM";
170  const std::string exceededVirtualRAM = "Exceeded min size of virtual RAM";
171  const std::string exceededProcessesCount = "Exceeded max number of processes.";
172  const std::string exceededThreadsCount = "Exceeded max number of threads";
173  const std::string exceededUsageIOWaitLoad = "Exceeded max allowed value of iowait load during execution";
174  const std::string exceededUsageVirtualRAM = "Exceeded max allowed value of virtual RAM usage during execution";
175  const std::string exceededUsageResourceRAM = "Exceeded max allowed value of resource RAM usage during execution";
176  const std::string exceededUsageDiskSpace = "Exceeded max allowed value of disk space usage during execution";
177  const std::string cleanupBadFlag = "Operation cleanup has bad flag";
178  const std::string pid = "PID";
179  const std::string subtaskExecutionError = "Subtask execution error";
180  const std::string startCleanupTaskError = "Start cleanup task error";
181  const std::string emptyFileContent = "Empty file content";
182  const std::string getCurrentTasksQueueError = "Get current tasks queue error";
183  const std::string getListAllTasksError = "Get list all tasks error";
184  const std::string getResourceUsageError = "Get resource usage error";
185  const std::string taskBusy = "Task is busy";
186 
187  const std::string targetClientsNotAvailable = "No target node clients available";
188  const std::string nodeNotSupported = "Node mode not supported";
189  const std::string nodeHasNotEnoughResources = "Chosen node has not enough resources for usage";
190 
191  const std::string dataFileIsEmpty = "Read empty data file";
192  const std::string setEnvironmentError = "Set mandatory environment error";
193  const std::string dumpResourceMonitorFail = "Dump of resource monitor failed";
194  const std::string restoreResourceMonitorFail = "Restore of resource monitor failed";
195 
196 
197  const std::vector<std::pair<unsigned int, std::string> > messages =
198  {
207  { ERROR, error },
208  { ERROR_MSG, errorMsg },
209  { ERROR_CODE, errorCode },
210  { COMMAND, command },
212  { READ_FILE, readFileFail },
232  { BAD_TASK_ID, badTaskId },
234  { SEARCH_TASK, searchTask },
235  { CANCEL_TASK, cancelTask },
247  { USAGE, usage },
248  { FREE, free },
249  { BYTES, bytes },
250  { PERCENTS, percents },
260  { PID, pid },
267  { TASK_BUSY , taskBusy },
274  };
275 //-----------------------------------------------------------------------------
276 } // end namespace message_const
277 //-----------------------------------------------------------------------------
278 //-----------------------------------------------------------------------------
279 namespace drce_const
280 {
281  // constants use in functional object
282  const std::string moduleName = "DRCE"; // for init LoggerStream
283  const std::string dataFileExt = "data";
284  const std::string requestFileExt = "req";
285  const std::string dumpFileName = "queue.dump";
286  // list names use for resource usage array
287  const std::string taskPrefix = "TASK_";
288  const std::string hostPrefix = "HOST_";
289 
290  const std::string cpu = "CPU";
291  const std::string iowait = "IOWAIT";
292  const std::string vram = "VRAM";
293  const std::string rram = "RRAM";
294  const std::string disk = "DISK";
295  const std::string processes = "PROCESSES";
296  const std::string threads = "THREADS";
297  const std::string loadavg = "LOADAVG";
298 
299  const std::string taskCpu = taskPrefix+cpu; // "TASK_CPU"
300  const std::string taskVram = taskPrefix+vram; // "TASK_VRAM"
301  const std::string taskRram = taskPrefix+rram; // "TASK_RRAM"
302  const std::string taskThreads = taskPrefix+threads; // "TASK_THREADS"
303  const std::string hostCpu = hostPrefix+cpu; // "HOST_CPU"
304  const std::string hostIowait = hostPrefix+iowait; // "HOST_IOWAIT"
305  const std::string hostVram = hostPrefix+vram; // "HOST_VRAM"
306  const std::string hostRram = hostPrefix+rram; // "HOST_RRAM"
307  const std::string hostDisk = hostPrefix+disk; // "HOST_DISK"
308  const std::string hostProcesses = hostPrefix+processes; // "HOST_PROCESSES"
309  const std::string hostThreads = hostPrefix+threads; // "HOST_THREADS"
310  const std::string hostLoadAverage = hostPrefix+loadavg; // "HOST_LOADAVG"
311  // constants of logger for tasks queue log
312  const std::string DRCE_TASKS_LOGGER = "DRCEFO-Tasks";
313  const std::string DRCE_TASKS_LOGGER_DELIMITER = " - ";
314  const std::string DRCE_TASKS_LOGGER_CREATED = "C";
315  const std::string DRCE_TASKS_LOGGER_DELETED = "D";
316  // constants of exit status
317  const unsigned int EXIT_STATUS_BASE = 128;
318  const unsigned int REPEAT_TRY_READ_DATA_FILE = 5;
319 } // end namespace drce_const
320 //-----------------------------------------------------------------------------
321 //-----------------------------------------------------------------------------
322 } // end namespace drce
323 } // end namespace HCE
324 
325 #endif // DRCE_MESSAGE_CONST_HPP