• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ pbs_disconnect函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中pbs_disconnect函数的典型用法代码示例。如果您正苦于以下问题:C++ pbs_disconnect函数的具体用法?C++ pbs_disconnect怎么用?C++ pbs_disconnect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了pbs_disconnect函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: execute

/**
 * @brief
 * 	executes a job 
 *
 * @param[in] job - The fully qualified job id.
 * @param[in] server - The name of the server that manages the job.
 * @param[in] location -  location indicating where to run job
 *
 * @return - Void
 *
 * @File Variables:
 *  exitstatus  Set to two if an error occurs.
 *
 */
static void
execute(char *job, char *server, char *location)
{
	int ct;         /* Connection to the server */
	int err;        /* Error return from pbs_run */
        int out;        /* Stores the size of err_msg_buf*/
	int located = FALSE;
	char *errmsg;
	char err_msg_buf[COMMENT_BUF_SIZE] = {'\0'};	/* generic buffer - comments & logging*/
        char rmt_server[MAXSERVERNAME];
        
cnt:
	if ((ct = cnt2server(server)) > 0) {
		if (async)
			err = pbs_asyrunjob(ct, job, location, NULL);
		else
			err = pbs_runjob(ct, job, location, NULL);

		if (err && (pbs_errno != PBSE_UNKJOBID)) {
			errmsg = pbs_geterrmsg(ct);
			if (errmsg != NULL) {
				if (pbs_errno == PBSE_UNKNODE) {
					out = snprintf(err_msg_buf, sizeof(err_msg_buf),"qrun: %s %s",errmsg, location);
                                        if (out >= sizeof(err_msg_buf)) {
                                                    fprintf(stderr,"%s...\n", err_msg_buf);
                                                } else {
                                                    fprintf(stderr, "%s\n", err_msg_buf);
                                                } 
                                        
				} else {
					prt_job_err("qrun", ct, job);
				}
			} else {
				fprintf(stderr, "qrun : Server returned error %d for job ", pbs_errno);
			}
			exitstatus = 2;
		} else if (err && (pbs_errno == PBSE_UNKJOBID) && !located) {
			located = TRUE;
			if (locate_job(job, server, rmt_server)) {
				pbs_disconnect(ct);
				strcpy(server, rmt_server);
				goto cnt;
			}
			prt_job_err("qrun", ct, job);
			exitstatus = 2;
		}
		pbs_disconnect(ct);
	} else {
		fprintf(stderr,
			"qrun: could not connect to server %s (%d)\n", server, pbs_errno);
		exitstatus = 2;
	}
}
开发者ID:JonShelley,项目名称:pbspro,代码行数:67,代码来源:qrun.c


示例2: execute

/**
 * @brief
 *	disables a destination (queue) 
 *
 * @param queue - The name of the queue to disable.
 * @param server - The name of the server that manages the queue.
 *
 * @return - Void
 *
 * @File Variables:
 * exitstatus  Set to two if an error occurs.
 *
 */
static void
execute(char *queue, char *server)
{
	int ct;         /* Connection to the server */
	int merr;       /* Error return from pbs_manager */
	char *errmsg;   /* Error message from pbs_manager */
	/* The disable request */
	static struct attropl attr = {NULL, "started", NULL, "FALSE", SET};

	if ((ct = cnt2server(server)) > 0) {
		merr = pbs_manager(ct, MGR_CMD_SET, MGR_OBJ_QUEUE, queue, &attr, NULL);
		if (merr != 0) {
			errmsg = pbs_geterrmsg(ct);
			if (errmsg != NULL) {
				fprintf(stderr, "qstop: %s ", errmsg);
			} else {
				fprintf(stderr, "qstop: Error (%d) disabling queue ", pbs_errno);
			}
			if (notNULL(queue))
				fprintf(stderr, "%s", queue);
			if (notNULL(server))
				fprintf(stderr, "@%s", server);
			fprintf(stderr, "\n");
			exitstatus = 2;
		}
		pbs_disconnect(ct);
	} else {
		fprintf(stderr, "qstop: could not connect to server %s (%d)\n", server, pbs_errno);
		exitstatus = 2;
	}
}
开发者ID:bayucan,项目名称:pbspro,代码行数:44,代码来源:qstop.c


示例3: rm_getJobInfo

/**
 * Gets the information about a job. 
 *
 * It stores the info in a module variable.
 * In order to retrieve it, use @see readJobInfo.
 * @param jobid is the PID assigned by the queue
 * @return 0 if correct, non-zero if error
 */
int rm_getJobInfo(struct soap* soap, char* jobid, char* user, 
		struct jobcard** jobInfo )
{
   //! stores the status of a job
   struct batch_status* status;
   int connectionIdentifier;
   struct jobcard* job;

