Changeset 327


Ignore:
Timestamp:
03/09/15 16:28:14 (9 years ago)
Author:
bas
Message:

some small improvements but no working rm interface

Location:
devel/5.X
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • devel/5.X/log.h

    r324 r327  
    151151typedef enum getter_setter SGetter;
    152152
    153 // HVB extern int LOGLEVEL;
     153// HvB extern int LOGLEVEL;
    154154
    155155extern long *log_event_mask;
  • devel/5.X/pbs.i

    r326 r327  
    417417    and fill in the next fields so it also works for the C-library
    418418  */
    419   printf("basje \n");
     419
     420  if (SARA_DEBUG)
     421  {
     422     printf("new_attrl \n");
     423  }
    420424  ptr = (struct attrl *) malloc(number * sizeof(struct attrl));
    421425
  • devel/5.X/pbs.py

    r324 r327  
    929929  Get the default values from the mom daemon
    930930  """
     931  err = 0
     932  print default_mom_res
    931933  for res in default_mom_res:
    932     addreq(id, res)
    933     resp = getreq(id)
     934    print res
     935    #addreq(id, res)
     936    addreq_err(id, err, res)
     937    print err
     938    #resp = getreq(id)
     939    resp = getreq_err(err, id)
     940    print "error: ", err
     941
     942    print resp,id
    934943    check_resp(d, resp)
    935944
  • devel/5.X/pbs_node_info

    r324 r327  
    1919    attrs = node.attribs
    2020    for attr in attrs:
    21       print '\t', attr.name, ' = ', attr.value
     21      print '\t  ', attr.name, ' = ', attr.value
    2222
    23     try:
    24       mom_port = socket.getservbyname('pbs_resmom', 'tcp')
    25       mom_id = pbs.openrm(node.name, mom_port)
    26     except socket.error, detail:
    27       mom_id = pbs.openrm(node.name, pbs.PBS_MANAGER_SERVICE_PORT)
     23#    try:
     24#      mom_port = socket.getservbyname('pbs_resmom', 'tcp')
     25#      mom_id = pbs.openrm(node.name, mom_port)
     26#    except socket.error, detail:
     27#      mom_id = pbs.openrm(node.name, pbs.PBS_MANAGER_SERVICE_PORT)
     28
     29    err = 0
     30    mom_id = pbs.openrm(node.name, pbs.PBS_MANAGER_SERVICE_PORT)
     31    e, e_txt = pbs.error()
     32    print "openrm", e, e_txt
     33    print node.name, mom_id, pbs.PBS_MANAGER_SERVICE_PORT
     34    pbs.flushreq()
     35    #pbs.fullresp(1)
     36    e, e_txt = pbs.error()
     37    print "flush", e, e_txt
     38
     39    #pbs.addreq_err(mom_id, err, "arch")
     40    pbs.addreq(mom_id, "arch")
     41    e, e_txt = pbs.error()
     42    print "addreq:", e, e_txt
     43
     44    print pbs.activereq()
     45    e, e_txt = pbs.error()
     46    print "addreq:", e, e_txt
     47
     48    #resp = pbs.getreq_err(err, mom_id)
     49    resp = pbs.getreq(mom_id)
     50    e, e_txt = pbs.error()
     51    print e, e_txt
     52    print err, resp
     53
     54    sys.exit(1)
     55    print 'rm interface'
    2856
    2957    mom_keys = pbs.get_mom_values(mom_id)
    3058    for key in mom_keys.keys():
    31       print '\t %s = %s' %(key, mom_keys[key])
     59      print '\t mom %s = %s' %(key, mom_keys[key])
    3260
    3361    print 'Testing list with user supplied keywords'
  • devel/5.X/pbs_wrap.c

    r324 r327  
    30143014    and fill in the next fields so it also works for the C-library
    30153015  */
    3016   printf("basje \n");
     3016
     3017  if (SARA_DEBUG)
     3018  {
     3019     printf("new_attrl \n");
     3020  }
    30173021  ptr = (struct attrl *) malloc(number * sizeof(struct attrl));
    30183022
     
    30213025  for (i=0; i < number; i++)
    30223026  {
    3023     printf("constructor called\n");
     3027    // printf("constructor called\n");
    30243028    current->name     = (char *) malloc(MAXNAMLEN * sizeof(char));
    30253029    current->resource = (char *) malloc(MAXNAMLEN * sizeof(char));
     
    30583062  for (i=0; i < number; i++)
    30593063  {
    3060     printf("constructor called\n");
     3064    // printf("constructor called\n");
    30613065    current->name     = (char *) malloc(MAXNAMLEN * sizeof(char));
    30623066    current->resource = (char *) malloc(MAXNAMLEN * sizeof(char));
     
    55505554  char *buf4 = 0 ;
    55515555  int alloc4 = 0 ;
    5552   void *argp5 = 0 ;
    5553   int res5 = 0 ;
    55545556  int res6 ;
    55555557  char *buf6 = 0 ;
     
    55845586  }
    55855587  arg4 = (char *)(buf4);
    5586   res5 = SWIG_ConvertPtr(obj4, &argp5,SWIGTYPE_p_attropl, 0 |  0 );
    5587   if (!SWIG_IsOK(res5)) {
    5588     SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "pbs_manager" "', argument " "5"" of type '" "struct attropl *""'");
    5589   }
    5590   arg5 = (struct attropl *)(argp5);
     5588  {
     5589    PyObject          *py_obj;
     5590    struct attropl    *ptr, *prev;
     5591    char              s[255];
     5592    int               i=0, size=0;
     5593   
     5594    // printf("Python --> C\n");
     5595   
     5596    if (SARA_DEBUG) printf("Converteren python -> c (struct attropl *):\n");
     5597   
     5598    size = Get_List_Size(obj4);
     5599   
     5600    if (SARA_DEBUG) printf("\tSize attropl List: %d\n", size);
     5601   
     5602    if ( size == -1 ) {
     5603      PyErr_SetString(PyExc_TypeError, "not a list");
     5604      return NULL;
     5605    }
     5606    //printf("Size = %d\n", size);
     5607   
     5608    if (SARA_DEBUG) printf("\t<Contents>\n");
     5609   
     5610    arg5 = prev = NULL;
     5611    for ( i=0; i < size; i++ ) {
     5612      py_obj = PyList_GetItem(obj4, i);
     5613      if (SWIG_ConvertPtr(py_obj, (void **) &ptr, SWIGTYPE_p_attropl, 1)) {
     5614        sprintf(s,"list item %d has wrong type", i);
     5615        PyErr_SetString(PyExc_TypeError, s);
     5616        return NULL;
     5617       
     5618        // This will skipp the wrong entry
     5619        // continue;
     5620      }
     5621     
     5622      /*
     5623           * Make first entry head of C linked list
     5624          */
     5625      if ( i == 0) {
     5626        arg5 = ptr;
     5627        ptr->next = prev;
     5628      }
     5629      else {
     5630        prev->next = ptr;
     5631        ptr->next = NULL;
     5632      }
     5633      prev = ptr;
     5634     
     5635    } // end for
     5636    if (SARA_DEBUG) printf("\t</Contents>\n");
     5637  }
    55915638  res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6);
    55925639  if (!SWIG_IsOK(res6)) {
     
    63096356  PyObject *resultobj = 0;
    63106357  struct batch_status *arg1 = (struct batch_status *) 0 ;
    6311   void *argp1 = 0 ;
    6312   int res1 = 0 ;
    63136358  PyObject * obj0 = 0 ;
    63146359 
    63156360  if (!PyArg_ParseTuple(args,(char *)"O:pbs_statfree",&obj0)) SWIG_fail;
    6316   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_batch_status, 0 |  0 );
    6317   if (!SWIG_IsOK(res1)) {
    6318     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pbs_statfree" "', argument " "1"" of type '" "struct batch_status *""'");
    6319   }
    6320   arg1 = (struct batch_status *)(argp1);
     6361  {
     6362    PyObject              *py_obj;
     6363    struct batch_status   *ptr, *prev;
     6364    char                  s[255];
     6365    int                   i=0, size=0;
     6366   
     6367    // printf("Python --> C\n");
     6368   
     6369    if (SARA_DEBUG) printf("Converteren python -> c (struct batch_status *):\n");
     6370   
     6371    size = Get_List_Size(obj0);
     6372    if (SARA_DEBUG) printf("\tSize of batch_status list: %d\n", size);
     6373   
     6374    if ( size == -1 ) {
     6375      PyErr_SetString(PyExc_TypeError, "not a list");
     6376      return NULL;
     6377    }
     6378    // printf("Size = %d\n", size);
     6379   
     6380    if (SARA_DEBUG) printf("\t<Contents>\n");
     6381   
     6382    arg1 = prev = NULL;
     6383    for ( i=0; i < size; i++ ) {
     6384      py_obj = PyList_GetItem(obj0, i);
     6385      if (SWIG_ConvertPtr(py_obj, (void **) &ptr, SWIGTYPE_p_batch_status, 1)) {
     6386        sprintf(s,"list item %d has wrong type", i);
     6387        PyErr_SetString(PyExc_TypeError, s);
     6388        return NULL;
     6389       
     6390        // This will skipp the wrong entry
     6391        // continue;
     6392      }
     6393     
     6394      /*
     6395           * Make first entry head of C linked list
     6396          */
     6397      if ( i == 0) {
     6398        arg1 = ptr;
     6399        ptr->next = prev;
     6400      }
     6401      else {
     6402        prev->next = ptr;
     6403        ptr->next = NULL;
     6404      }
     6405     
     6406      if (SARA_DEBUG) printf("\t\t- %s\n", ptr->name);
     6407      prev = ptr;
     6408     
     6409    } // end for
     6410   
     6411    if (SARA_DEBUG) printf("\t</Contents>\n");
     6412  }
    63216413  pbs_statfree(arg1);
    63226414  resultobj = SWIG_Py_Void();
     
    69297021  int val1 ;
    69307022  int ecode1 = 0 ;
    6931   void *argp2 = 0 ;
    6932   int res2 = 0 ;
    69337023  int res3 ;
    69347024  char *buf3 = 0 ;
     
    69537043  }
    69547044  arg1 = (int)(val1);
    6955   res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_attropl, 0 |  0 );
    6956   if (!SWIG_IsOK(res2)) {
    6957     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "pbs_submit" "', argument " "2"" of type '" "struct attropl *""'");
    6958   }
    6959   arg2 = (struct attropl *)(argp2);
     7045  {
     7046    PyObject          *py_obj;
     7047    struct attropl    *ptr, *prev;
     7048    char              s[255];
     7049    int               i=0, size=0;
     7050   
     7051    // printf("Python --> C\n");
     7052   
     7053    if (SARA_DEBUG) printf("Converteren python -> c (struct attropl *):\n");
     7054   
     7055    size = Get_List_Size(obj1);
     7056   
     7057    if (SARA_DEBUG) printf("\tSize attropl List: %d\n", size);
     7058   
     7059    if ( size == -1 ) {
     7060      PyErr_SetString(PyExc_TypeError, "not a list");
     7061      return NULL;
     7062    }
     7063    //printf("Size = %d\n", size);
     7064   
     7065    if (SARA_DEBUG) printf("\t<Contents>\n");
     7066   
     7067    arg2 = prev = NULL;
     7068    for ( i=0; i < size; i++ ) {
     7069      py_obj = PyList_GetItem(obj1, i);
     7070      if (SWIG_ConvertPtr(py_obj, (void **) &ptr, SWIGTYPE_p_attropl, 1)) {
     7071        sprintf(s,"list item %d has wrong type", i);
     7072        PyErr_SetString(PyExc_TypeError, s);
     7073        return NULL;
     7074       
     7075        // This will skipp the wrong entry
     7076        // continue;
     7077      }
     7078     
     7079      /*
     7080           * Make first entry head of C linked list
     7081          */
     7082      if ( i == 0) {
     7083        arg2 = ptr;
     7084        ptr->next = prev;
     7085      }
     7086      else {
     7087        prev->next = ptr;
     7088        ptr->next = NULL;
     7089      }
     7090      prev = ptr;
     7091     
     7092    } // end for
     7093    if (SARA_DEBUG) printf("\t</Contents>\n");
     7094  }
    69607095  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
    69617096  if (!SWIG_IsOK(res3)) {
     
    75227657  int val1 ;
    75237658  int ecode1 = 0 ;
    7524   void *argp2 = 0 ;
     7659  int temp2 ;
    75257660  int res2 = 0 ;
    75267661  int res3 ;
     
    75387673  }
    75397674  arg1 = (int)(val1);
    7540   res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_int, 0 |  0 );
    7541   if (!SWIG_IsOK(res2)) {
    7542     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "addreq_err" "', argument " "2"" of type '" "int *""'");
    7543   }
    7544   arg2 = (int *)(argp2);
     7675  if (!(SWIG_IsOK((res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2),SWIGTYPE_p_int,0))))) {
     7676    int val;
     7677    int ecode = SWIG_AsVal_int(obj1, &val);
     7678    if (!SWIG_IsOK(ecode)) {
     7679      SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "addreq_err" "', argument " "2"" of type '" "int""'");
     7680    }
     7681    temp2 = (int)(val);
     7682    arg2 = &temp2;
     7683    res2 = SWIG_AddTmpMask(ecode);
     7684  }
    75457685  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
    75467686  if (!SWIG_IsOK(res3)) {
     
    75507690  result = (int)addreq_err(arg1,arg2,arg3);
    75517691  resultobj = SWIG_From_int((int)(result));
     7692  if (SWIG_IsTmpObj(res2)) {
     7693    resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg2)));
     7694  } else {
     7695    int new_flags = SWIG_IsNewObj(res2) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
     7696    resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg2), SWIGTYPE_p_int, new_flags));
     7697  }
    75527698  if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
    75537699  return resultobj;
     
    76617807  int *arg1 = (int *) 0 ;
    76627808  int arg2 ;
    7663   void *argp1 = 0 ;
     7809  int temp1 ;
    76647810  int res1 = 0 ;
    76657811  int val2 ;
     
    76707816 
    76717817  if (!PyArg_ParseTuple(args,(char *)"OO:getreq_err",&obj0,&obj1)) SWIG_fail;
    7672   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_int, 0 |  0 );
    7673   if (!SWIG_IsOK(res1)) {
    7674     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getreq_err" "', argument " "1"" of type '" "int *""'");
    7675   }
    7676   arg1 = (int *)(argp1);
     7818  if (!(SWIG_IsOK((res1 = SWIG_ConvertPtr(obj0,SWIG_as_voidptrptr(&arg1),SWIGTYPE_p_int,0))))) {
     7819    int val;
     7820    int ecode = SWIG_AsVal_int(obj0, &val);
     7821    if (!SWIG_IsOK(ecode)) {
     7822      SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "getreq_err" "', argument " "1"" of type '" "int""'");
     7823    }
     7824    temp1 = (int)(val);
     7825    arg1 = &temp1;
     7826    res1 = SWIG_AddTmpMask(ecode);
     7827  }
    76777828  ecode2 = SWIG_AsVal_int(obj1, &val2);
    76787829  if (!SWIG_IsOK(ecode2)) {
     
    76827833  result = (char *)getreq_err(arg1,arg2);
    76837834  resultobj = SWIG_FromCharPtr((const char *)result);
     7835  if (SWIG_IsTmpObj(res1)) {
     7836    resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg1)));
     7837  } else {
     7838    int new_flags = SWIG_IsNewObj(res1) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
     7839    resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg1), SWIGTYPE_p_int, new_flags));
     7840  }
    76847841  return resultobj;
    76857842fail:
  • devel/5.X/resmom.py

    r324 r327  
    8787  Get the default values from the mom daemon
    8888  """
     89  err = 0
     90  print default_mom_res
    8991  for res in default_mom_res:
    90     addreq(id, res)
    91     resp = getreq(id)
     92    print res
     93    #addreq(id, res)
     94    addreq_err(id, err, res)
     95    print err
     96    #resp = getreq(id)
     97    resp = getreq_err(err, id)
     98    print "error: ", err
     99
     100    print resp,id
    92101    check_resp(d, resp)
    93102
  • devel/5.X/rm.h

    r324 r327  
    8282** to the resource monitor.
    8383*/
    84 
    8584#ifdef __cplusplus
    8685extern "C"
     
    9291int downrm(int *, int);
    9392int configrm(int, int *, char *);
    94 int addreq_err(int, int *, char *);
     93int addreq_err(int, int *INOUT, char *);
    9594int begin_rm_req(int ,int *,int );
    9695int addreq(int, char *);
    9796int allreq(char *);
    98 char* getreq_err(int *, int);
    99 char* getreq(int);
     97char *getreq_err(int *INOUT, int);
     98char *getreq(int);
    10099int flushreq(void);
    101100int activereq(void);
     
    104103}
    105104#endif
    106 
Note: See TracChangeset for help on using the changeset viewer.