wfdriver config files in wfrog 0.8.2

110 views
Skip to first unread message

PK

unread,
Feb 19, 2012, 3:25:00 PM2/19/12
to wfrog-users
Hello

Nice that 0.8.2 is released!

I have resinstalled Debian 6 (python 2.6) and wfrog 0.8.2, and
manually converted my 0.8.1 config files to the 0.8.2.

I have also modified config files to use mysql DB and some more
sensors on wmr928nx.

After wfrog -S I ran wfrog -v
which crashes early, probably reading wfdriver config file.
Is that format no longer yaml compliant?

I also tried to change 3 soft links in /usr/bin to v2.5 pythons, but
no difference.

Any help appreciated; I know to little Python... Thanks

Here is the debug log (commented):
------------------------------------------------------
wfrog -v
Exception in thread Thread-3:
Traceback (most recent call last):
File "/usr/lib/python2.5/threading.py", line 486, in __bootstrap_inner
self.run()

File "/usr/lib/python2.5/threading.py", line 446, in run
self.__target(*self.__args, **self.__kwargs)

File "/usr/lib/wfrog/wfdriver/wfdriver.py", line 110, in run
self.configure(config_file, settings_file, embedded)

File "/usr/lib/wfrog/wfdriver/wfdriver.py", line 82, in configure
(config, context) = self.configurer.configure(options, self,
config_file, settings_file, embedded)

File "/usr/lib/wfrog/wfcommon/config.py", line 110, in configure
config = yaml.load( str(Template(file=file(self.config_file, "r"),
searchList=[variables])))

File "/usr/lib/python2.5/site-packages/yaml/__init__.py", line 58, in
load
return loader.get_single_data()

File "/usr/lib/python2.5/site-packages/yaml/constructor.py", line 42,
in get_single_data
node = self.get_single_node()

File "/usr/lib/python2.5/site-packages/yaml/composer.py", line 36, in
get_single_node
document = self.compose_document()

File "/usr/lib/python2.5/site-packages/yaml/composer.py", line 55, in
compose_document
node = self.compose_node(None, None)

File "/usr/lib/python2.5/site-packages/yaml/composer.py", line 84, in
compose_node
node = self.compose_mapping_node(anchor)

File "/usr/lib/python2.5/site-packages/yaml/composer.py", line 127, in
compose_mapping_node
while not self.check_event(MappingEndEvent):

??? are wfrog config files conformant to YAML scalars (plain) in
python2.5?

File "/usr/lib/python2.5/site-packages/yaml/parser.py", line 93, in
check_event
self.current_event = self.state()

File "/usr/lib/python2.5/site-packages/yaml/parser.py", line 434, in
parse_block_mapping_key
"expected <block end>, but found %r" % token.id, token.start_mark)
ParserError: while parsing a block mapping
in "<string>", line 1, column 1:
station: !wmr928nx { }
^
expected <block end>, but found '<block mapping start>'
in "<string>", line 2, column 5:
port: /dev/ttyS0
^
----

The code in parser.py is:

def parse_block_mapping_key(self):
if self.check_token(KeyToken):
token = self.get_token()
if not self.check_token(KeyToken, ValueToken,
BlockEndToken):
self.states.append(self.parse_block_mapping_value)
return self.parse_block_node_or_indentless_sequence()
else:
self.state = self.parse_block_mapping_value
return self.process_empty_scalar(token.end_mark)
if not self.check_token(BlockEndToken):
token = self.peek_token()
raise ParserError("while parsing a block mapping",
self.marks[-1],
"expected <block end>, but found %r" % token.id,
token.start_mark)
(continues)

Jordi Puigsegur Figueras

unread,
Feb 20, 2012, 7:39:27 AM2/20/12
to wfrog...@googlegroups.com
Please, 
Can you create an issue and attach your wfdriver.yaml config file?

Thanks
Jordi.

2012/2/19 PK <pk2...@gmail.com>

PK

unread,
Feb 20, 2012, 8:23:47 AM2/20/12
to wfrog-users
OK: Issue 105
http://code.google.com/p/wfrog/issues/detail?id=105&thanks=105&ts=1329743914

On 20 Feb, 13:39, Jordi Puigsegur Figueras <jordi.puigse...@gmail.com>
wrote:

PK

unread,
Feb 25, 2012, 2:31:46 PM2/25/12
to wfrog-users
Hello again

Now I have contiued testing, and since I have
- upgraded to 0.8.2 and included update http://code.google.com/p/wfrog/source/detail?r=888
- have a wmr928nx with 3 extra sensors (1 temp+hum, 2 temp): i.e 5 T
and 3 hum
- first tried to use mysql because of more sensor but stopped because
of problems (below)

I have 3 questions:

Q1:
I reverted back to csv file storage (storage.yaml) for test, though
chart_ackumulator.yaml still contains temp 2,3,5 and hum 2. I put a
print in aggregator.py: problem is with sensor Hum2.
I get the following error printout with wfrog -v:

