Skip to content

Commit

Permalink
Altered rtgdthread queue managment to fix 100% CPU usage problem
Browse files Browse the repository at this point in the history
v0.3.2. release
  • Loading branch information
gjr80 committed Jan 20, 2018
1 parent cfa290d commit 61e0a54
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 20 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ The *Realtime gauge-data* extension can be installed manually or automatically u
1. Download the latest *Realtime gauge-data* extension from the *Realtime gauge-data* extension [releases page](https://github.com/gjr80/weewx-realtime_gauge-data/releases) into a directory accessible from the weeWX machine.


wget -P $DOWNLOAD_ROOT https://github.com/gjr80/weewx-realtime_gauge-data/releases/download/v0.3.1/rtgd-0.3.1.tar.gz
wget -P $DOWNLOAD_ROOT https://github.com/gjr80/weewx-realtime_gauge-data/releases/download/v0.3.2/rtgd-0.3.2.tar.gz

where $DOWNLOAD_ROOT is the path to the directory where the *Realtime gauge-data* extension is to be downloaded.

Expand All @@ -49,15 +49,15 @@ The *Realtime gauge-data* extension can be installed manually or automatically u

3. Install the *Realtime gauge-data* extension downloaded at step 1 using the *wee_extension* utility:

wee_extension --install=$DOWNLOAD_ROOT/rtgd-0.3.1.tar.gz
wee_extension --install=$DOWNLOAD_ROOT/rtgd-0.3.2.tar.gz

This will result in output similar to the following:

Request to install '/var/tmp/rtgd-0.3.1.tar.gz'
Extracting from tar archive /var/tmp/rtgd-0.3.1.tar.gz
Request to install '/var/tmp/rtgd-0.3.2.tar.gz'
Extracting from tar archive /var/tmp/rtgd-0.3.2.tar.gz
Saving installer file to /home/weewx/bin/user/installer/Rtgd
Saved configuration dictionary. Backup copy at /home/weewx/weewx.conf.20170215124410
Finished installing extension '/var/tmp/rtgd-0.3.1.tar.gz'
Finished installing extension '/var/tmp/rtgd-0.3.2.tar.gz'

4. Start weeWX:

Expand All @@ -73,13 +73,13 @@ This will result in the *gauge-data.txt* file being generated on receipt of each

1. Download the latest *Realtime gauge-data* extension from the Realtime gauge-data [releases page](https://github.com/gjr80/weewx-realtime_gauge-data/releases) into a directory accessible from the weeWX machine.

wget -P $DOWNLOAD_ROOT https://github.com/gjr80/weewx-realtime_gauge-data/releases/download/v0.3.1/rtgd-0.3.1.tar.gz
wget -P $DOWNLOAD_ROOT https://github.com/gjr80/weewx-realtime_gauge-data/releases/download/v0.3.2/rtgd-0.3.2.tar.gz

where $DOWNLOAD_ROOT is the path to the directory where the *Realtime gauge-data* extension is to be downloaded.

2. Unpack the extension as follows:

tar xvfz rtgd-0.3.1.tar.gz
tar xvfz rtgd-0.3.2.tar.gz

3. Copy files from within the resulting directory as follows:

Expand Down
12 changes: 8 additions & 4 deletions bin/user/rtgd.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@
# You should have received a copy of the GNU General Public License along with
# this program. If not, see http://www.gnu.org/licenses/.
#
# Version: 0.3.1 Date: 3 December 2017
# Version: 0.3.2 Date: 20 January 2018
#
# Revision History
# 20 January 2018 v0.3.2
# - modified rtgdthread queue management to fix 100% CPU usage issue
# 3 December 2017 v0.3.1
# - added ignore_lost_contact config option to ignore the sensor contact
# check result
# - refactored lost contact flag check code, now uses a dedictaed method
# - refactored lost contact flag check code, now uses a dedicated method
# to determine whether sensor contact has been lost
# - changed a syslog entry to indicate 'rtgd' as the source not 'engine'
# 4 September 2017 v0.3.0
Expand Down Expand Up @@ -63,7 +65,7 @@
# 'wedge' would occasionally temporarily disappear from wind speed
# gauge
# 28 February 2017 v0.2.8
# - Reworked day max/min calculations to better handle missing historical
# - reworked day max/min calculations to better handle missing historical
# data. If historical max/min data is missing day max/min will default
# to the current value for the obs concerned.
# 26 February 2017 v0.2.7
Expand Down Expand Up @@ -947,7 +949,9 @@ def run(self):
self.forecast_text = _package['payload']
# now deal with the control queue
try:
_package = self.control_queue.get_nowait()
# block for one second waiting for package, if nothing
# received throw Queue.Empty
_package = self.control_queue.get(True, 1.0)
except Queue.Empty:
# nothing in the queue so continue
pass
Expand Down
2 changes: 2 additions & 0 deletions changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
v0.3.2
* modified rtdgthread queue management to fix 100% CPU usage issue
v0.3.1
* added ignore_lost_contact config option to ignore the sensor contact
check result
Expand Down
6 changes: 4 additions & 2 deletions install.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
#
# Installer for Realtime gauge-data
#
# Version: 0.3.1 Date: 3 December 2017
# Version: 0.3.2 Date: 20 January 2018
#
# Revision History
# 20 January 2018 v0.3.2
# - bumped version only
# 3 December 2017 v0.3.1
# - bumped version only
# 4 September 2017 v0.3.0
Expand Down Expand Up @@ -59,7 +61,7 @@
from setup import ExtensionInstaller

REQUIRED_VERSION = "3.4.0"
RTGD_VERSION = "0.3.1"
RTGD_VERSION = "0.3.2"


def loader():
Expand Down
14 changes: 7 additions & 7 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ gauge-data releases page (https://github.com/gjr80/weewx-realtime_gauge-data
a directory accessible from the weeWX machine.

wget -P $DOWNLOAD_ROOT https://github.com/gjr80/weewx-realtime_gauge-data
/releases/download/v0.3.1/rtgd-0.3.1.tar.gz
/releases/download/v0.3.2/rtgd-0.3.2.tar.gz

where $DOWNLOAD_ROOT is the path to the directory where the Realtime
gauge-data extension is to be downloaded.
Expand All @@ -59,15 +59,15 @@ a directory accessible from the weeWX machine.
3. Install the Realtime gauge-data extension downloaded at step 1 using the
wee_extension utility:

wee_extension --install=$DOWNLOAD_ROOT/rtgd-0.3.1.tar.gz
wee_extension --install=$DOWNLOAD_ROOT/rtgd-0.3.2.tar.gz

This will result in output similar to the following:

Request to install '/var/tmp/rtgd-0.3.1.tar.gz'
Extracting from tar archive /var/tmp/rtgd-0.3.1.tar.gz
Request to install '/var/tmp/rtgd-0.3.2.tar.gz'
Extracting from tar archive /var/tmp/rtgd-0.3.2.tar.gz
Saving installer file to /home/weewx/bin/user/installer/Rtgd
Saved configuration dictionary. Backup copy at /home/weewx/weewx.conf.20161123124410
Finished installing extension '/var/tmp/rtgd-0.3.1.tar.gz'
Finished installing extension '/var/tmp/rtgd-0.3.2.tar.gz'

4. Start weeWX:

Expand All @@ -91,14 +91,14 @@ gauge-data releases page (https://github.com/gjr80/weewx-realtime_gauge-data
a directory accessible from the weeWX machine.

wget -P $DOWNLOAD_ROOT https://github.com/gjr80/weewx-realtime_gauge-data
/releases/download/v0.3.1/rtgd-0.3.1.tar.gz
/releases/download/v0.3.2/rtgd-0.3.2.tar.gz

where $DOWNLOAD_ROOT is the path to the directory where the Realtime
gauge-data extension is to be downloaded.

2. Unpack the extension as follows:

tar xvfz rtgd-0.3.1.tar.gz
tar xvfz rtgd-0.3.2.tar.gz

3. Copy files from within the resulting folder as follows:

Expand Down

0 comments on commit 61e0a54

Please sign in to comment.