   connectionIdentifier = pbs_connect(server);
   if(!connectionIdentifier)
      return BESE_BACKEND;
   status = pbs_statjob(connectionIdentifier, jobid, NULL, NULL);
   pbs_disconnect(connectionIdentifier);
   if(status == NULL)
      return BESE_NO_ACTIVITY;
   job = (struct jobcard*)soap_malloc(soap, sizeof(struct jobcard));
   if (!job)
	   return BESE_MEM_ALLOC;
   memset(job, 0, sizeof(struct jobcard));

   fillJobStatusDefaults(job);
   convertJobInfo(soap, job, status);
   *jobInfo = job;
   pbs_statfree(status);
   return BESE_OK;
}
开发者ID:saga-project,项目名称:saga-cpp-adaptor-bes,代码行数:34,代码来源:rm_pbs.c


示例4: execute

/*
 * int execute( char *queue, char *server )
 *
 * queue    The name of the queue to disable.
 * server   The name of the server that manages the queue.
 *
 * Returns:
 *  None
 *
 * File Variables:
 *  exitstatus  Set to two if an error occurs.
 */
static void execute(
    
  char *queue,
  char *server)

  {
  int ct;         /* Connection to the server */
  int local_errno = 0;
  int merr;       /* Error return from pbs_manager */
  char *errmsg;   /* Error message from pbs_manager */
  /* The disable request */

  static struct attropl attr =
    {
    NULL, (char *)"enabled", NULL, (char *)"FALSE", SET
    };

  if ((ct = cnt2server(server)) > 0)
    {
    merr = pbs_manager_err(ct, MGR_CMD_SET, MGR_OBJ_QUEUE, queue, &attr, NULL, &local_errno);

    if (merr != 0)
      {
      errmsg = pbs_geterrmsg(ct);

      if (errmsg != NULL)
        {
        fprintf(stderr, "qdisable: %s ", errmsg);
        free(errmsg);
        }
      else
        {
        fprintf(stderr, "qdisable: Error disabling queue: %d - %s ",
          local_errno,
          pbs_strerror(local_errno));
        }

      if (notNULL(queue))
        fprintf(stderr, "%s", queue);

      if (notNULL(server))
        fprintf(stderr, "@%s", server);

      fprintf(stderr, "\n");

      exitstatus = 2;
      }

    pbs_disconnect(ct);
    }
  else
    {
    fprintf(stderr, "qdisable: could not connect to server %s (%d) %s\n",
            server,
            ct * -1,
            pbs_strerror(ct * -1));

    exitstatus = 2;
    }
  }
开发者ID:AlbertDeFusco,项目名称:torque,代码行数:72,代码来源:qdisable.c


示例5: printError

/**
 * Prints in stderr the error message of the last error. 
 *
 * It gets the error 
 * description of the last error that happened in the PBS queue server.
 * @param userMessage message to append to the output. It may contain 
 * additional information from the main program
 */
void printError(char* userMessage)
{
    char *errorMessage;
    int connectionIdentifier = pbs_connect(server);
    errorMessage = pbs_geterrmsg(connectionIdentifier);
    pbs_disconnect(connectionIdentifier);
    fprintf(stderr, "%s\n%s\n", userMessage, errorMessage);
}
开发者ID:saga-project,项目名称:saga-cpp-adaptor-bes,代码行数:16,代码来源:rm_pbs.c


示例6: locate_job

int locate_job(

  char *job_id,
  char *parent_server,
  char *located_server)

  {
  int   connect;
  int   local_errno = 0;
  char  jid_server[PBS_MAXCLTJOBID + 1];
  char *location;

  if ((connect = pbs_connect(parent_server)) >= 0)
    {
    /* SUCCESS */

    strcpy(jid_server, job_id);

    if (notNULL(parent_server))
      {
      strcat(jid_server, "@");
      strcat(jid_server, parent_server);
      }

    location = pbs_locjob_err(connect, jid_server, NULL, &local_errno);

    if (location == NULL)
      {
      pbs_disconnect(connect);

      return(FALSE);
      }

    strcpy(located_server, location);

    free(location);

    pbs_disconnect(connect);

    return(TRUE);
    }

  /* FAILURE */

  return(-1);
  }  /* END locate_job() */
开发者ID:actorquedeveloper,项目名称:torque,代码行数:46,代码来源:locate_job.c


示例7: execute

/*
 * void execute( char *node, char *gpuid, int ecc_perm, int ecc_vol, char *server )
 *
 * node     The name of the MOM node.
 * gpuid    The id of the GPU.
 * ecc_perm The value for resetting the permanent ECC count.
 * ecc_vol  The value for resetting the volatile ECC count.
 * server   The name of the server to send to.
 *
 * Returns:
 *  None
 *
 * File Variables:
 *  exitstatus  Set to two if an error occurs.
 */
