pcp
[Top] [All Lists]

Re: [pcp] JSON PMDA

To: David Smith <dsmith@xxxxxxxxxx>
Subject: Re: [pcp] JSON PMDA
From: Nathan Scott <nathans@xxxxxxxxxx>
Date: Fri, 10 Apr 2015 01:10:06 -0400 (EDT)
Cc: pcp <pcp@xxxxxxxxxxx>
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <2139482617.15593599.1428634701360.JavaMail.zimbra@xxxxxxxxxx>
References: <54F9F92D.4010202@xxxxxxxxxx> <448002717.7934024.1427683964254.JavaMail.zimbra@xxxxxxxxxx> <552699FE.7040801@xxxxxxxxxx> <2139482617.15593599.1428634701360.JavaMail.zimbra@xxxxxxxxxx>
Reply-to: Nathan Scott <nathans@xxxxxxxxxx>
Thread-index: Y913zHNgvdsy+6kWIs+vfQd6ei6EQQSMg4lt
Thread-topic: JSON PMDA

----- Original Message -----
> ----- Original Message -----
> > [...]
> > I got rid of the utf-8 encoding, and I get the following error (using
> > "count" as the unit):
> > 
> >   PM_ERR_CONV Impossible value or scale conversion count
> > 
> > So, there must be a bug still lurking there.
> >
> 
> Hmmm.  Below the API the code looks like this:
> 
>     @staticmethod
>     def pmParseUnitsStr(string):
>         if type(string) != type('') and type(string) != type(b''):
>             raise pmErr(c_api.PM_ERR_CONV, str(string))
>         if type(string) != type(b''):
>             string = string.encode('utf-8')
> 
> I'm not sure what you meant by 'using the "count" as unit' above - what's
> the type of "count"?  I guess its failing that check on the first line,
> which is expecting either unicode or string of bytes.

Tick, tick, tick ... neurons finally fire ... oh, I think I see what you meant
now - "count", as in the literal string "count", not a variable, heh.  However
I'm still getting good results with that here:

$ python 
Python 2.7.5 (default, Nov  3 2014, 14:26:24) 
[GCC 4.8.3 20140911 (Red Hat 4.8.3-7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pcp import pmapi
>>> import cpmapi as c_api
>>> context = pmapi.pmContext()
>>> context.pmParseUnitsStr("count")
(<pcp.pmapi.pmUnits object at 0x7ff718e7c710>, 1.0)
>>> ^D

$ python3
Python 3.3.2 (default, Dec  4 2014, 12:49:00) 
[GCC 4.8.3 20140911 (Red Hat 4.8.3-7)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pcp import pmapi
>>> import cpmapi as c_api
>>> context = pmapi.pmContext()
>>> context.pmParseUnitsStr("count")
(<pcp.pmapi.pmUnits object at 0x7f9e3952fb00>, 1.0)
>>> ^D


I guess one of those fails with an exception for you locally?

cheers.

--
Nathan

<Prev in Thread] Current Thread [Next in Thread>