Skip to content

Commit 1a862a8

Browse files
committed
rwrapper function renaming
1 parent 30af489 commit 1a862a8

5 files changed

Lines changed: 17 additions & 11 deletions

File tree

server/workers/base/src/base.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def next_item(self):
2020
endpoint = msg.get('endpoint')
2121
return k, params, endpoint
2222

23-
def execute_r(self, params):
23+
def execute_search(self, params):
2424
q = params.get('q')
2525
service = params.get('service')
2626
data = {}
@@ -52,14 +52,16 @@ def execute_r(self, params):
5252
self.logger.error(error)
5353
raise
5454

55+
def execute_contentproviders(self):
56+
5557
def run(self):
5658
while True:
5759
k, params, endpoint = self.next_item()
5860
self.logger.debug(k)
5961
self.logger.debug(params)
6062
if endpoint == "search":
6163
try:
62-
res = self.execute_r(params)
64+
res = self.execute_search(params)
6365
res["id"] = k
6466
if res.get("status") == "error" or params.get('raw') is True:
6567
self.redis_store.set(k+"_output", json.dumps(res))
@@ -68,3 +70,7 @@ def run(self):
6870
except Exception as e:
6971
self.logger.exception("Exception during data retrieval.")
7072
self.logger.error(params)
73+
74+
if endpoint == "contentproviders":
75+
try:
76+
res = self.execute

server/workers/common/r_wrapper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def add_default_params(self, params):
3737
def next_item(self):
3838
raise NotImplementedError
3939

40-
def execute_r(self, params):
40+
def execute_search(self, params):
4141
raise NotImplementedError
4242

4343
def run(self):
@@ -49,7 +49,7 @@ def run(self):
4949
try:
5050
res = {}
5151
res["id"] = k
52-
res["input_data"] = self.execute_r(params)
52+
res["input_data"] = self.execute_search(params)
5353
res["params"] = params
5454
if params.get('raw') is True:
5555
redis_store.set(k+"_output", json.dumps(res))

server/workers/dataprocessing/src/headstart.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def next_item(self):
5252
input_data = msg.get('input_data')
5353
return k, params, input_data
5454

55-
def execute_r(self, params, input_data):
55+
def execute_search(self, params, input_data):
5656
q = params.get('q')
5757
service = params.get('service')
5858
data = {}
@@ -92,7 +92,7 @@ def run(self):
9292
if params.get('vis_type') == "timeline":
9393
# the step of create_map can be dropped once deduplication is possible in API backend as well
9494
# TODO: create deduplicate endpoint in service worker and connect to that
95-
metadata = self.execute_r(params, input_data)
95+
metadata = self.execute_search(params, input_data)
9696
sg_data = sg.get_streamgraph_data(json.loads(metadata),
9797
params.get('q'),
9898
params.get('top_n', 12),
@@ -103,7 +103,7 @@ def run(self):
103103
res["status"] = "success"
104104
self.redis_store.set(k+"_output", json.dumps(res))
105105
else:
106-
res = self.execute_r(params, input_data)
106+
res = self.execute_search(params, input_data)
107107
self.redis_store.set(k+"_output", json.dumps(res))
108108
except ValueError as e:
109109
self.logger.error(params)

server/workers/openaire/src/openaire.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def next_item(self):
1919
endpoint = msg.get('endpoint')
2020
return k, params, endpoint
2121

22-
def execute_r(self, params):
22+
def execute_search(self, params):
2323
q = params.get('acronym')
2424
service = params.get('service')
2525
data = {}
@@ -52,7 +52,7 @@ def run(self):
5252
try:
5353
res = {}
5454
res["id"] = k
55-
res["input_data"] = self.execute_r(params)
55+
res["input_data"] = self.execute_search(params)
5656
res["params"] = params
5757
if params.get('raw') is True:
5858
self.redis_store.set(k+"_output", json.dumps(res))

server/workers/pubmed/src/pubmed.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def next_item(self):
1919
endpoint = msg.get('endpoint')
2020
return k, params, endpoint
2121

22-
def execute_r(self, params):
22+
def execute_search(self, params):
2323
q = params.get('q')
2424
service = params.get('service')
2525
data = {}
@@ -52,7 +52,7 @@ def run(self):
5252
try:
5353
res = {}
5454
res["id"] = k
55-
res["input_data"] = self.execute_r(params)
55+
res["input_data"] = self.execute_search(params)
5656
res["params"] = params
5757
if params.get('raw') is True:
5858
self.redis_store.set(k+"_output", json.dumps(res))

0 commit comments

Comments
 (0)