static void execute(
    
  char *node,
  char *gpuid,
  int   ecc_perm,
  int   ecc_vol,
  const char *server)

  {
  int local_errno = 0;
  int ct;         /* Connection to the server */
  int merr;       /* Error return from pbs_manager */
  char *errmsg;   /* Error message from pbs_manager */

  /* The request to change mode */

  if ((ct = cnt2server(server, false)) > 0)
    {
    merr = pbs_gpureset_err(ct, node, gpuid, ecc_perm, ecc_vol, &local_errno);

    if (merr != 0)
      {
      errmsg = pbs_geterrmsg(ct);

      if (errmsg != NULL)
        {
        fprintf(stderr, " qgpureset: %s ", errmsg);
        free(errmsg);
        }
      else
        {
        fprintf(stderr, " qgpureset: Error (%d - %s) resetting GPU ECC counts",
                local_errno,
                pbs_strerror(local_errno));
        }

      if (notNULL(server))
        fprintf(stderr, "@%s", server);

      fprintf(stderr, "\n");

      exitstatus = 2;
      }

    pbs_disconnect(ct);
    }
  else
    {
    local_errno = -1 * ct;

    fprintf(stderr, " qgpureset: could not connect to server %s (%d) %s\n",
            server,
            local_errno,
            pbs_strerror(local_errno));

    exitstatus = 2;
    }
  }
开发者ID:dkoes,项目名称:torque,代码行数:73,代码来源:qgpureset.c


示例8: rm_getJobStatus

/**
 * Gets the status of the job. 
 *
 * It maps the different states of PBS jobs to
 * pending and running. It does not make a difference between finished, 
 * cancelled, terminated and unknown jobs since PBS does not store this info.
 * @param jobid is the PID assigned by the queue
 * @return 0 if correct, non-zero if error
 */
int rm_getJobStatus(struct soap* s, char* jobid, char* user, struct bes__ActivityStatusType** jobStatus)
{
   struct bes__ActivityStatusType *activityStatus;
   int connectionIdentifier;
   //! stores the status of a job
   struct batch_status* status;

   if (!jobid || !jobStatus) {
      return BESE_BAD_ARG;
   }
   connectionIdentifier = pbs_connect(server);
   if (!connectionIdentifier)
	   return BESE_BACKEND;
   status = pbs_statjob(connectionIdentifier,jobid,NULL,NULL);
   pbs_disconnect(connectionIdentifier);
   if(status == NULL)
   {
      return BESE_NO_ACTIVITY;
   }
   activityStatus = (struct bes__ActivityStatusType*)soap_malloc(s, sizeof(struct bes__ActivityStatusType));
   if (activityStatus == NULL) {
      return BESE_MEM_ALLOC;
   }
   memset(activityStatus, 0, sizeof(struct bes__ActivityStatusType));
   struct attrl* attrList = status->attribs;
   while (attrList != NULL)
   {
      if(!strcmp(attrList->name, ATTR_state))
      {
        if(!strcmp(attrList->value, "T")) {
           activityStatus->state = Pending;
        }
        else if(!strcmp(attrList->value, "Q")) {
           activityStatus->state = Pending;
        }         
        else if(!strcmp(attrList->value,"H")) {
           activityStatus->state = Pending;
	}         
        else if(!strcmp(attrList->value,"W")){
           activityStatus->state = Pending;
        }         
        else if(!strcmp(attrList->value,"R")){
           activityStatus->state = Running;
        }
        else if(!strcmp(attrList->value,"E")) {
           activityStatus->state = Finished;
        }
        pbs_statfree(status);
	*jobStatus = activityStatus;
        return BESE_OK;
     }
     attrList = attrList->next;
  }
  pbs_statfree(status);
  return BESE_NO_ACTIVITY;
}
开发者ID:saga-project,项目名称:saga-cpp-adaptor-bes,代码行数:65,代码来源:rm_pbs.c


示例9: rm_terminateJob

/**
 * Terminates a job. 
 * @param jobid is the PID assigned by the queue
 * @return 0 if correct, non-zero if error
 */
int rm_terminateJob(struct soap* s, char* jobid, char* user)
{
   int connectionIdentifier = pbs_connect(server);
   if (connectionIdentifier < 1 )
	   return BESE_BACKEND;
   int rc = pbs_deljob(connectionIdentifier, jobid, NULL);
   updateErrorNo();
   pbs_disconnect(connectionIdentifier);
   return BESE_OK;
}
开发者ID:saga-project,项目名称:saga-cpp-adaptor-bes,代码行数:15,代码来源:rm_pbs.c


示例10: execute

