Skip to content

Commit 2e3baa2

Browse files
author
Istemi Ekin Akkus
authored
Merge pull request #38 from knix-microfunctions/release/0.8.4
Release/0.8.4
2 parents 62c8e23 + ce9e748 commit 2e3baa2

File tree

102 files changed

+1663
-1166
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+1663
-1166
lines changed

DataLayerService/Makefile

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,33 @@
1414

1515
SHELL := /bin/bash
1616
-include ../proxy.mk
17+
include ../build_env.mk
1718
UID:=`id -u`
1819
GID:=`id -g`
19-
all: \
20+
21+
all: build_thrift \
2022
target/datalayerservice.jar
2123

22-
src/main/java/org/microfunctions/data_layer/DataLayerService.java: \
23-
thrift/DataLayerMessage.thrift \
24-
thrift/DataLayerService.thrift
24+
build_thrift:
25+
cd ../build_tools/thrift/$(THRIFT_VERSION)/; ./build_thrift.sh; cd -
26+
27+
src/main/java/org/microfunctions/data_layer/DataLayerService.java: ../build_env.mk \
28+
thrift/DataLayerMessage.thrift \
29+
thrift/DataLayerService.thrift
2530
docker run --rm -it --name datalayer-thrift \
2631
--user $(UID):$(GID) \
2732
-v $(CURDIR):/usr/src/datalayer -w /usr/src/datalayer \
28-
thrift:0.12.0 \
33+
$(THRIFT_IMAGE_NAME):$(THRIFT_VERSION) \
2934
bash -c 'thrift --gen java -out ./src/main/java/ ./thrift/DataLayerMessage.thrift; thrift --gen java -out ./src/main/java/ ./thrift/DataLayerService.thrift'
3035
touch src/main/java/org/microfunctions/data_layer/DataLayerService.java
3136

32-
PythonClient/data_layer:
37+
PythonClient/data_layer: ../build_env.mk \
38+
thrift/DataLayerMessage.thrift \
39+
thrift/DataLayerService.thrift
3340
docker run --rm -it --name datalayer-thrift \
3441
--user $(UID):$(GID) \
3542
-v $(CURDIR):/usr/src/datalayer -w /usr/src/datalayer \
36-
thrift:0.12.0 \
43+
$(THRIFT_IMAGE_NAME):$(THRIFT_VERSION) \
3744
bash -c 'thrift --gen py -out ./PythonClient ./thrift/DataLayerMessage.thrift; thrift --gen py -out ./PythonClient ./thrift/DataLayerService.thrift'
3845

3946
# In case the user doesn't have maven configurations in the home directory, we need to create it
@@ -55,17 +62,15 @@ PythonClient/data_layer:
5562
JAVA_SOURCES=$(shell find src/ -type f|grep -v src/main/java/org/microfunctions/data_layer/DataLayerService.java)
5663
GIT_REVISION:=`git describe --tags --always --dirty=-dirty`
5764
target/datalayerservice.jar: $(JAVA_SOURCES) \
58-
src/main/java/org/microfunctions/data_layer/DataLayerService.java \
59-
thrift/DataLayerMessage.thrift \
60-
thrift/DataLayerService.thrift \
61-
~/.m2/settings-docker.xml
65+
src/main/java/org/microfunctions/data_layer/DataLayerService.java \
66+
~/.m2/settings-docker.xml
6267
if [ ! -e ~/.m2/repository ]; then mkdir -p ~/.m2/repository; fi
6368
docker run --rm -it --name datalayer-maven \
6469
--user $(UID):$(GID) \
6570
-v ~/.m2:/usr/share/maven/ref \
6671
-v $(CURDIR):/usr/src/datalayer -w /usr/src/datalayer \
6772
maven:3.6.1-jdk-8 \
68-
mvn -Drevision=$(GIT_REVISION) -DargLine="-Duser.home=/tmp" -s /usr/share/maven/ref/settings-docker.xml package
73+
mvn -Drevision=$(GIT_REVISION) -Dlibthrift.version=$(MVN_LIBTHRIFT_VERSION) -DargLine="-Duser.home=/tmp" -s /usr/share/maven/ref/settings-docker.xml package
6974

