[Resending with list address fixed]
----- Original Message -----
> Hi Jonathan,
>
> ----- Original Message -----
> > I'm getting the following error in pmGetArchiveEnd():
> >
> > Traceback (most recent call last):
> > ...
> > File "/usr/lib64/python2.6/site-packages/pcp.py", line 1391, in
> > pmGetArchiveEnd
> > status = libpcp.pmGetArchiveEnd ( tvp )
> > ctypes.ArgumentError: argument 1: <type 'exceptions.TypeError'>: expected
> > timeval instance instead of LP_timeval
> >
> > I fixed it as follows, though I'm not sure if it's the right way:
>
> Yep, that looks good. We'll need to extend the testsuite coverage
> as it appears this API is missing (see qa/src/test_pcp.python, and
> qa/707, and the attached path). The codebase you're using doesn't
> appear to match what I have here though...
>
> > --- pcp.py.O 2014-03-14 01:33:57.000000000 -0500
> > +++ pcp.py 2014-03-21 20:27:59.000000000 -0500
> > @@ -645,7 +645,7 @@ libpcp.pmGetArchiveLabel.restype = c_int
> > libpcp.pmGetArchiveLabel.argtypes = [ POINTER(pmLogLabel) ]
> >
> > libpcp.pmGetArchiveEnd.restype = c_int
> > -libpcp.pmGetArchiveEnd.argtypes = [ timeval ]
> > +libpcp.pmGetArchiveEnd.argtypes = [ POINTER(timeval) ]
> >
> > libpcp.pmGetInDomArchive.restype = c_int
> > libpcp.pmGetInDomArchive.argtypes = [
> > @@ -1384,11 +1384,11 @@ class pmContext( object ):
> > def pmGetArchiveEnd( self ):
> > """PMAPI - Get the last recorded timestamp from the archive
> > """
> > - tvp = POINTER(timeval)()
> > + tvp = timeval()
> > status = libpcp.pmUseContext( self.ctx )
> > if status < 0:
> > raise pmErr, status
> > - status = libpcp.pmGetArchiveEnd ( tvp )
> > + status = libpcp.pmGetArchiveEnd ( byref(tvp) )
> > if status < 0:
> > raise pmErr, status
> > return status, tvp
> >
> > Can someone please review? Thanks.
> >
>
> So in the current version of PCP (and for quite some time IIRC -
> Stan will know for sure though), the error handling in the python
> API makes use of exceptions rather than this kind of status/value
> tuple.
>
> > On a related note, is the loglabel argument to pmGetArchiveLabel()
> > necessary, given that it's called similar to pmGetArchiveEnd()?
>
> I think the answer to that question is different on the code you
> are using versus current PCP.
>
> Can you make use of the code from git://oss.sgi.com/pcp/pcp and
> resend your patch against that? (other than that your patch looks
> fine to be merged, along with the QA patch I've attached).
>
> cheers.
>
> --
> Nathan
>
pmapi-py-qa.patch
Description: Text Data
|