static void execute(

  int   manner,  /* I */
  const char *server)  /* I */

  {
  int ct;         /* Connection to the server */
  int err;        /* Error return from pbs_terminate */
  char *errmsg;   /* Error message from pbs_terminate */
  int   local_errno = 0;

  if ((ct = cnt2server(server)) > 0)
    {
    err = pbs_terminate_err(ct, manner, NULL, &local_errno);

    if (err != 0)
      {
      errmsg = pbs_geterrmsg(ct);

      if (errmsg != NULL)
        {
        fprintf(stderr, "qterm: %s",
                errmsg);
        }
      else
        {
        fprintf(stderr, "qterm: Error (%d - %s) terminating server ",
                local_errno, pbs_strerror(local_errno));
        }

      fprintf(stderr, "%s\n",

              server);

      exitstatus = 2;
      }

    pbs_disconnect(ct);
    }
  else
    {
    /* FAILURE */
    local_errno = -1 * ct;

    fprintf(stderr, "qterm: could not connect to server '%s' (%d) %s\n",
            server,
            local_errno,
            pbs_strerror(local_errno));

    exitstatus = 2;
    }

  return;
  }  /* END execute() */
开发者ID:actorquedeveloper,项目名称:torque,代码行数:54,代码来源:qterm.c


示例11: rm_initialize

/**
 * Connects to the PBS queue server and loads cluster info.
 * @param soap is used to allocate memory
 * @param serverName is a string with the hostname in which the queue is running
 * @return 0 if connection established, 1 if error
 */
int rm_initialize(struct soap* soap, char* serverName){
   int connectionIdentifier;
   int error_code = BESE_OK;

   if (!serverName)
	   return BESE_BAD_ARG;
   server = (char*) malloc(strlen(serverName) + 1);
   nresources = (int*) malloc(sizeof(int));
   strcpy(server,serverName);
   connectionIdentifier = pbs_connect(serverName);
   if (connectionIdentifier <= 0 )
	   return BESE_BACKEND;
   pbs_disconnect(connectionIdentifier);
   error_code = rm_getClusterInfo(soap, &clusterInfo);
   if (error_code != BESE_OK)
      return error_code;
   else {
      printf("Looking for resources now");
      error_code = rm_getResourceList(soap, NULL, &resourceList, nresources);
      return error_code;
   }
}
开发者ID:saga-project,项目名称:saga-cpp-adaptor-bes,代码行数:28,代码来源:rm_pbs.c


示例12: drmaa_destroy

/** Closes connection with DRM (if any) and destroys DRMAA session data. */
int
drmaa_destroy(drmaa_session_t *c, char *errmsg, size_t errlen)
  {
  int rc = 0;

  if (c->pbs_conn >= 0)
    rc = pbs_disconnect(c->pbs_conn);

  free(c->contact);

  if (c->jt_list)
    {
    drmaa_job_template_t *i;

    for (i = c->jt_list->next;  i != c->jt_list;)
      {
      drmaa_job_template_t *jt = i;
      i = i->next;
      drmaa_delete_async_job_template(jt);
      }

    free(c->jt_list);
    }

  drmaa_delete_job_hashtab(c->job_hashtab);

  pthread_mutex_destroy(&c->conn_mutex);
  pthread_mutex_destroy(&c->jobs_mutex);

  free(c);

  if (rc)
    RAISE_PBS();

  return DRMAA_ERRNO_SUCCESS;
  }
开发者ID:CESNET,项目名称:torque,代码行数:37,代码来源:session.c


示例13: handle_attribute_errors

/**
 * @brief
 *      handles attribute errors and prints appropriate errmsg
 *
 * @param[in] connect - value indicating server connection
 * @param[in] err_list - list of possible attribute errors
 *
 * @return - Void
 *
 */
static void
handle_attribute_errors(int connect,
	struct ecl_attribute_errors *err_list)
{
	struct attropl *attribute;
	char * opt;
	int i;

	for (i=0; i<err_list->ecl_numerrors; i++) {
		attribute = err_list->ecl_attrerr[i].ecl_attribute;
		if (strcmp(attribute->name, ATTR_h) == 0)
			opt="h";
		else
			return;

		fprintf(stderr, "qhold: illegal -%s value\n", opt);
		print_usage();
		pbs_disconnect(connect);

		/*cleanup security library initializations before exiting*/
		CS_close_app();
		exit(2);
	}
}
开发者ID:agrawalravi90,项目名称:pbspro,代码行数:34,代码来源:qhold.c


示例14: main