7075
clean:
7176
rm -rf ./target

DataLayerService/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<dependency>
2727
<groupId>org.apache.thrift</groupId>
2828
<artifactId>libthrift</artifactId>
29-
<version>0.12.0</version>
29+
<version>${libthrift.version}</version>
3030
</dependency>
3131
<dependency>
3232
<groupId>org.apache.logging.log4j</groupId>
@@ -51,7 +51,7 @@
5151
<artifactId>maven-assembly-plugin</artifactId>
5252
<version>3.1.1</version>
5353
<configuration>
54-
<finalName>datalayerservice</finalName>
54+
<finalName>datalayerservice</finalName>
5555
<appendAssemblyId>false</appendAssemblyId>
5656
<descriptorRefs>
5757
<descriptorRef>jar-with-dependencies</descriptorRef>

FunctionWorker/python/DataLayerClient.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
class DataLayerClient:
2929

30-
def __init__(self, locality=1, sid=None, wid=None, suid=None, is_wf_private=False, for_mfn=False, connect="127.0.0.1:4998", init_tables=False):
30+
def __init__(self, locality=1, sid=None, wid=None, suid=None, is_wf_private=False, for_mfn=False, connect="127.0.0.1:4998", init_tables=False, drop_keyspace=False):
3131
self.dladdress = connect
3232