Sensor: 0
Sensor: 1
Sensor: 2
2012-02-25 20:10:58,933 ERROR [wflogger] Could not send event to
<wfcommon.generic.YamlMultiElement object at 0x8ef910>
Traceback (most recent call last):
File "/usr/lib/wfrog/wflogger/wflogger.py", line 127, in output_loop
self.collector.send_event(event, context=context)
File "/usr/lib/wfrog/wfcommon/generic/multi.py", line 62, in _call
result[name] = r.__getattribute__(attr).__call__(*args,
**keywords)
File "/usr/lib/wfrog/wflogger/collector/buffer.py", line 99, in
send_event
self.forward_event(event_to_send, context)
File "/usr/lib/wfrog/wflogger/collector/buffer.py", line 133, in
forward_event
self.do_send(flush_event, context)
File "/usr/lib/wfrog/wflogger/collector/buffer.py", line 139, in
do_send
self.collector.send_event(event, context)
File "/usr/lib/wfrog/wflogger/collector/base.py", line 47, in
send_event
self.flush(context)
File "/usr/lib/wfrog/wflogger/collector/aggregator.py", line 198, in
flush
sample = self.get_data()
File "/usr/lib/wfrog/wflogger/collector/aggregator.py", line 147, in
get_data
data[hsn] = round(sum(self._hum[sensor])/len(self._hum[sensor]),
1)
ZeroDivisionError: integer division or modulo by zero

Q2:
How could I see the flow of data through wfrog?
Now I have to wait to see what goes wrong, or output in wfrog.csv (not
yet).

Q3:
When I will switch over to mysql later, how do you suggest I see wfrog
table content in a simple way with the text gui in Debian 6 on the
NLSU2? (I failed to connect from another PC on the LAN with Mysql
Administrator)

Thanks for help
/PK

On 20 Feb, 14:23, PK <pk2...@gmail.com> wrote:
> OK:  Issue 105http://code.google.com/p/wfrog/issues/detail?id=105&thanks=105&ts=132...

PK

unread,
Feb 27, 2012, 4:47:47 AM2/27/12
to wfrog-users
I might have found something on question Q1.

I have a Oregon station with extra temp/temp-hum sensors.

Considering that not all extra temp sensors have hum sensor, I have
tried this mod to aggregator.py (line 144-147) in wflogger:

if len(self._hum[sensor]) > 0:
data[hsn] = round(sum(self._hum[sensor])/
len(self._hum[sensor]), 1)

The omitted warning is not relevant.

I could update trunk if this proves to work well.


On 25 Feb, 20:31, PK <pk2...@gmail.com> wrote:
> Hello again
>
> Now I have contiued testing, and since I have
> - upgraded to 0.8.2 and included updatehttp://code.google.com/p/wfrog/source/detail?r=888

Jordi Puigsegur Figueras

unread,
Feb 28, 2012, 5:19:43 PM2/28/12
to wfrog...@googlegroups.com
Hi,

You are right, this is a bug. The second if must be "_hum" instead of "_temp", i.e.:

if len(self._temp[sensor]) > 0:
    data[tsn] = round(sum(self._temp[sensor])/len(self._temp[sensor]), 1)
elif sensor == MAIN_TH_SENSOR:
    self.logger.warning('Missing temperature data')

if len(self._hum[sensor]) > 0:
    data[hsn] = round(sum(self._hum[sensor])/len(self._hum[sensor]), 1)
elif sensor == MAIN_TH_SENSOR:
    self.logger.warning('Missing humidity data')

The warning could stay since it shows when there is no humidity data from the main TH sensor. It is a relevant warning since that humidity data is used in the dew point calculation.

Jordi.


2012/2/27 PK <pk2...@gmail.com>

Jordi Puigsegur Figueras

unread,
Feb 29, 2012, 12:48:25 AM2/29/12
to wfrog...@googlegroups.com
Hi,

Q1 seems to have been answered, so I will answer the other two questions.

Q2:
How could I see the flow of data through wfrog?
Now I have to wait to see what goes wrong, or output in wfrog.csv (not
yet).


You can increase log level and then do a tail -f to the /var/log/wflogger.log file. You'll see the flow of data received from the station.
 
Q3:
When I will switch over to mysql later, how do you suggest I see wfrog
table content in a simple way with the text gui in Debian 6 on the
NLSU2? (I failed to connect from another PC on the LAN with Mysql
Administrator)

You can use SQL commands directly. For instance, to retrieve some variables from the last five measures you will do: 

$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 76
Server version: 5.1.49-1ubuntu8.1 (Ubuntu)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use wfrog;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> SELECT TIMESTAMP_LOCAL, TEMP, HUM, RAIN, PRESSURE, WIND_GUST FROM METEO ORDER BY TIMESTAMP_LOCAL DESC LIMIT 5;
+---------------------+------+------+------+----------+-----------+
| TIMESTAMP_LOCAL     | TEMP | HUM  | RAIN | PRESSURE | WIND_GUST |
+---------------------+------+------+------+----------+-----------+
| 2012-01-05 17:00:19 |  6.4 | 55.0 |  0.0 |    978.9 |      15.1 |
| 2012-01-05 16:50:19 |  6.4 | 57.0 |  0.0 |    978.3 |      10.9 |
| 2012-01-05 16:40:16 |  6.5 | 56.0 |  0.0 |    977.0 |      10.7 |
| 2012-01-05 16:30:12 |  6.5 | 55.0 |  0.0 |    977.9 |       6.9 |
| 2012-01-05 16:20:09 |  6.4 | 57.0 |  0.0 |    977.7 |       5.9 |
+---------------------+------+------+------+----------+-----------+
5 rows in set (0.01 sec)


Jordi.

PK

unread,
Mar 1, 2012, 12:45:53 PM3/1/12
to wfrog-users
Thanks for info, helpful.

I have updated trunk (r889), please check read for me.

And finally, my weather page works fine again (v.pk2.se).

/PK

On 29 Feb, 06:48, Jordi Puigsegur Figueras <jordi.puigse...@gmail.com>
wrote:
Reply all
Reply to author
Forward
0 new messages