//.........这里部分代码省略.........
  msg_string[0] = '\0';
  to_file = 0;

  while ((c = getopt(argc, argv, GETOPT_ARGS)) != EOF)
    switch (c)
      {

      case 'E':
        to_file |= MSG_ERR;
        break;

      case 'O':
        to_file |= MSG_OUT;
        break;

      default :
        errflg++;
      }

  if (to_file == 0) to_file = MSG_ERR;   /* default */

  if (errflg || ((optind + 1) >= argc))
    {
    static char usage[] =
      "usage: qmsg [-O] [-E] msg_string job_identifier...\n";
    fprintf(stderr,"%s", usage);
    exit(2);
    }

  snprintf(msg_string, sizeof(msg_string), "%s", argv[optind]);

  for (optind++; optind < argc; optind++)
    {
    int connect;
    int stat = 0;
    int located = FALSE;
    std::string server_name;
    std::vector<std::string> id_list;

    snprintf(job_id, sizeof(job_id), "%s", argv[optind]);

    if (get_server_and_job_ids(job_id, id_list, server_name))
      {
      fprintf(stderr, "qmsg: illegally formed job identifier: %s\n", job_id);
      any_failed = 1;
      continue;
      }

    snprintf(server_out, sizeof(server_out), "%s", server_name.c_str());

cnt:

    connect = cnt2server(server_out, false);

    if (connect <= 0)
      {
      any_failed = -1 * connect;

      if (server_out[0] != 0)
        fprintf(stderr, "qmsg: cannot connect to server %s (errno=%d) %s\n",
              server_out, any_failed, pbs_strerror(any_failed));
      else
        fprintf(stderr, "qmsg: cannot connect to server %s (errno=%d) %s\n",
              pbs_server, any_failed, pbs_strerror(any_failed));
      continue;
      }

    for (size_t i = 0; i < id_list.size(); i++)
      {
      snprintf(job_id_out, sizeof(job_id_out), "%s", id_list[i].c_str());
    
      stat = pbs_msgjob_err(connect, job_id_out, to_file, msg_string, NULL, &any_failed);
      
      if (any_failed != PBSE_UNKJOBID)
        break;
      }

    if (stat && (any_failed != PBSE_UNKJOBID))
      {
      prt_job_err("qmsg", connect, job_id_out);
      }
    else if (stat && (any_failed == PBSE_UNKJOBID) && !located)
      {
      located = TRUE;

      if (locate_job(job_id_out, server_out, rmt_server))
        {
        pbs_disconnect(connect);
        strcpy(server_out, rmt_server);
        goto cnt;
        }

      prt_job_err("qmsg", connect, job_id_out);
      }

    pbs_disconnect(connect);
    }

  exit(any_failed);
  }
开发者ID:dkoes,项目名称:torque,代码行数:101,代码来源:qmsg.c


示例15: main


//.........这里部分代码省略.........
	hold_type[0]='\0';

	while ((c = getopt(argc, argv, GETOPT_ARGS)) != EOF)
		switch (c) {
			case 'h':
				while (isspace((int)*optarg)) optarg++;
				if (strlen(optarg) == 0) {
					fprintf(stderr, "qrls: illegal -h value\n");
					errflg++;
					break;
				}
				pc = optarg;
				u_cnt = o_cnt = s_cnt = n_cnt = p_cnt = 0;
				while (*pc) {
					if (*pc == 'u')
						u_cnt++;
					else if (*pc == 'o')
						o_cnt++;
					else if (*pc == 's')
						s_cnt++;
					else if (*pc == 'p')
						p_cnt++;
					else if (*pc == 'n')
						n_cnt++;
					else {
						fprintf(stderr, "qrls: illegal -h value\n");
						errflg++;
						break;
					}
					pc++;
				}
				if (n_cnt && (u_cnt + o_cnt + s_cnt + p_cnt)) {
					fprintf(stderr, "qrls: illegal -h value\n");
					errflg++;
					break;
				}
				strcpy(hold_type, optarg);
				break;
			default :
				errflg++;
		}

	if (errflg || optind >= argc) {
		static char usage[]="usage: qrls [-h hold_list] job_identifier...\n";
		static char usag2[]="       qrls --version\n";
		fprintf(stderr, "%s", usage);
		fprintf(stderr, "%s", usag2);
		exit(2);
	}

	/*perform needed security library initializations (including none)*/

	if (CS_client_init() != CS_SUCCESS) {
		fprintf(stderr, "qrls: unable to initialize security library.\n");
		exit(1);
	}

	for (; optind < argc; optind++) {
		int connect;
		int stat=0;
		int located = FALSE;

		strcpy(job_id, argv[optind]);
		if (get_server(job_id, job_id_out, server_out)) {
			fprintf(stderr, "qrls: illegally formed job identifier: %s\n", job_id);
			any_failed = 1;
			continue;
		}
cnt:
		connect = cnt2server(server_out);
		if (connect <= 0) {
			fprintf(stderr, "qrls: cannot connect to server %s (errno=%d)\n",
				pbs_server, pbs_errno);
			any_failed = pbs_errno;
			continue;
		}

		stat = pbs_rlsjob(connect, job_id_out, hold_type, NULL);
		if (stat && (pbs_errno != PBSE_UNKJOBID)) {
			prt_job_err("qrls", connect, job_id_out);
			any_failed = pbs_errno;
		} else if (stat && (pbs_errno == PBSE_UNKJOBID) && !located) {
			located = TRUE;
			if (locate_job(job_id_out, server_out, rmt_server)) {
				pbs_disconnect(connect);
				strcpy(server_out, rmt_server);
				goto cnt;
			}
			prt_job_err("qrls", connect, job_id_out);
			any_failed = pbs_errno;
		}

		pbs_disconnect(connect);
	}

	/*cleanup security library initializations before exiting*/
	CS_close_app();

	exit(any_failed);
}
开发者ID:anamikau,项目名称:pbspro,代码行数:101,代码来源:qrls.c