3333
if for_mfn:
@@ -68,6 +68,9 @@ def __init__(self, locality=1, sid=None, wid=None, suid=None, is_wf_private=Fals
6868
if init_tables:
6969
self._initialize_tables()
7070

71+
if drop_keyspace:
72+
self._drop_keyspace()
73+
7174
def _initialize_tables(self):
7275
replication_factor = 3
7376
# just need the local instance
@@ -87,6 +90,12 @@ def _initialize_tables(self):
8790
print("Could not initialize tables: " + str(exc))
8891
raise
8992

93+
def _drop_keyspace(self):
94+
try:
95+
self.datalayer.dropKeyspace(self.keyspace, self.locality)
96+
except Thrift.TException as exc:
97+
print("Could not drop keyspace: " + str(exc))
98+
raise
9099

91100
def connect(self):
92101
retry = 0.5 #s

FunctionWorker/python/LocalQueueClient.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ def __init__(self, connect="127.0.0.1:4999"):
3636
self.connect()
3737

3838
def connect(self):
39+
host, port = self.qaddress.split(':')
3940
retry = 0.5 #s
4041
while True:
4142
try:
42-
host, port = self.qaddress.split(':')
4343
self.socket = TSocket.TSocket(host, int(port))
4444
self.transport = TTransport.TFramedTransport(self.socket)
4545
self.transport.open()
@@ -101,15 +101,8 @@ def getMultipleMessages(self, topic, max_count, timeout):
101101
return lqm_list
102102

103103
def shutdown(self):
104-
try:
105-
self.socket.handle.shutdown(socket.SHUT_RDWR)
106-
self.transport.close()
107-
except Thrift.TException as exc:
108-
print("[LocalQueueClient] failed shutdown: " + str(exc))
109-
except Exception as exc:
110-
print("[LocalQueueClient] failed shutdown: " + str(exc))
111-
raise
112-
finally:
104+
if self.transport.isOpen():
105+
#self.socket.handle.shutdown(socket.SHUT_RDWR)
113106
self.transport.close()
114107

115108
def addTopic(self, topic):

FunctionWorker/python/MicroFunctionsAPI.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82,25 +82,16 @@ def __init__(self, uid, sid, wid, funcstatename, key, publication_utils, is_sess
8282
#self._logger.debug("[MicroFunctionsAPI] init done.")
8383

8484
def ping(self, num):
85-
self._logger.info("ping:" + str(num))
85+
self._logger.info("ping: " + str(num))
8686
output = num
8787
return 'pong ' + str(output)
8888

89-
def get_privileged_data_layer_client(self, suid=None, keyspace=None, tablename=None, maptablename=None, settablename=None, countertablename=None, init_tables=False):
89+
def get_privileged_data_layer_client(self, suid=None, sid=None, init_tables=False, drop_keyspace=False):
9090
if self._is_privileged:
9191
if suid is not None:
92-
return DataLayerClient(locality=1, suid=suid, connect=self._datalayer, init_tables=init_tables)
93-
elif keyspace is not None and tablename is not None:
94-
dlc = DataLayerClient(locality=1, for_mfn=True, connect=self._datalayer)
95-
dlc.keyspace = keyspace
96-
dlc.tablename = tablename
97-
if maptablename is not None:
98-
dlc.maptablename = maptablename
99-
if settablename is not None:
100-
dlc.settablename = settablename
101-
if countertablename is not None:
102-
dlc.countertablename = countertablename
103-
return dlc
92+
return DataLayerClient(locality=1, suid=suid, connect=self._datalayer, init_tables=init_tables, drop_keyspace=drop_keyspace)
93+
elif sid is not None:
94+
return DataLayerClient(locality=1, for_mfn=True, sid=sid, connect=self._datalayer, drop_keyspace=drop_keyspace)
10495
return None
10596

10697
def update_metadata(self, metadata_name, metadata_value, is_privileged_metadata=False):

FunctionWorker/python/StateUtils.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -442,23 +442,7 @@ def evaluateMapState(self, function_input, key, metadata, sapi):
442442

443443
#assert total_branch_count == len(self.parsedfunctionstateinfo["Branches"])
444444

445-
k_list = []
446-
447-
if "WaitForNumBranches" in self.parsedfunctionstateinfo:
448-
k_list = self.parsedfunctionstateinfo["WaitForNumBranches"]
449-
if not isinstance(k_list, list):
450-
self._logger.debug("[StateUtils] WaitForNumBranches must be a sorted list with 1 or more integers")
451-
raise Exception("[StateUtils] WaitForNumBranches must be a sorted list with 1 or more integers")
452-
k_list.sort()
453-
for k in k_list:
454-
if not isinstance(k, int):
455-
self._logger.debug("[StateUtils] Values inside WaitForNumBranches must be integers")
456-
raise Exception("[StateUtils] Values inside WaitForNumBranches must be integers")
457-
if k > total_branch_count:
458-
self._logger.debug("[StateUtils] Values inside WaitForNumBranches list cannot be greater than the number of branches in the map state")
459-
raise Exception("[StateUtils] Values inside WaitForNumBranches list cannot be greater than the number of branches in the map state")
460-
else:
461-
k_list.append(total_branch_count)
445+
k_list = [total_branch_count]
462446

463447
counter_name_trigger_metadata = {"k-list": k_list, "total-branches": total_branch_count}
464448

GUI/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
SHELL := /bin/bash
16+
1517
default: app/pages/docs/sdk/cli.md app/pages/docs/sdk/sdk.md
1618

1719
app/pages/docs/sdk/sdk.md: ../mfn_sdk/README.md

GUI/app/app.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,9 @@ var app = angular.module('MfnWebConsole', [
4545
var objectKey = '';
4646
var codeError = '';
4747

48-
var urlPath = managementServiceEndpoint; // from app/endpoint.js
48+
var urlPath = "/management";
4949
var dataPrefix = "value=";
5050

51-
52-
53-
5451
return {
5552

5653
getDataPrefix: function() {

GUI/app/pages/pages.module.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
'MfnWebConsole.pages.functions',
2626
'MfnWebConsole.pages.workflows',
2727
'MfnWebConsole.pages.storage',
28+
'MfnWebConsole.pages.profile',
2829
'MfnWebConsole.pages.docs'
2930

3031

0 commit comments

Comments
 (0)