[torqueusers] PBS API help

Garrick Staples garrick at usc.edu
Tue Jul 31 17:14:24 MDT 2007


On Tue, Jul 31, 2007 at 03:28:53PM -0500, Ai Niwaer alleged:
> I want to get the queue status using APIs. I looked through the "PBS
> external reference specification", but still can't connect to server using
> "pbs_connect". Does anybody have sample code to use any PBS APIs?

Everything in src/cmds/ are good examples.

Just calling pbs_connect() should be easy enough.

  int con;
  struct batch_status *status, *p;
  struct attrl *attr;


  con=pbs_connect(NULL);
  if (con<0)
     die because of pbs_errno.


  status = pbs_statque(con, NULL, NULL, NULL);
  if (!status)
     die because of pbs_errno.


  p=status;
  while (p) {
    print p->name;

    attr=p->attribs;

    while (attr)
      print attr->name,attr->value;
      attr=attr->next;
    }

    p=p->next;
  }


  pbs_statfree(status);

  if (pbs_disconnect(con))
    die because of pbs_errno.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.supercluster.org/pipermail/torqueusers/attachments/20070731/f5ca92c9/attachment.bin


More information about the torqueusers mailing list