示例16: main


//.........这里部分代码省略.........

          break;
          }

        snprintf(extend,sizeof(extend),"%s%s",
          ARRAY_RANGE,
          pc);
        break;

      default:

        errflg++;

        break;
      }
    }

  if (errflg || optind >= argc)
    {
    static char usage[] = "usage: qrls [-h {uos}] [-t array_range] job_identifier...\n";

    fprintf(stderr,"%s", usage);

    exit(2);
    }

  for (;optind < argc;optind++)
    {
    int connect;
    int stat = 0;
    int located = FALSE;

    snprintf(job_id, sizeof(job_id), "%s", argv[optind]);

    if (get_server(job_id, job_id_out, sizeof(job_id_out), server_out, sizeof(server_out)))
      {
      fprintf(stderr, "qrls: illegally formed job identifier: %s\n",
              job_id);

      any_failed = 1;

      continue;
      }

cnt:

    connect = cnt2server(server_out);

    if (connect <= 0)
      {
      any_failed = -1 * connect;

      if (server_out[0] != 0)
        fprintf(stderr, "qrls: cannot connect to server %s (errno=%d) %s\n",
              server_out,
              any_failed,
              pbs_strerror(any_failed));
      else
        fprintf(stderr, "qrls: cannot connect to server %s (errno=%d) %s\n",
              pbs_server,
              any_failed,
              pbs_strerror(any_failed));

      continue;
      }

    stat = pbs_rlsjob_err(connect, job_id_out, hold_type, extend, &any_failed);

    if (stat &&
        (any_failed != PBSE_UNKJOBID))
      {
      prt_job_err("qrls", connect, job_id_out);
      }
    else if (stat && 
             (any_failed != PBSE_UNKJOBID) &&
             !located)
      {
      located = TRUE;

      if (locate_job(job_id_out, server_out, rmt_server))
        {
        pbs_disconnect(connect);

        strcpy(server_out, rmt_server);

        goto cnt;
        }

      prt_job_err("qrls", connect, job_id_out);
      }

    pbs_disconnect(connect);
    }  /* END for () */

  exit(any_failed);

  /*NOTREACHED*/

  return(0);
  }  /* END main() */
开发者ID:boegel,项目名称:torque,代码行数:101,代码来源:qrls.c


示例17: execute

static void execute(

  char *job,      /* I */
  char *server,   /* I */
  char *location, /* I */
  int  async)     /* I */

  {
  int ct;         /* Connection to the server */
  int err;        /* Error return from pbs_run */
  int located = FALSE;
  char rmt_server[MAXSERVERNAME];
  int  local_errno = 0;

cnt:

  if ((ct = cnt2server(server)) > 0)
    {
    if (async == TRUE)
      {
      err = pbs_asyrunjob_err(ct, job, location, NULL, &local_errno);  /* see lib/Libifl/pbsD_runjob.c */
      }
    else
      {
      err = pbs_runjob_err(ct, job, location, NULL, &local_errno);  /* see lib/Libifl/pbsD_runjob.c */
      }

    if (err && (local_errno == PBSE_UNKNODE))
      {
      fprintf(stderr, "qrun: Unknown node in hostlist '%.16s...' for job %s\n",
              location,
              job);

      exitstatus = 2;
      }
    else if (err && (local_errno != PBSE_UNKJOBID))
      {
      prt_job_err("qrun", ct, job);

      exitstatus = 2;
      }
    else if (err && (local_errno == PBSE_UNKJOBID) && !located)
      {
      located = TRUE;

      if (locate_job(job, server, rmt_server))
        {
        pbs_disconnect(ct);

        strcpy(server, rmt_server);

        goto cnt;
        }

      prt_job_err("qrun", ct, job);

      exitstatus = 2;
      }

    pbs_disconnect(ct);
    }
  else
    {
    fprintf(stderr, "qrun: could not connect to server %s (%d) %s\n",
            server,
            ct * -1,
            pbs_strerror(ct * -1));

    exitstatus = 2;
    }

  return;
  }  /* END execute() */
