当前位置: 首页>>代码示例>>C++>>正文


C++ pbs_disconnect函数代码示例

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


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


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