Skip to content

Commit 7d433d0

Browse files
committed
Fix linting error and add docstring
1 parent caa39db commit 7d433d0

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

mem3_helper.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
# This file grabs the list of pod names behind the headless service
2-
# called "couchdb" and feeds those as `couchdb@HOSTNAME` nodes to mem3.
1+
"""Helper module to connect a CouchDB Kube StatefulSet
2+
3+
This script grabs the list of pod names behind the headless service
4+
associated with our StatefulSet and feeds those as `couchdb@FQDN`
5+
nodes to mem3.
6+
"""
37

48
import json
59
import requests
@@ -34,12 +38,12 @@ def connect_the_dots(names, retries=5):
3438
uri = "http://127.0.0.1:5986/_nodes/couchdb@{0}".format(name)
3539
doc = {}
3640
try:
37-
r = requests.put(uri, data = json.dumps(doc))
38-
if r.status_code == 404:
41+
resp = requests.put(uri, data=json.dumps(doc))
42+
if resp.status_code == 404:
3943
print('CouchDB nodes DB does not exist yet')
4044
time.sleep(5)
4145
connect_the_dots(names, retries - 1)
42-
print(name, r.status_code)
46+
print(name, resp.status_code)
4347
except requests.exceptions.ConnectionError:
4448
print('CouchDB admin port not up yet')
4549
time.sleep(5)

0 commit comments

Comments
 (0)