开发者ID:VladimirStarostenkov,项目名称:torque,代码行数:73,代码来源:qrun.c


示例18: rm_getClusterInfo

/**
 * Gets the factory attributes. 
 *
 * This function uses @see loadResourceFile 
 * and also queries the PBS queue.
 * @param soap is needed to allocate memory that can be deallocated by the 
 * gsoap library after.
 * @param clusterInf a struct of type clusterInfo with the information needed for the
 * factory attributes document
 */
int rm_getClusterInfo(struct soap*soap, struct rm_clusterInfo** clusterInf
		/*,int compactResources*/)
{
   char outputFile[256];   
   FILE* fd;
   int rc;
   char resource[128];
   int connectionIdentifier = pbs_connect(server);
   struct rm_clusterInfo* clusterInfo;
   struct rm_resource* resourcesInfo;
   struct batch_status* status;


   if (!clusterInf) {
      return BESE_BAD_ARG;
   }
   clusterInfo = (struct rm_clusterInfo*) soap_malloc(soap,
		   sizeof(struct rm_clusterInfo));
   if (clusterInfo == NULL)
      return BESE_MEM_ALLOC;
   memset(clusterInfo, 0, sizeof(struct rm_clusterInfo));
   
   //First, contact the PBS queue
   status = pbs_statserver(connectionIdentifier,NULL,NULL);
   if(status != NULL)
   {
   //Loop over the list of attributes returned
      struct attrl* attributeList = status->attribs;
      while(attributeList != NULL)
      {
	  //Server_host for the CommonName element
         if(!strcmp(attributeList->name, "server_host"))
         {
            clusterInfo->CommonName = soap_strdup(soap,
			   attributeList->value);
         }
	 //Server_state for the IsAcceptingNewActivities element
         else if(!strcmp(attributeList->name, "server_state"))
         {
            if(!strcmp(attributeList->value, "Active"))
               clusterInfo->IsAcceptingNewActivities = true_;
            else
               clusterInfo->IsAcceptingNewActivities = false_;
         }//total_jobs for the TotalNumberOfActivities element
         else if(!strcmp(attributeList->name, "total_jobs"))
         {
            //clusterInfo->TotalNumberOfActivities = 
	//	    atoi(attributeList->value);
         }//pbs_version for the LocalResourceManagerType element
         else if(!strcmp(attributeList->name, "pbs_version"))
         {
            char* pbsStr = (char*) soap_malloc(soap, strlen(PBS) + 
			              strlen(attributeList->value) + 10);
	    sprintf(pbsStr, "%s %s %s", PBS, "Version", attributeList->value);
            clusterInfo->LocalResourceManagerType = pbsStr;
         }
         //fprintf(stderr,"Attribute: %s - Value: %s\n",attributeList->name,attributeList->value);
         attributeList = attributeList->next;
      }
   }
 
   pbs_statfree(status);
   pbs_disconnect(connectionIdentifier); 
   *clusterInf = clusterInfo;

   return BESE_OK;
}
开发者ID:saga-project,项目名称:saga-cpp-adaptor-bes,代码行数:77,代码来源:rm_pbs.c


示例19: main


//.........这里部分代码省略.........
          }

        strncpy(extend, optarg, sizeof(extend));

        break;

      case 'f':

        if (extend[0] != '\0')
          {
          errflg++;

          break;
          }

        strcpy(extend, RERUNFORCE);

        break;

      }  /* END switch (c) */
    }    /* END while ((c = getopt(argc,argv,GETOPT_ARGS)) != EOF) */

  if ((errflg != 0) || (optind >= argc))
    {
    fprintf(stderr,"%s", usage);

    exit(2);
    }

  for (;optind < argc;optind++)
    {
    int connect;
    int stat = 0;
    int located = FALSE;

    snprintf(job_id, sizeof(job_id), "%s", argv[optind]);

    if (get_server(job_id, job_id_out, sizeof(job_id_out), server_out, sizeof(server_out)))
      {
      fprintf(stderr, "qrerun: illegally formed job identifier: %s\n",
              job_id);

      any_failed = 1;

      continue;
      }

cnt:

    connect = cnt2server(server_out);

    if (connect <= 0)
      {
      any_failed = -1 * connect;

      if (server_out[0] != 0)
        fprintf(stderr, "qrerun: cannot connect to server %s (errno=%d) %s\n",
              server_out,
              any_failed,
              pbs_strerror(any_failed));
      else
        fprintf(stderr, "qrerun: cannot connect to server %s (errno=%d) %s\n",
              pbs_server,
              any_failed,
              pbs_strerror(any_failed));


      continue;
      }

    if (extend[0] != '\0')
      stat = pbs_rerunjob_err(connect, job_id_out, extend, &any_failed);
    else
      stat = pbs_rerunjob_err(connect, job_id_out, NULL, &any_failed);

    if (stat && (any_failed != PBSE_UNKJOBID))
      {
      prt_job_err("qrerun", connect, job_id_out);
      }
    else if (stat && (any_failed == PBSE_UNKJOBID) && !located)
      {
      located = TRUE;

      if (locate_job(job_id_out, server_out, rmt_server))
        {
        pbs_disconnect(connect);

        snprintf(server_out, sizeof(server_out), "%s", rmt_server);

        goto cnt;
        }

      prt_job_err("qrerun", connect, job_id_out);
      }

    pbs_disconnect(connect);
    }

  exit(any_failed);
  }  /* END main() */
