void issue_track( job *pjob) { struct batch_request *preq; char *pc; preq = alloc_br(PBS_BATCH_TrackJob); if (preq == (struct batch_request *)0) return; preq->rq_ind.rq_track.rq_hopcount = pjob->ji_wattr[JOB_ATR_hopcount].at_val.at_long; strcpy(preq->rq_ind.rq_track.rq_jid, pjob->ji_qs.ji_jobid); strcpy(preq->rq_ind.rq_track.rq_location, server_name); preq->rq_ind.rq_track.rq_state[0] = pjob->ji_wattr[JOB_ATR_state].at_val.at_char; pc = pjob->ji_qs.ji_jobid; while (*pc != '.') pc++; issue_to_svr(++pc, preq, NULL); free_br(preq); }
static void reissue_to_svr( struct work_task *pwt) { time_t time_now = time(NULL); char *br_id = pwt->wt_parm1; batch_request *preq = get_remove_batch_request(br_id); /* if not timed-out, retry send to remote server */ if (preq != NULL) { if (((time_now - preq->rq_time) > PBS_NET_RETRY_LIMIT) || (issue_to_svr(preq->rq_host, preq, pwt->wt_parmfunc) != PBSE_NONE)) { /* either timed-out or got hard error, tell post-function */ pwt->wt_aux = -1; /* seen as error by post function */ pwt->wt_event = -1; /* seen as connection by post func */ if (pwt->wt_parmfunc != NULL) ((void (*)())pwt->wt_parmfunc)(pwt); } } free(pwt->wt_mutex); free(pwt); } /* END reissue_to_svr() */
void issue_track( job *pjob) { struct batch_request *preq; char *pc; char *sname; char log_buf[LOCAL_LOG_BUF_SIZE]; if ((pc = strchr(pjob->ji_qs.ji_jobid, '.')) == NULL) { snprintf(log_buf, sizeof(log_buf), "Remote job routing is not compatible with display_job_server_suffix set to false. Cannot track %s", pjob->ji_qs.ji_jobid); log_err(-1, __func__, log_buf); return; } sname = pc + 1; /* do not issue track requests to ourselves */ if (!strcmp(sname, server_name)) { snprintf(log_buf, sizeof(log_buf), "%s erroneously called for local job %s", __func__, pjob->ji_qs.ji_jobid); log_event(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, log_buf); return; } preq = alloc_br(PBS_BATCH_TrackJob); if (preq == NULL) return; preq->rq_ind.rq_track.rq_hopcount = pjob->ji_wattr[JOB_ATR_hopcount].at_val.at_long; strcpy(preq->rq_ind.rq_track.rq_jid, pjob->ji_qs.ji_jobid); strcpy(preq->rq_ind.rq_track.rq_location, server_name); preq->rq_ind.rq_track.rq_state[0] = pjob->ji_wattr[JOB_ATR_state].at_val.at_char; pc = pjob->ji_qs.ji_jobid; while (*pc != '.') pc++; issue_to_svr(++pc, preq, NULL); free_br(preq); }
void reissue_to_svr( struct work_task *pwt) { time_t time_now = time(NULL); char *br_id; batch_request *preq; char *serverName = NULL; if (pwt == NULL) return; br_id = (char *)pwt->wt_parm1; preq = get_remove_batch_request(br_id); /* if not timed-out, retry send to remote server */ if (preq != NULL) { if (preq->rq_host[0] != '\0') serverName = strdup(preq->rq_host); else { free(pwt->wt_mutex); free(pwt); return; } if (((time_now - preq->rq_time) > PBS_NET_RETRY_LIMIT) || (issue_to_svr(serverName, &preq, pwt->wt_parmfunc) != PBSE_NONE)) { /* either timed-out or got hard error, tell post-function */ pwt->wt_aux = -1; /* seen as error by post function */ pwt->wt_event = -1; /* seen as connection by post func */ if (pwt->wt_parmfunc != NULL) (* pwt->wt_parmfunc)(pwt); } } if (serverName) free(serverName); free(pwt->wt_mutex); free(pwt); } /* END reissue_to_svr() */
/** * @brief * reissue_to_svr - recall issue_to_svr() after a delay to retry sending * a request that failed for a temporary reason * * @see * issue_to_svr * * @param[in] pwt - pointer to work structure * * @return void */ static void reissue_to_svr(struct work_task *pwt) { struct batch_request *preq = pwt->wt_parm1; int issue_to_svr(char *, struct batch_request *, void(*)(struct work_task *)); /* if not timed-out, retry send to remote server */ if (((time_now - preq->rq_time) > PBS_NET_RETRY_LIMIT) || (issue_to_svr(preq->rq_host, preq, (void(*)(struct work_task *))pwt->wt_parm2) == -1)) { /* either timed-out or got hard error, tell post-function */ pwt->wt_aux = -1; /* seen as error by post function */ pwt->wt_event = -1; /* seen as connection by post func */ ((void (*)())pwt->wt_parm2)(pwt); } return; }