Skip to content

Commit c0f4500

Browse files
committed
fix heartbeat
1 parent 616e22d commit c0f4500

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

CHANGELOG.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,33 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
66

77
## [Unreleased]
88

9+
### Changed
10+
- Heartbeat is now every five minutes, was every 5 seconds
11+
- the python3 images were actually python2 images
12+
913
## 2.2.0 - 2019-04-03
1014

1115
### Fixed
1216
- Code is now compatible with both Python 2 and Python 3.
1317
- RabbitMQ queue name can be different from extractor name.
1418
- Updated dependencies.
15-
- A race condition existed where an ACK could be lost, resulting in an extractor not processing more messages [CATSPYC-1](https://opensource.ncsa.illinois.edu/jira/browse/CATSPYC-1)
16-
- Error decoding messages where filename contains non-ascii characters[CATSPYC-18](https://opensource.ncsa.illinois.edu/jira/browse/CATSPYC-18)
19+
- A race condition existed where an ACK could be lost, resulting in an extractor not processing more messages
20+
[CATSPYC-1](https://opensource.ncsa.illinois.edu/jira/browse/CATSPYC-1)
21+
- Error decoding messages where filename contains non-ascii characters
22+
[CATSPYC-18](https://opensource.ncsa.illinois.edu/jira/browse/CATSPYC-18)
1723

1824
### Changed
19-
- files.upload_preview and collections.upload_preview does not require section_id for metadata [CATS-935](https://opensource.ncsa.illinois.edu/jira/browse/CATS-935)
20-
- Extractors will not register by default to clowder [CATSPYC-1](https://opensource.ncsa.illinois.edu/jira/browse/CATSPYC-1)
25+
- files.upload_preview and collections.upload_preview does not require section_id for metadata
26+
[CATS-935](https://opensource.ncsa.illinois.edu/jira/browse/CATS-935)
27+
- Extractors will not register by default to clowder
28+
[CATSPYC-1](https://opensource.ncsa.illinois.edu/jira/browse/CATSPYC-1)
2129

2230
### Added
2331
- Simple R extractor. Allows wrapping R code as a clowder extractor, see sample-extractors/wordcount-simple-r-extractor for an example.
24-
- Email notification when extraction is done [CATSPYC-17](https://opensource.ncsa.illinois.edu/jira/browse/CATSPYC-17)
25-
- Docker compose file for starting up the Clowder stack [BD-2226](https://opensource.ncsa.illinois.edu/jira/browse/BD-2226)
32+
- Email notification when extraction is done
33+
[CATSPYC-17](https://opensource.ncsa.illinois.edu/jira/browse/CATSPYC-17)
34+
- Docker compose file for starting up the Clowder stack
35+
[BD-2226](https://opensource.ncsa.illinois.edu/jira/browse/BD-2226)
2636
- PyClowder will now send heartbeats on extractors exchange, processes can listen for broadcast to get notified when new extractors come online.
2737
- Monitor application to leverage new heartbeat send out by extractors
2838
- Extractors now send version and name to clowder as part of the agent information.

pyclowder/connectors.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,8 @@ class RabbitMQConnector(Connector):
621621
# pylint: disable=too-many-arguments
622622
def __init__(self, extractor_name, extractor_info,
623623
rabbitmq_uri, rabbitmq_exchange=None, rabbitmq_key=None, rabbitmq_queue=None,
624-
check_message=None, process_message=None, ssl_verify=True, mounted_paths=None):
624+
check_message=None, process_message=None, ssl_verify=True, mounted_paths=None,
625+
heartbeat=5*60):
625626
super(RabbitMQConnector, self).__init__(extractor_name, extractor_info, check_message, process_message,
626627
ssl_verify, mounted_paths)
627628
self.rabbitmq_uri = rabbitmq_uri
@@ -636,6 +637,7 @@ def __init__(self, extractor_name, extractor_info,
636637
self.consumer_tag = None
637638
self.worker = None
638639
self.announcer = None
640+
self.heartbeat = 5*60
639641

640642
def connect(self):
641643
"""connect to rabbitmq using URL parameters"""
@@ -678,7 +680,7 @@ def connect(self):
678680
routing_key="extractors." + self.extractor_name)
679681

680682
# start the extractor announcer
681-
self.announcer = RabbitMQBroadcast(self.rabbitmq_uri, self.extractor_info, self.rabbitmq_queue, 5)
683+
self.announcer = RabbitMQBroadcast(self.rabbitmq_uri, self.extractor_info, self.rabbitmq_queue, self.heartbeat)
682684
self.announcer.start_thread()
683685

684686
def listen(self):
@@ -808,8 +810,8 @@ def send_heartbeat(self):
808810
}
809811
while self.thread:
810812
try:
811-
time.sleep(self.heartbeat)
812813
self.channel.basic_publish(exchange='extractors', routing_key='', body=json.dumps(message))
814+
time.sleep(self.heartbeat)
813815
except SystemExit:
814816
raise
815817
except KeyboardInterrupt:

0 commit comments

Comments
 (0)