开发者ID:boegel,项目名称:torque,代码行数:101,代码来源:qrerun.c


示例20: handle_attribute_errors

/**
 * @brief
 * 	handles attribute errors and prints appropriate errmsg
 *
 * @param[in] connect - value indicating server connection
 * @param[in] err_list - list of possible attribute errors
 * @param[in] id - corresponding id(string) for attribute error
 *
 * @return - Void
 *
 */
static void
handle_attribute_errors(int connect,
	struct ecl_attribute_errors *err_list, char *id)
{
	struct attropl *attribute;
	char * opt;
	int i;

	for (i=0; i<err_list->ecl_numerrors; i++) {
		attribute = err_list->ecl_attrerr[i].ecl_attribute;
		if (strcmp(attribute->name, ATTR_a) == 0)
			opt="a";
		else if (strcmp(attribute->name, ATTR_A) == 0)
			opt="A";
		else if (strcmp(attribute->name, ATTR_project) == 0)
			opt = "P";
		else if (strcmp(attribute->name, ATTR_c) == 0)
			opt="c";
		else if (strcmp(attribute->name, ATTR_e) == 0)
			opt="e";
		else if (strcmp(attribute->name, ATTR_h) == 0)
			opt="h";
		else if (strcmp(attribute->name, ATTR_j)==0)
			opt="j";
		else if (strcmp(attribute->name, ATTR_k)==0)
			opt="k";
		else if (strcmp(attribute->name, ATTR_l)==0) {
			opt="l";
			fprintf(stderr, "qalter: %s %s\n",
				err_list->ecl_attrerr[i].ecl_errmsg, id);
			exit(err_list->ecl_attrerr[i].ecl_errcode);
		}
		else if (strcmp(attribute->name, ATTR_m)==0)
			opt="m";
		else if (strcmp(attribute->name, ATTR_M)==0)
			opt="M";
		else if (strcmp(attribute->name, ATTR_N)==0)
			opt="N";
		else if (strcmp(attribute->name, ATTR_o)==0)
			opt="o";
		else if (strcmp(attribute->name, ATTR_p)==0)
			opt="p";
		else if (strcmp(attribute->name, ATTR_r)==0)
			opt="r";
		else if (strcmp(attribute->name, ATTR_R)==0)
			opt="R";
		else if (strcmp(attribute->name, ATTR_S)==0)
			opt="S";
		else if (strcmp(attribute->name, ATTR_u)==0)
			opt="u";
		else if ((strcmp(attribute->name, ATTR_depend)==0) ||
			(strcmp(attribute->name, ATTR_stagein)==0) ||
			(strcmp(attribute->name, ATTR_stageout)==0) ||
			(strcmp(attribute->name, ATTR_sandbox)==0) ||
			(strcmp(attribute->name, ATTR_umask) == 0) ||
			(strcmp(attribute->name, ATTR_runcount) == 0) ||
			(strcmp(attribute->name, ATTR_g)==0))
			opt="W";
		else
			return;

		pbs_disconnect(connect);
		CS_close_app();

		if (err_list->ecl_attrerr->ecl_errcode == PBSE_JOBNBIG)
                        fprintf(stderr, "qalter: Job %s \n", err_list->ecl_attrerr->ecl_errmsg);
                else {
			fprintf(stderr, "qalter: illegal -%s value\n", opt);
			print_usage();
		}
		exit(2);
	}
}
开发者ID:agrawalravi90,项目名称:pbspro,代码行数:84,代码来源:qalter.c



注:本文中的pbs_disconnect函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ pbuf_alloc函数代码示例发布时间:2022-05-30
下一篇:
C++ pbc_malloc函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap