Beispiel #1
0
int send_files_if_needed(

  int            con,
  char          *job_id,
  int            type,
  bool           job_has_run,
  unsigned long  job_momaddr,
  char          *stdout_path,
  char          *stderr_path,
  char          *chkpt_path)

  {
  /* XXX may need to change the logic below, if we are sending the job to
     a mom on the same host and the mom and server are not sharing the same
     spool directory, then we still need to move the file */
  if ((type == MOVE_TYPE_Exec) &&
      (job_has_run == true) &&
      (job_momaddr != pbs_server_addr))
    {
    /* send files created on prior run */
    if ((PBSD_jobfile(con, PBS_BATCH_MvJobFile, stdout_path, job_id, StdOut) != PBSE_NONE) ||
        (PBSD_jobfile(con, PBS_BATCH_MvJobFile, stderr_path, job_id, StdErr) != PBSE_NONE) ||
        (PBSD_jobfile(con, PBS_BATCH_MvJobFile, chkpt_path, job_id, Checkpoint) != PBSE_NONE))
      {
      return(LOCUTION_RETRY);
      }
    }

  return(PBSE_NONE);
  } /* END send_files_if_needed() */
static int
move_job_file(int conn, job *pjob, enum job_file which)
  {
  char path[MAXPATHLEN+1];

  (void)strcpy(path, path_spool);
  (void)strcat(path, pjob->ji_qs.ji_fileprefix);

  if (which == StdOut)
    (void)strcat(path, JOB_STDOUT_SUFFIX);
  else if (which == StdErr)
    (void)strcat(path, JOB_STDERR_SUFFIX);
  else if (which == Checkpoint)
    (void)strcat(path, JOB_CHECKPOINT_SUFFIX);

  if (access(path, F_OK) < 0)
    {
    if (errno == ENOENT)
      return (0);
    else
      return (errno);
    }

  return PBSD_jobfile(conn, PBS_BATCH_MvJobFile, path, pjob->ji_qs.ji_jobid, which);
  }
Beispiel #3
0
/**
 * @brief
 * 		move_job_file - send files created on prior run
 *
 * @param[in]	conn	-	connection handle
 * @param[in]	pjob	-	pointer to job structure
 * @param[in]	which	-	standard file type, see libpbs.h
 * @param[in]	rpp	-	Connect over RPP or over TCP?
 * @param[out]	msgid	-	message id
 *
 * @return	int
 * @retval	0	: success
 * @retval	!=0	: error code
 */
int
move_job_file(int conn, job *pjob, enum job_file which, int rpp, char **msgid)
{
	char path[MAXPATHLEN+1];

	(void)strcpy(path, path_spool);
	if (*pjob->ji_qs.ji_fileprefix != '\0')
		(void)strcat(path, pjob->ji_qs.ji_fileprefix);
	else
		(void)strcat(path, pjob->ji_qs.ji_jobid);
	if (which == StdOut)
		(void)strcat(path, JOB_STDOUT_SUFFIX);
	else if (which == StdErr)
		(void)strcat(path, JOB_STDERR_SUFFIX);
	else if (which == Chkpt)
		(void)strcat(path, JOB_CKPT_SUFFIX);

	if (access(path, F_OK) < 0) {
		if (errno == ENOENT)
			return (0);
		else
			return (errno);
	}
	return PBSD_jobfile(conn, PBS_BATCH_MvJobFile, path, pjob->ji_qs.ji_jobid, which, rpp, msgid);
}