00001
00002
00003
00004
00005 #ifndef windows_platform
00006
00007 #include <sys/types.h>
00008 #include <sys/wait.h>
00009 #endif
00010 #include "reServerLib.h"
00011 #if 0
00012 #include "resource.h"
00013 #include "collection.h"
00014 #include "specColl.h"
00015 #include "modDataObjMeta.h"
00016 #endif
00017 #include "ruleExecSubmit.h"
00018 #include "ruleExecDel.h"
00019 #include "genQuery.h"
00020 #include "icatHighLevelRoutines.h"
00021 #include "reSysDataObjOpr.h"
00022 #include "miscUtil.h"
00023 #include "rodsClient.h"
00024 #include "rsIcatOpr.h"
00025 #include "resource.h"
00026
00027 int
00028 getReInfo (rsComm_t *rsComm, genQueryOut_t **genQueryOut)
00029 {
00030 genQueryInp_t genQueryInp;
00031 int status;
00032
00033 *genQueryOut = NULL;
00034 memset (&genQueryInp, 0, sizeof (genQueryInp_t));
00035
00036
00037 addInxIval (&genQueryInp.selectInp, COL_RULE_EXEC_ID, ORDER_BY);
00038 addInxIval (&genQueryInp.selectInp, COL_RULE_EXEC_NAME, 1);
00039 addInxIval (&genQueryInp.selectInp, COL_RULE_EXEC_REI_FILE_PATH, 1);
00040 addInxIval (&genQueryInp.selectInp, COL_RULE_EXEC_USER_NAME, 1);
00041 addInxIval (&genQueryInp.selectInp, COL_RULE_EXEC_ADDRESS, 1);
00042 addInxIval (&genQueryInp.selectInp, COL_RULE_EXEC_TIME, 1);
00043 addInxIval (&genQueryInp.selectInp, COL_RULE_EXEC_FREQUENCY, 1);
00044 addInxIval (&genQueryInp.selectInp, COL_RULE_EXEC_PRIORITY, 1);
00045 addInxIval (&genQueryInp.selectInp, COL_RULE_EXEC_ESTIMATED_EXE_TIME, 1);
00046 addInxIval (&genQueryInp.selectInp, COL_RULE_EXEC_NOTIFICATION_ADDR, 1);
00047 addInxIval (&genQueryInp.selectInp, COL_RULE_EXEC_LAST_EXE_TIME, 1);
00048 addInxIval (&genQueryInp.selectInp, COL_RULE_EXEC_STATUS, 1);
00049
00050 genQueryInp.maxRows = MAX_SQL_ROWS;
00051
00052 status = rsGenQuery (rsComm, &genQueryInp, genQueryOut);
00053
00054 if (status >= 0) svrCloseQueryOut (rsComm, *genQueryOut);
00055 clearGenQueryInp (&genQueryInp);
00056
00057 if (*genQueryOut != NULL) {
00058 if (status < 0) {
00059 free (*genQueryOut);
00060 *genQueryOut = NULL;
00061 } else {
00062 svrCloseQueryOut (rsComm, *genQueryOut);
00063 }
00064 }
00065 return (status);
00066 }
00067
00068 int
00069 getReInfoById (rsComm_t *rsComm, char *ruleExecId, genQueryOut_t **genQueryOut)
00070 {
00071 genQueryInp_t genQueryInp;
00072 char tmpStr[NAME_LEN];
00073 int status;
00074
00075 memset (&genQueryInp, 0, sizeof (genQueryInp_t));
00076
00077 addInxIval (&genQueryInp.selectInp, COL_RULE_EXEC_ID, 1);
00078 addInxIval (&genQueryInp.selectInp, COL_RULE_EXEC_NAME, 1);
00079 addInxIval (&genQueryInp.selectInp, COL_RULE_EXEC_REI_FILE_PATH, 1);
00080 addInxIval (&genQueryInp.selectInp, COL_RULE_EXEC_USER_NAME, 1);
00081 addInxIval (&genQueryInp.selectInp, COL_RULE_EXEC_ADDRESS, 1);
00082 addInxIval (&genQueryInp.selectInp, COL_RULE_EXEC_TIME, 1);
00083 addInxIval (&genQueryInp.selectInp, COL_RULE_EXEC_FREQUENCY, 1);
00084 addInxIval (&genQueryInp.selectInp, COL_RULE_EXEC_PRIORITY, 1);
00085 addInxIval (&genQueryInp.selectInp, COL_RULE_EXEC_ESTIMATED_EXE_TIME, 1);
00086 addInxIval (&genQueryInp.selectInp, COL_RULE_EXEC_NOTIFICATION_ADDR, 1);
00087 addInxIval (&genQueryInp.selectInp, COL_RULE_EXEC_LAST_EXE_TIME, 1);
00088 addInxIval (&genQueryInp.selectInp, COL_RULE_EXEC_STATUS, 1);
00089
00090 snprintf (tmpStr, NAME_LEN, "='%s'", ruleExecId);
00091 addInxVal (&genQueryInp.sqlCondInp, COL_RULE_EXEC_ID, tmpStr);
00092
00093 genQueryInp.maxRows = MAX_SQL_ROWS;
00094
00095 status = rsGenQuery (rsComm, &genQueryInp, genQueryOut);
00096
00097 clearGenQueryInp (&genQueryInp);
00098
00099 return (status);
00100 }
00101
00102
00103
00104
00105
00106
00107 int
00108 getNextQueuedRuleExec (rsComm_t *rsComm, genQueryOut_t **inGenQueryOut,
00109 int startInx, ruleExecSubmitInp_t *queuedRuleExec,
00110 reExec_t *reExec, int jobType)
00111 {
00112 sqlResult_t *ruleExecId, *ruleName, *reiFilePath, *userName, *exeAddress,
00113 *exeTime, *exeFrequency, *priority, *lastExecTime, *exeStatus,
00114 *estimateExeTime, *notificationAddr;
00115 int i, status;
00116 genQueryOut_t *genQueryOut;
00117
00118 if (inGenQueryOut == NULL || *inGenQueryOut == NULL ||
00119 queuedRuleExec == NULL || queuedRuleExec->packedReiAndArgBBuf == NULL ||
00120 queuedRuleExec->packedReiAndArgBBuf->buf == NULL) {
00121 rodsLog (LOG_ERROR,
00122 "getNextQueuedRuleExec: NULL input");
00123 return (SYS_INTERNAL_NULL_INPUT_ERR);
00124 }
00125
00126 genQueryOut = *inGenQueryOut;
00127 if ((ruleExecId = getSqlResultByInx (genQueryOut,
00128 COL_RULE_EXEC_ID)) == NULL) {
00129 rodsLog (LOG_NOTICE,
00130 "getNextQueuedRuleExec: getSqlResultByInx for EXEC_ID failed");
00131 return (UNMATCHED_KEY_OR_INDEX);
00132 }
00133 if ((ruleName = getSqlResultByInx (genQueryOut,
00134 COL_RULE_EXEC_NAME)) == NULL) {
00135 rodsLog (LOG_NOTICE,
00136 "getNextQueuedRuleExec: getSqlResultByInx for EXEC_NAME failed");
00137 return (UNMATCHED_KEY_OR_INDEX);
00138 }
00139 if ((reiFilePath = getSqlResultByInx (genQueryOut,
00140 COL_RULE_EXEC_REI_FILE_PATH)) == NULL) {
00141 rodsLog (LOG_NOTICE,
00142 "getNextQueuedRuleExec: getSqlResultByInx for REI_FILE_PATH failed");
00143 return (UNMATCHED_KEY_OR_INDEX);
00144 }
00145 if ((userName = getSqlResultByInx (genQueryOut,
00146 COL_RULE_EXEC_USER_NAME)) == NULL) {
00147 rodsLog (LOG_NOTICE,
00148 "getNextQueuedRuleExec: getSqlResultByInx for USER_NAME failed");
00149 return (UNMATCHED_KEY_OR_INDEX);
00150 }
00151 if ((exeAddress = getSqlResultByInx (genQueryOut,
00152 COL_RULE_EXEC_ADDRESS)) == NULL) {
00153 rodsLog (LOG_NOTICE,
00154 "getNextQueuedRuleExec: getSqlResultByInx for EXEC_ADDRESS failed");
00155 return (UNMATCHED_KEY_OR_INDEX);
00156 }
00157 if ((exeTime = getSqlResultByInx (genQueryOut,
00158 COL_RULE_EXEC_TIME)) == NULL) {
00159 rodsLog (LOG_NOTICE,
00160 "getNextQueuedRuleExec: getSqlResultByInx for EXEC_TIME failed");
00161 return (UNMATCHED_KEY_OR_INDEX);
00162 }
00163 if ((exeFrequency = getSqlResultByInx (genQueryOut,
00164 COL_RULE_EXEC_FREQUENCY)) == NULL) {
00165 rodsLog (LOG_NOTICE,
00166 "getNextQueuedRuleExec:getResultByInx for RULE_EXEC_FREQUENCY failed");
00167 return (UNMATCHED_KEY_OR_INDEX);
00168 }
00169 if ((priority = getSqlResultByInx (genQueryOut,
00170 COL_RULE_EXEC_PRIORITY)) == NULL) {
00171 rodsLog (LOG_NOTICE,
00172 "getNextQueuedRuleExec: getSqlResultByInx for PRIORITY failed");
00173 return (UNMATCHED_KEY_OR_INDEX);
00174 }
00175 if ((lastExecTime = getSqlResultByInx (genQueryOut,
00176 COL_RULE_EXEC_LAST_EXE_TIME)) == NULL) {
00177 rodsLog (LOG_NOTICE,
00178 "getNextQueuedRuleExec: getSqlResultByInx for LAST_EXE_TIME failed");
00179 return (UNMATCHED_KEY_OR_INDEX);
00180 }
00181 if ((exeStatus = getSqlResultByInx (genQueryOut,
00182 COL_RULE_EXEC_STATUS)) == NULL) {
00183 rodsLog (LOG_NOTICE,
00184 "getNextQueuedRuleExec: getSqlResultByInx for EXEC_STATUS failed");
00185 return (UNMATCHED_KEY_OR_INDEX);
00186 }
00187 if ((estimateExeTime = getSqlResultByInx (genQueryOut,
00188 COL_RULE_EXEC_ESTIMATED_EXE_TIME)) == NULL) {
00189 rodsLog (LOG_NOTICE,
00190 "getNextQueuedRuleExec: getResultByInx for ESTIMATED_EXE_TIME failed");
00191 return (UNMATCHED_KEY_OR_INDEX);
00192 }
00193 if ((notificationAddr = getSqlResultByInx (genQueryOut,
00194 COL_RULE_EXEC_NOTIFICATION_ADDR)) == NULL) {
00195 rodsLog (LOG_NOTICE,
00196 "getNextQueuedRuleExec:getResultByInx for NOTIFICATION_ADDR failed");
00197 return (UNMATCHED_KEY_OR_INDEX);
00198 }
00199
00200 for (i = startInx; i < genQueryOut->rowCnt; i++) {
00201 char *exeStatusStr, *exeTimeStr, *ruleExecIdStr;
00202 #if 0
00203 struct stat statbuf;
00204 int fd;
00205 #endif
00206
00207
00208 exeStatusStr = &exeStatus->value[exeStatus->len * i];
00209 exeTimeStr = &exeTime->value[exeTime->len * i];
00210 ruleExecIdStr = &ruleExecId->value[ruleExecId->len * i];
00211
00212 if ((jobType & RE_FAILED_STATUS) == 0 &&
00213 strcmp (exeStatusStr, RE_FAILED) == 0) {
00214
00215 continue;
00216 } else if (atoi (exeTimeStr) > time (0)) {
00217
00218 continue;
00219 } else if (strcmp (exeStatusStr, RE_RUNNING) == 0) {
00220
00221 if (reExec->doFork == 1 &&
00222 matchRuleExecId (reExec, ruleExecIdStr, RE_PROC_RUNNING)) {
00223
00224 continue;
00225 } else {
00226 rodsLog (LOG_NOTICE,
00227 "getNextQueuedRuleExec: reId %s in RUNNING state. Run again",
00228 ruleExecIdStr);
00229 }
00230 }
00231 #if 0
00232 rstrcpy (queuedRuleExec->reiFilePath,
00233 &reiFilePath->value[reiFilePath->len * i], MAX_NAME_LEN);
00234 if (stat (queuedRuleExec->reiFilePath, &statbuf) < 0) {
00235 status = UNIX_FILE_STAT_ERR - errno;
00236 rodsLog (LOG_ERROR,
00237 "getNextQueuedRuleExec: stat error for rei file %s, status = %d",
00238 queuedRuleExec->reiFilePath, status);
00239 continue;
00240 }
00241
00242 if (statbuf.st_size > queuedRuleExec->packedReiAndArgBBuf->len) {
00243 free (queuedRuleExec->packedReiAndArgBBuf->buf);
00244 queuedRuleExec->packedReiAndArgBBuf->buf =
00245 malloc ((int) statbuf.st_size);
00246 queuedRuleExec->packedReiAndArgBBuf->len = statbuf.st_size;
00247 }
00248
00249 fd = open (queuedRuleExec->reiFilePath, O_RDONLY,0);
00250 if (fd < 0) {
00251 status = UNIX_FILE_OPEN_ERR - errno;
00252 rodsLog (LOG_ERROR,
00253 "getNextQueuedRuleExec: open error for rei file %s, status = %d",
00254 queuedRuleExec->reiFilePath, status);
00255 return (status);
00256 }
00257
00258 status = read (fd, queuedRuleExec->packedReiAndArgBBuf->buf,
00259 queuedRuleExec->packedReiAndArgBBuf->len);
00260
00261 close (fd);
00262 if (status != statbuf.st_size) {
00263 if (status < 0) {
00264 status = UNIX_FILE_READ_ERR - errno;
00265 rodsLog (LOG_ERROR,
00266 "getNextQueuedRuleExec: read error for file %s, status = %d",
00267 queuedRuleExec->reiFilePath, status);
00268 } else {
00269 rodsLog (LOG_ERROR,
00270 "getNextQueuedRuleExec:read error for %s,toRead %d, read %d",
00271 queuedRuleExec->reiFilePath,
00272 queuedRuleExec->packedReiAndArgBBuf->len, status);
00273 return (SYS_COPY_LEN_ERR);
00274 }
00275 }
00276
00277 rstrcpy (queuedRuleExec->exeTime, exeTimeStr, NAME_LEN);
00278 rstrcpy (queuedRuleExec->exeStatus, exeStatusStr, NAME_LEN);
00279 rstrcpy (queuedRuleExec->ruleExecId, ruleExecIdStr, NAME_LEN);
00280
00281 rstrcpy (queuedRuleExec->ruleName,
00282 &ruleName->value[ruleName->len * i], META_STR_LEN);
00283 rstrcpy (queuedRuleExec->userName,
00284 &userName->value[userName->len * i], NAME_LEN);
00285 rstrcpy (queuedRuleExec->exeAddress,
00286 &exeAddress->value[exeAddress->len * i], NAME_LEN);
00287 rstrcpy (queuedRuleExec->exeFrequency,
00288 &exeFrequency->value[exeFrequency->len * i], NAME_LEN);
00289 rstrcpy (queuedRuleExec->priority,
00290 &priority->value[priority->len * i], NAME_LEN);
00291 rstrcpy (queuedRuleExec->estimateExeTime,
00292 &estimateExeTime->value[estimateExeTime->len * i], NAME_LEN);
00293 rstrcpy (queuedRuleExec->notificationAddr,
00294 ¬ificationAddr->value[notificationAddr->len * i], NAME_LEN);
00295 #else
00296 status = fillExecSubmitInp (queuedRuleExec, exeStatusStr, exeTimeStr,
00297 ruleExecIdStr,
00298 &reiFilePath->value[reiFilePath->len * i],
00299 &ruleName->value[ruleName->len * i],
00300 &userName->value[userName->len * i],
00301 &exeAddress->value[exeAddress->len * i],
00302 &exeFrequency->value[exeFrequency->len * i],
00303 &priority->value[priority->len * i],
00304 &estimateExeTime->value[estimateExeTime->len * i],
00305 ¬ificationAddr->value[notificationAddr->len * i]);
00306 if (status < 0) continue;
00307 #endif
00308 return (i);
00309 }
00310 return (-1);
00311 }
00312
00313 int
00314 modExeInfoForRepeat(rsComm_t *rsComm, char *ruleExecId, char* pastTime,
00315 char *delay, int opStatus) {
00316 keyValPair_t *regParam;
00317 int status, status1;
00318 char myTimeNow[200];
00319 char myTimeNext[200];
00320 ruleExecModInp_t ruleExecModInp;
00321 ruleExecDelInp_t ruleExecDelInp;
00322
00323 if (opStatus > 0) opStatus = 0;
00324
00325 rstrcpy (myTimeNext, pastTime, 200);
00326 getOffsetTimeStr((char*)&myTimeNow, " ");
00327
00328 status1 = getNextRepeatTime(myTimeNow, delay,myTimeNext);
00329
00330
00331
00332
00333
00334
00335
00336 rodsLog (LOG_NOTICE,"modExeInfoForRepeat: rulId=%s,opStatus=%d,nextRepeatStatus=%d",ruleExecId,opStatus,status1);
00337 regParam = &(ruleExecModInp.condInput);
00338 rstrcpy (ruleExecModInp.ruleId, ruleExecId, NAME_LEN);
00339 memset (regParam, 0, sizeof (keyValPair_t));
00340 if (status1 == 0) {
00341 addKeyVal (regParam, RULE_EXE_STATUS_KW, "");
00342 addKeyVal (regParam, RULE_LAST_EXE_TIME_KW, myTimeNow);
00343 addKeyVal (regParam, RULE_EXE_TIME_KW, myTimeNext);
00344 status = rsRuleExecMod(rsComm, &ruleExecModInp);
00345 }
00346 else if (status1 == 1) {
00347 if (opStatus == 0) {
00348
00349 rstrcpy (ruleExecDelInp.ruleExecId, ruleExecId, NAME_LEN);
00350 status = rsRuleExecDel (rsComm, &ruleExecDelInp);
00351 }
00352 else {
00353 addKeyVal (regParam, RULE_EXE_STATUS_KW, "");
00354 addKeyVal (regParam, RULE_LAST_EXE_TIME_KW, myTimeNow);
00355 addKeyVal (regParam, RULE_EXE_TIME_KW, myTimeNext);
00356 status = rsRuleExecMod(rsComm, &ruleExecModInp);
00357 }
00358 }
00359 else if (status1 == 2 ) {
00360
00361 rstrcpy (ruleExecDelInp.ruleExecId, ruleExecId, NAME_LEN);
00362 status = rsRuleExecDel (rsComm, &ruleExecDelInp);
00363 }
00364 else if (status1 == 3 ) {
00365 addKeyVal (regParam, RULE_EXE_STATUS_KW, "");
00366 addKeyVal (regParam, RULE_LAST_EXE_TIME_KW, myTimeNow);
00367 addKeyVal (regParam, RULE_EXE_TIME_KW, myTimeNext);
00368 addKeyVal (regParam, RULE_EXE_FREQUENCY_KW,delay);
00369 status = rsRuleExecMod(rsComm, &ruleExecModInp);
00370 }
00371 else if (status1 == 4 ) {
00372 if (opStatus == 0) {
00373
00374 rstrcpy (ruleExecDelInp.ruleExecId, ruleExecId, NAME_LEN);
00375 status = rsRuleExecDel (rsComm, &ruleExecDelInp);
00376 }
00377 else {
00378 addKeyVal (regParam, RULE_EXE_STATUS_KW, "");
00379 addKeyVal (regParam, RULE_LAST_EXE_TIME_KW, myTimeNow);
00380 addKeyVal (regParam, RULE_EXE_TIME_KW, myTimeNext);
00381 addKeyVal (regParam, RULE_EXE_FREQUENCY_KW,delay);
00382 status = rsRuleExecMod(rsComm, &ruleExecModInp);
00383 }
00384 }
00385 if (regParam->len > 0)
00386 clearKeyVal (regParam);
00387
00388 if (status < 0) {
00389 rodsLog (LOG_ERROR,
00390 "modExeInfoForRepeat: rsRuleExecMod/rsRuleExecDel Error of id %s failed, status = %d",
00391 ruleExecId, status);
00392 }
00393 else {
00394 if (status1 == 3 || (status1 != 2 && opStatus != 0))
00395 rodsLog (LOG_NOTICE,
00396 "Rule id %s set to run again at %s (frequency %s seconds)",
00397 ruleExecId, myTimeNext, delay);
00398 }
00399
00400 return (status);
00401 }
00402
00403 int
00404 regExeStatus (rsComm_t *rsComm, char *ruleExecId, char *exeStatus)
00405 {
00406 keyValPair_t *regParam;
00407 ruleExecModInp_t ruleExecModInp;
00408 int status;
00409
00410 regParam = &(ruleExecModInp.condInput);
00411 memset (regParam, 0, sizeof (keyValPair_t));
00412 rstrcpy (ruleExecModInp.ruleId, ruleExecId, NAME_LEN);
00413 addKeyVal (regParam, RULE_EXE_STATUS_KW, exeStatus);
00414 status = rsRuleExecMod(rsComm, &ruleExecModInp);
00415
00416
00417 clearKeyVal (regParam);
00418
00419 if (status < 0) {
00420 rodsLog (LOG_ERROR,
00421 "regExeStatus: rsRuleExecMod of id %s failed, status = %d",
00422 ruleExecId, status);
00423 }
00424
00425 return (status);
00426 }
00427
00428
00429
00430
00431
00432
00433
00434 int
00435 runQueuedRuleExec (rsComm_t *rsComm, reExec_t *reExec,
00436 genQueryOut_t **genQueryOut, time_t endTime, int jobType)
00437 {
00438 int inx, status;
00439 ruleExecSubmitInp_t *myRuleExecInp;
00440 int runCnt = 0;
00441 int thrInx;
00442
00443 inx = -1;
00444 while (time(NULL) <= endTime && (thrInx = allocReThr (rsComm, reExec)) >= 0) {
00445 myRuleExecInp = &reExec->reExecProc[thrInx].ruleExecSubmitInp;
00446 chkAndUpdateResc (rsComm);
00447 if ((inx = getNextQueuedRuleExec (rsComm, genQueryOut, inx + 1,
00448 myRuleExecInp, reExec, jobType)) < 0) {
00449
00450 freeReThr (reExec, thrInx);
00451 break;
00452 } else {
00453 reExec->reExecProc[thrInx].jobType = jobType;
00454 }
00455
00456
00457 status = regExeStatus (rsComm, myRuleExecInp->ruleExecId,
00458 RE_RUNNING);
00459 if (status < 0) {
00460 rodsLog (LOG_ERROR,
00461 "runQueuedRuleExec: regExeStatus of id %s failed,stat = %d",
00462 myRuleExecInp->ruleExecId, status);
00463 freeReThr (reExec, thrInx);
00464 continue;
00465 }
00466
00467 runCnt ++;
00468 if (reExec->doFork == 0) {
00469
00470 status = execRuleExec (&reExec->reExecProc[thrInx]);
00471 postProcRunRuleExec (rsComm, &reExec->reExecProc[thrInx]);
00472 freeReThr (reExec, thrInx);
00473 continue;
00474 } else {
00475 #ifdef RE_EXEC_PROC
00476 if ((reExec->reExecProc[thrInx].pid = fork()) == 0) {
00477
00478
00479 if ((status = resetRcatHost (rsComm, MASTER_RCAT,
00480 rsComm->myEnv.rodsZone)) == LOCAL_HOST) {
00481 #ifdef RODS_CAT
00482 resetRcat (rsComm);
00483 #endif
00484 }
00485
00486 execRuleExec (&reExec->reExecProc[thrInx]);
00487 #else
00488 if ((reExec->reExecProc[thrInx].pid = fork()) == 0) {
00489 status = postForkExecProc (rsComm,
00490 &reExec->reExecProc[thrInx]);
00491 if (status >= 0) {
00492 exit (0);
00493 } else {
00494 exit (1);
00495 }
00496 #endif
00497 } else {
00498 #ifdef RE_SERVER_DEBUG
00499 rodsLog (LOG_NOTICE,
00500 "runQueuedRuleExec: started proc %d, thrInx %d",
00501 reExec->reExecProc[thrInx].pid, thrInx);
00502 #endif
00503
00504 reExec->runCnt++;
00505 continue;
00506 }
00507 }
00508 }
00509 if (reExec->doFork == 1) {
00510
00511 while (reExec->runCnt + 1 >= reExec->maxRunCnt &&
00512 waitAndFreeReThr (rsComm, reExec) >= 0);
00513 }
00514
00515 return (runCnt);
00516 }
00517
00518 int
00519 postForkExecProc (rsComm_t *rsComm, reExecProc_t *reExecProc)
00520 {
00521 int status;
00522
00523
00524 rodsServerHost_t *rodsServerHost = NULL;
00525
00526 if ((status = resetRcatHost (rsComm, MASTER_RCAT, rsComm->myEnv.rodsZone))
00527 == LOCAL_HOST) {
00528 #ifdef RODS_CAT
00529 resetRcat (rsComm);
00530 #endif
00531 }
00532 if ((status = getAndConnRcatHost (rsComm, MASTER_RCAT,
00533 rsComm->myEnv.rodsZone, &rodsServerHost)) == LOCAL_HOST) {
00534 #ifdef RODS_CAT
00535 status = connectRcat (rsComm);
00536 if (status < 0) {
00537 rodsLog (LOG_ERROR,
00538 "runQueuedRuleExec: connectRcat error. status=%d", status);
00539 }
00540 #endif
00541 }
00542 seedRandom ();
00543 status = runRuleExec (reExecProc);
00544 postProcRunRuleExec (rsComm, reExecProc);
00545 #ifdef RE_SERVER_DEBUG
00546 rodsLog (LOG_NOTICE,
00547 "runQueuedRuleExec: process %d exiting", getpid ());
00548 #endif
00549 return (reExecProc->status);
00550 }
00551
00552 int
00553 execRuleExec (reExecProc_t *reExecProc)
00554 {
00555 int status;
00556 char *av[NAME_LEN];
00557 int avInx = 0;
00558
00559
00560 av[avInx] = strdup (RE_EXE);
00561 avInx++;
00562 av[avInx] = strdup ("-j");
00563 avInx++;
00564 av[avInx] = strdup (reExecProc->ruleExecSubmitInp.ruleExecId);
00565 avInx++;
00566 av[avInx] = strdup ("-t");
00567 avInx++;
00568 av[avInx] = (char*)malloc (sizeof (int) * 2);
00569 sprintf (av[avInx], "%d", reExecProc->jobType);
00570 avInx++;
00571 av[avInx] = NULL;
00572
00573 status = execv (av[0], av);
00574 if (status < 0) {
00575 rodsLog (LOG_ERROR,
00576 "execExecProc: execv of ID %s error, errno = %d",
00577 reExecProc->ruleExecSubmitInp.ruleExecId, errno);
00578 }
00579 return status;
00580 }
00581
00582 #ifndef windows_platform
00583 int
00584 initReExec (rsComm_t *rsComm, reExec_t *reExec)
00585 {
00586 int i;
00587 ruleExecInfo_t rei;
00588 int status;
00589
00590 if (reExec == NULL) return SYS_INTERNAL_NULL_INPUT_ERR;
00591
00592 bzero (reExec, sizeof (reExec_t));
00593 bzero (&rei, sizeof (ruleExecInfo_t));
00594
00595 rei.rsComm = rsComm;
00596 status = applyRule ("acSetReServerNumProc", NULL, &rei, NO_SAVE_REI);
00597 if (status < 0) {
00598 rodsLog (LOG_ERROR,
00599 "initReExec: rule acSetReServerNumProc error, status = %d",
00600 status);
00601 reExec->maxRunCnt = 1;
00602 reExec->doFork = 0;
00603 } else {
00604 reExec->maxRunCnt = rei.status;
00605 if (reExec->maxRunCnt <= 0) {
00606 reExec->maxRunCnt = 1;
00607 reExec->doFork = 0;
00608 } else {
00609 if (reExec->maxRunCnt > MAX_RE_PROCS)
00610 reExec->maxRunCnt = MAX_RE_PROCS;
00611 reExec->doFork = 1;
00612 }
00613 }
00614 for (i = 0; i < reExec->maxRunCnt; i++) {
00615 reExec->reExecProc[i].procExecState = RE_PROC_IDLE;
00616 reExec->reExecProc[i].ruleExecSubmitInp.packedReiAndArgBBuf =
00617 (bytesBuf_t *) malloc (sizeof (bytesBuf_t));
00618 reExec->reExecProc[i].ruleExecSubmitInp.packedReiAndArgBBuf->buf =
00619 malloc (REI_BUF_LEN);
00620 reExec->reExecProc[i].ruleExecSubmitInp.packedReiAndArgBBuf->len =
00621 REI_BUF_LEN;
00622
00623
00624 reExec->reExecProc[i].reComm.proxyUser = rsComm->proxyUser;
00625 reExec->reExecProc[i].reComm.myEnv = rsComm->myEnv;
00626 }
00627 return 0;
00628 }
00629
00630 int
00631 allocReThr (rsComm_t *rsComm, reExec_t *reExec)
00632 {
00633 int i;
00634 int thrInx = SYS_NO_FREE_RE_THREAD;
00635
00636 if (reExec == NULL) return SYS_INTERNAL_NULL_INPUT_ERR;
00637
00638 if (reExec->doFork == 0) {
00639
00640 reExec->runCnt = 1;
00641 return 0;
00642 }
00643
00644 reExec->runCnt = 0;
00645 for (i = 0; i < reExec->maxRunCnt; i++) {
00646 if (reExec->reExecProc[i].procExecState == RE_PROC_IDLE) {
00647 if (thrInx == SYS_NO_FREE_RE_THREAD) {
00648 thrInx = i;
00649 }
00650 } else {
00651 reExec->runCnt++;
00652 }
00653 }
00654 if (thrInx == SYS_NO_FREE_RE_THREAD) {
00655 thrInx = waitAndFreeReThr (rsComm, reExec);
00656 }
00657 if (thrInx >= 0)
00658 reExec->reExecProc[thrInx].procExecState = RE_PROC_RUNNING;
00659
00660 return (thrInx);
00661 }
00662
00663 int
00664 waitAndFreeReThr (rsComm_t *rsComm, reExec_t *reExec)
00665 {
00666 pid_t childPid;
00667 int status = 0;
00668 int thrInx = SYS_NO_FREE_RE_THREAD;
00669
00670 childPid = waitpid (-1, &status, WUNTRACED);
00671 if (childPid < 0) {
00672 if (reExec->runCnt > 0) {
00673 int i;
00674 rodsLog (LOG_NOTICE,
00675 "waitAndFreeReThr: no outstanding child. but runCnt=%d",
00676 reExec->runCnt);
00677 for (i = 0; i < reExec->maxRunCnt; i++) {
00678 if (reExec->reExecProc[i].procExecState != RE_PROC_IDLE) {
00679 freeReThr (reExec, i);
00680 }
00681 }
00682 reExec->runCnt = 0;
00683 thrInx = 0;
00684 }
00685 } else {
00686 thrInx = matchPidInReExec (reExec, childPid);
00687
00688
00689 if (thrInx >= 0) {
00690 genQueryOut_t *genQueryOut = NULL;
00691 int status1;
00692 reExecProc_t *reExecProc = &reExec->reExecProc[thrInx];
00693 char *ruleExecId = reExecProc->ruleExecSubmitInp.ruleExecId;
00694
00695 status1 = getReInfoById (rsComm, ruleExecId, &genQueryOut);
00696 if (status1 >= 0) {
00697
00698
00699 freeGenQueryOut (&genQueryOut);
00700 if ((reExecProc->jobType & RE_FAILED_STATUS) == 0) {
00701
00702 regExeStatus (rsComm, ruleExecId, RE_FAILED);
00703 } else {
00704 ruleExecDelInp_t ruleExecDelInp;
00705 rodsLog (LOG_ERROR,
00706 "waitAndFreeReThr: %s executed but still in iCat. Job deleted",
00707 ruleExecId);
00708 rstrcpy (ruleExecDelInp.ruleExecId, ruleExecId, NAME_LEN);
00709 status = rsRuleExecDel (rsComm, &ruleExecDelInp);
00710 }
00711 }
00712 freeReThr (reExec, thrInx);
00713 }
00714
00715 }
00716 return thrInx;
00717 }
00718 #endif
00719
00720 int
00721 matchPidInReExec (reExec_t *reExec, pid_t pid)
00722 {
00723 int i;
00724
00725 for (i = 0; i < reExec->maxRunCnt; i++) {
00726 if (reExec->reExecProc[i].pid == pid) return i;
00727 }
00728 rodsLog (LOG_ERROR,
00729 "matchPidInReExec: no match for pid %d", pid);
00730
00731 return SYS_NO_FREE_RE_THREAD;
00732 }
00733
00734 int
00735 freeReThr (reExec_t *reExec, int thrInx)
00736 {
00737 bytesBuf_t *packedReiAndArgBBuf;
00738
00739 if( NULL == reExec ) {
00740 rodsLog( LOG_ERROR, "freeReThr :: NULL reExec ptr" );
00741 return SYS_INTERNAL_NULL_INPUT_ERR;
00742 }
00743 #ifdef RE_SERVER_DEBUG
00744 rodsLog (LOG_NOTICE,
00745 "freeReThr: thrInx %d, pid %d",thrInx, reExec->reExecProc[thrInx].pid);
00746 #endif
00747
00748 if (thrInx < 0 || thrInx >= reExec->maxRunCnt) {
00749 rodsLog (LOG_ERROR, "freeReThr: Bad input thrInx %d", thrInx);
00750 return (SYS_BAD_RE_THREAD_INX);
00751 }
00752 reExec->runCnt--;
00753 reExec->reExecProc[thrInx].procExecState = RE_PROC_IDLE;
00754 reExec->reExecProc[thrInx].status = 0;
00755 reExec->reExecProc[thrInx].jobType = 0;
00756 reExec->reExecProc[thrInx].pid = 0;
00757
00758 packedReiAndArgBBuf =
00759 reExec->reExecProc[thrInx].ruleExecSubmitInp.packedReiAndArgBBuf;
00760
00761 bzero (packedReiAndArgBBuf->buf, REI_BUF_LEN);
00762 bzero (&reExec->reExecProc[thrInx].ruleExecSubmitInp,
00763 sizeof (ruleExecSubmitInp_t));
00764 reExec->reExecProc[thrInx].ruleExecSubmitInp.packedReiAndArgBBuf =
00765 packedReiAndArgBBuf;
00766
00767 return 0;
00768 }
00769
00770 int
00771 runRuleExec (reExecProc_t *reExecProc)
00772 {
00773 ruleExecSubmitInp_t *myRuleExec;
00774 ruleExecInfoAndArg_t *reiAndArg = NULL;
00775 rsComm_t *reComm;
00776
00777 if (reExecProc == NULL) {
00778 rodsLog (LOG_ERROR, "runRuleExec: NULL reExecProc input");
00779
00780 return SYS_INTERNAL_NULL_INPUT_ERR;
00781 }
00782
00783 reComm = &reExecProc->reComm;
00784 myRuleExec = &reExecProc->ruleExecSubmitInp;
00785
00786 reExecProc->status = unpackReiAndArg (reComm, &reiAndArg,
00787 myRuleExec->packedReiAndArgBBuf);
00788
00789 if (reExecProc->status < 0 || NULL == reiAndArg ) {
00790 rodsLog (LOG_ERROR,
00791 "runRuleExec: unpackReiAndArg of id %s failed, status = %d",
00792 myRuleExec->ruleExecId, reExecProc->status);
00793 return reExecProc->status;
00794 }
00795
00796
00797 reExecProc->status = applyRule (myRuleExec->ruleName,
00798 reiAndArg->rei->msParamArray,
00799 reiAndArg->rei, SAVE_REI);
00800
00801 if (reiAndArg->rei->status < 0) {
00802 reExecProc->status = reiAndArg->rei->status;
00803 }
00804 freeRuleExecInfoStruct (reiAndArg->rei, FREE_MS_PARAM | FREE_DOINP);
00805 free (reiAndArg);
00806
00807 return reExecProc->status;
00808 }
00809
00810 int
00811 postProcRunRuleExec (rsComm_t *rsComm, reExecProc_t *reExecProc)
00812 {
00813 int status = 0;
00814 int savedStatus = 0;
00815 ruleExecDelInp_t ruleExecDelInp;
00816 ruleExecSubmitInp_t *myRuleExecInp;
00817
00818 myRuleExecInp = &reExecProc->ruleExecSubmitInp;
00819
00820 if (strlen (myRuleExecInp->exeFrequency) > 0 ) {
00821 rodsLog(LOG_NOTICE, "postProcRunRuleExec: exec of freq: %s",
00822 myRuleExecInp->exeFrequency);
00823
00824 savedStatus = modExeInfoForRepeat (rsComm, myRuleExecInp->ruleExecId,
00825 myRuleExecInp->exeTime, myRuleExecInp->exeFrequency,
00826 reExecProc->status);
00827 }
00828 else if (reExecProc->status < 0) {
00829 rodsLog (LOG_ERROR,
00830 "postProcRunRuleExec: ruleExec of id %s failed, status = %d",
00831 myRuleExecInp->ruleExecId, reExecProc->status);
00832 if ((reExecProc->jobType & RE_FAILED_STATUS) == 0) {
00833
00834 regExeStatus (rsComm, myRuleExecInp->ruleExecId, RE_FAILED);
00835 } else {
00836
00837
00838 rodsLog (LOG_ERROR,
00839 "postProcRunRuleExec: ruleExec of %s: %s failed again.Removed",
00840 myRuleExecInp->ruleExecId, myRuleExecInp->ruleName);
00841 rstrcpy (ruleExecDelInp.ruleExecId, myRuleExecInp->ruleExecId,
00842 NAME_LEN);
00843 status = rsRuleExecDel (rsComm, &ruleExecDelInp);
00844 if (status < 0) {
00845 rodsLog (LOG_ERROR,
00846 "postProcRunRuleExec: rsRuleExecDel failed for %s, stat=%d",
00847 myRuleExecInp->ruleExecId, status);
00848 }
00849 }
00850 } else {
00851 rstrcpy (ruleExecDelInp.ruleExecId, myRuleExecInp->ruleExecId,
00852 NAME_LEN);
00853 rodsLog (LOG_NOTICE,
00854 "postProcRunRuleExec: exec of %s done", myRuleExecInp->ruleExecId);
00855 status = rsRuleExecDel (rsComm, &ruleExecDelInp);
00856 if (status < 0) {
00857 rodsLog (LOG_ERROR,
00858 "postProcRunRuleExec: rsRuleExecDel failed for %s, status = %d",
00859 myRuleExecInp->ruleExecId, status);
00860 }
00861 }
00862 if (status >= 0 && savedStatus < 0) return savedStatus;
00863
00864 return status;
00865 }
00866
00867 int
00868 matchRuleExecId (reExec_t *reExec, char *ruleExecIdStr,
00869 procExecState_t execState)
00870 {
00871 int i;
00872
00873 if (reExec == NULL || ruleExecIdStr == NULL ||
00874 execState == RE_PROC_IDLE) return 0;
00875
00876 for (i = 0; i < reExec->maxRunCnt; i++) {
00877 if (reExec->reExecProc[i].procExecState == execState &&
00878 strcmp (reExec->reExecProc[i].ruleExecSubmitInp.ruleExecId,
00879 ruleExecIdStr) == 0) {
00880 return 1;
00881 }
00882 }
00883 return 0;
00884 }
00885
00886 int
00887 chkAndUpdateResc (rsComm_t *rsComm)
00888 {
00889 time_t curTime;
00890 int status;
00891
00892 curTime = time (NULL);
00893
00894 if (LastRescUpdateTime > curTime) {
00895 LastRescUpdateTime = curTime;
00896 return 0;
00897 }
00898
00899 if (curTime >= LastRescUpdateTime + RESC_UPDATE_TIME) {
00900 status = updateResc (rsComm);
00901 LastRescUpdateTime = curTime;
00902 return status;
00903 } else {
00904 return 0;
00905 }
00906 }
00907
00908 int
00909 fillExecSubmitInp (ruleExecSubmitInp_t *ruleExecSubmitInp, char *exeStatus,
00910 char *exeTime, char *ruleExecId, char *reiFilePath, char *ruleName,
00911 char *userName, char *exeAddress, char *exeFrequency, char *priority,
00912 char *estimateExeTime, char *notificationAddr)
00913 {
00914 int status;
00915 #ifndef USE_BOOST_FS
00916 struct stat statbuf;
00917 #endif
00918 int fd;
00919 rodsLong_t st_size;
00920
00921 rstrcpy (ruleExecSubmitInp->reiFilePath, reiFilePath, MAX_NAME_LEN);
00922 #ifdef USE_BOOST_FS
00923 path p (ruleExecSubmitInp->reiFilePath);
00924 if (!exists (p)) {
00925 #else
00926 if (stat (ruleExecSubmitInp->reiFilePath, &statbuf) < 0) {
00927 #endif
00928 status = UNIX_FILE_STAT_ERR - errno;
00929 rodsLogError (LOG_ERROR, status,
00930 "fillExecSubmitInp: stat error for rei file %s, id %s rule %s",
00931 ruleExecSubmitInp->reiFilePath, ruleExecId, ruleName);
00932
00933 return status;
00934 }
00935
00936 #ifdef USE_BOOST_FS
00937 st_size = file_size (p);
00938 #else
00939 st_size = statbuf.st_size;
00940 #endif
00941 if (st_size > ruleExecSubmitInp->packedReiAndArgBBuf->len) {
00942 if (ruleExecSubmitInp->packedReiAndArgBBuf->buf != NULL)
00943 free (ruleExecSubmitInp->packedReiAndArgBBuf->buf);
00944 ruleExecSubmitInp->packedReiAndArgBBuf->buf =
00945 malloc ((int) st_size);
00946 ruleExecSubmitInp->packedReiAndArgBBuf->len = st_size;
00947 }
00948
00949 fd = open (ruleExecSubmitInp->reiFilePath, O_RDONLY,0);
00950 if (fd < 0) {
00951 status = UNIX_FILE_OPEN_ERR - errno;
00952 rodsLog (LOG_ERROR,
00953 "fillExecSubmitInp: open error for rei file %s, status = %d",
00954 ruleExecSubmitInp->reiFilePath, status);
00955 return (status);
00956 }
00957
00958 status = read (fd, ruleExecSubmitInp->packedReiAndArgBBuf->buf,
00959 ruleExecSubmitInp->packedReiAndArgBBuf->len);
00960
00961 close (fd);
00962 if (status != (int) st_size) {
00963 if (status < 0) {
00964 status = UNIX_FILE_READ_ERR - errno;
00965 rodsLog (LOG_ERROR,
00966 "fillExecSubmitInp: read error for file %s, status = %d",
00967 ruleExecSubmitInp->reiFilePath, status);
00968 } else {
00969 rodsLog (LOG_ERROR,
00970 "fillExecSubmitInp:read error for %s,toRead %d, read %d",
00971 ruleExecSubmitInp->reiFilePath,
00972 ruleExecSubmitInp->packedReiAndArgBBuf->len, status);
00973 return (SYS_COPY_LEN_ERR);
00974 }
00975 }
00976
00977 rstrcpy (ruleExecSubmitInp->exeTime, exeTime, NAME_LEN);
00978 rstrcpy (ruleExecSubmitInp->exeStatus, exeStatus, NAME_LEN);
00979 rstrcpy (ruleExecSubmitInp->ruleExecId, ruleExecId, NAME_LEN);
00980
00981 rstrcpy (ruleExecSubmitInp->ruleName, ruleName, META_STR_LEN);
00982 rstrcpy (ruleExecSubmitInp->userName, userName, NAME_LEN);
00983 rstrcpy (ruleExecSubmitInp->exeAddress, exeAddress, NAME_LEN);
00984 rstrcpy (ruleExecSubmitInp->exeFrequency, exeFrequency, NAME_LEN);
00985 rstrcpy (ruleExecSubmitInp->priority, priority, NAME_LEN);
00986 rstrcpy (ruleExecSubmitInp->estimateExeTime, estimateExeTime, NAME_LEN);
00987 rstrcpy (ruleExecSubmitInp->notificationAddr, notificationAddr, NAME_LEN);
00988
00989 return 0;
00990 }
00991
00992 int
00993 reServerSingleExec (rsComm_t *rsComm, char *ruleExecId, int jobType)
00994 {
00995 reExecProc_t reExecProc;
00996 int status;
00997 sqlResult_t *ruleName, *reiFilePath, *userName, *exeAddress,
00998 *exeTime, *exeFrequency, *priority, *lastExecTime, *exeStatus,
00999 *estimateExeTime, *notificationAddr;
01000 genQueryOut_t *genQueryOut = NULL;
01001
01002 bzero (&reExecProc, sizeof (reExecProc));
01003
01004 reExecProc.reComm.proxyUser = rsComm->proxyUser;
01005 reExecProc.reComm.myEnv = rsComm->myEnv;
01006 reExecProc.ruleExecSubmitInp.packedReiAndArgBBuf =
01007 (bytesBuf_t *) calloc (1, sizeof (bytesBuf_t));
01008 reExecProc.procExecState = RE_PROC_RUNNING;
01009 reExecProc.jobType = jobType;
01010
01011 status = getReInfoById (rsComm, ruleExecId, &genQueryOut);
01012 if (status < 0) {
01013 rodsLog (LOG_ERROR,
01014 "reServerSingleExec: getReInfoById error for %s, status = %d",
01015 ruleExecId, status);
01016 return status;
01017 }
01018
01019 bzero (&reExecProc, sizeof (reExecProc));
01020
01021 reExecProc.reComm.proxyUser = rsComm->proxyUser;
01022 reExecProc.reComm.myEnv = rsComm->myEnv;
01023 reExecProc.ruleExecSubmitInp.packedReiAndArgBBuf =
01024 (bytesBuf_t *) calloc (1, sizeof (bytesBuf_t));
01025 reExecProc.procExecState = RE_PROC_RUNNING;
01026 reExecProc.jobType = jobType;
01027
01028 if ((ruleName = getSqlResultByInx (genQueryOut,
01029 COL_RULE_EXEC_NAME)) == NULL) {
01030 rodsLog (LOG_NOTICE,
01031 "reServerSingleExec: getSqlResultByInx for EXEC_NAME failed");
01032 return (UNMATCHED_KEY_OR_INDEX);
01033 }
01034 if ((reiFilePath = getSqlResultByInx (genQueryOut,
01035 COL_RULE_EXEC_REI_FILE_PATH)) == NULL) {
01036 rodsLog (LOG_NOTICE,
01037 "reServerSingleExec: getSqlResultByInx for REI_FILE_PATH failed");
01038 return (UNMATCHED_KEY_OR_INDEX);
01039 }
01040 if ((userName = getSqlResultByInx (genQueryOut,
01041 COL_RULE_EXEC_USER_NAME)) == NULL) {
01042 rodsLog (LOG_NOTICE,
01043 "reServerSingleExec: getSqlResultByInx for USER_NAME failed");
01044 return (UNMATCHED_KEY_OR_INDEX);
01045 }
01046 if ((exeAddress = getSqlResultByInx (genQueryOut,
01047 COL_RULE_EXEC_ADDRESS)) == NULL) {
01048 rodsLog (LOG_NOTICE,
01049 "reServerSingleExec: getSqlResultByInx for EXEC_ADDRESS failed");
01050 return (UNMATCHED_KEY_OR_INDEX);
01051 }
01052 if ((exeTime = getSqlResultByInx (genQueryOut,
01053 COL_RULE_EXEC_TIME)) == NULL) {
01054 rodsLog (LOG_NOTICE,
01055 "reServerSingleExec: getSqlResultByInx for EXEC_TIME failed");
01056 return (UNMATCHED_KEY_OR_INDEX);
01057 }
01058 if ((exeFrequency = getSqlResultByInx (genQueryOut,
01059 COL_RULE_EXEC_FREQUENCY)) == NULL) {
01060 rodsLog (LOG_NOTICE,
01061 "reServerSingleExec:getResultByInx for RULE_EXEC_FREQUENCY failed");
01062 return (UNMATCHED_KEY_OR_INDEX);
01063 }
01064 if ((priority = getSqlResultByInx (genQueryOut,
01065 COL_RULE_EXEC_PRIORITY)) == NULL) {
01066 rodsLog (LOG_NOTICE,
01067 "reServerSingleExec: getSqlResultByInx for PRIORITY failed");
01068 return (UNMATCHED_KEY_OR_INDEX);
01069 }
01070 if ((lastExecTime = getSqlResultByInx (genQueryOut,
01071 COL_RULE_EXEC_LAST_EXE_TIME)) == NULL) {
01072 rodsLog (LOG_NOTICE,
01073 "reServerSingleExec: getSqlResultByInx for LAST_EXE_TIME failed");
01074 return (UNMATCHED_KEY_OR_INDEX);
01075 }
01076 if ((exeStatus = getSqlResultByInx (genQueryOut,
01077 COL_RULE_EXEC_STATUS)) == NULL) {
01078 rodsLog (LOG_NOTICE,
01079 "reServerSingleExec: getSqlResultByInx for EXEC_STATUS failed");
01080 return (UNMATCHED_KEY_OR_INDEX);
01081 }
01082 if ((estimateExeTime = getSqlResultByInx (genQueryOut,
01083 COL_RULE_EXEC_ESTIMATED_EXE_TIME)) == NULL) {
01084 rodsLog (LOG_NOTICE,
01085 "reServerSingleExec: getResultByInx for ESTIMATED_EXE_TIME failed");
01086 return (UNMATCHED_KEY_OR_INDEX);
01087 }
01088 if ((notificationAddr = getSqlResultByInx (genQueryOut,
01089 COL_RULE_EXEC_NOTIFICATION_ADDR)) == NULL) {
01090 rodsLog (LOG_NOTICE,
01091 "reServerSingleExec:getResultByInx for NOTIFICATION_ADDR failed");
01092 return (UNMATCHED_KEY_OR_INDEX);
01093 }
01094
01095 status = fillExecSubmitInp (&reExecProc.ruleExecSubmitInp,
01096 exeStatus->value, exeTime->value, ruleExecId, reiFilePath->value,
01097 ruleName->value, userName->value, exeAddress->value, exeFrequency->value,
01098 priority->value, estimateExeTime->value, notificationAddr->value);
01099
01100 if (status < 0) return status;
01101 seedRandom ();
01102 status = runRuleExec (&reExecProc);
01103 postProcRunRuleExec (rsComm, &reExecProc);
01104
01105 freeGenQueryOut( &genQueryOut );
01106
01107 return (reExecProc.status);
01108 }
01109