Skip to content

Commit b76b2b1

Browse files
author
Istemi Ekin Akkus
committed
merge develop; fix conflicts
2 parents d07a43c + 6752fb7 commit b76b2b1

File tree

80 files changed

+914
-1073
lines changed

Some content is hidden

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

80 files changed

+914
-1073
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/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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ def __init__(self, uid, sid, wid, funcstatename, key, publication_utils, is_sess
8181

8282
#self._logger.debug("[MicroFunctionsAPI] init done.")
8383

84+
def ping(self, num):
85+
self._logger.info("ping: " + str(num))
86+
output = num
87+
return 'pong ' + str(output)
88+
8489
def get_privileged_data_layer_client(self, suid=None, sid=None, init_tables=False, drop_keyspace=False):
8590
if self._is_privileged:
8691
if suid is not None:

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/profile/ProfileCtrl.js

Lines changed: 32 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,29 @@
1616

1717
(function () {
1818
'use strict';
19-
19+
2020
angular.module('MfnWebConsole.pages.profile')
2121
.controller('ProfileCtrl', ProfileCtrl);
2222

23-
23+
2424

2525
/** @ngInject */
2626
function ProfileCtrl($scope, $http, sharedProperties, sharedData, toastr, $cookies, $uibModal) {
27-
2827
var urlPath = sharedProperties.getUrlPath();
2928

3029
$scope.workflows = sharedData.getWorkflows();
3130
$scope.currentWorkflow = "";
3231
$scope.workflowUndeploymentModal = "";
33-
32+
3433
$scope.email = $cookies.get('email');
3534
$scope.name = $cookies.get('name');
3635
var token = $cookies.get('token');
37-
36+
3837
$scope.updateProfile = function() {
39-
38+
4039
var newName = $("#inputName").val();
4140
var password = $("#currentPassword").val();
42-
41+
4342
// name change
4443
if (newName && newName!=$scope.name) {
4544
if (!password) {
@@ -66,9 +65,9 @@
6665
}
6766

6867
$scope.removeAccount = function() {
69-
70-
var password = $("#currentPassword").val();
71-
68+
69+
var password = $("#currentPassword").val();
70+
7271
if (!password) {
7372
$scope.errorMessage = "Please enter your password."
7473
$uibModal.open({
@@ -133,27 +132,22 @@
133132
$("#inputConfirmPassword").val("");
134133
changePassword(password, newPassword);
135134
}
136-
137135
}
138136
$("#currentPassword").val("");
139-
140137
}
141138

142139
function changeName(password, newName) {
143-
140+
144141
var req = {
145142
method: 'POST',
146143
url: urlPath,
147144
headers: {
148145
'Content-Type': 'application/json'
149146
},
150-
151147
data: JSON.stringify({ "action" : "changeName", "data" : { "user" : { "email" : $scope.email, "password" : password, "new_name" : newName } } })
152-
153148
}
154-
149+
155150
$http(req).then(function successCallback(response) {
156-
157151
if (response.data.status=="success") {
158152
console.log("Message:" + response.data.data.message);
159153
$cookies.put('name', newName);
@@ -187,34 +181,32 @@
187181
templateUrl: 'app/pages/workflows/modals/errorModal.html',
188182
size: 'md',
189183
});
190-
191184
});
192-
193185
}
194186

195187
function deleteAccount(password) {
196188

197189
if ($scope.workflowUndeploymentModal) {
198190
$scope.workflowUndeploymentModal.dismiss();
199191
}
200-
192+
201193
var req = {
202194
method: 'POST',
203195
url: urlPath,
204196
headers: {
205197
'Content-Type': 'application/json'
206198
},
207-
199+
208200
data: JSON.stringify({ "action" : "deleteAccount", "data" : { "user" : { "password": password, "token" : token } } })
209-
201+
210202
}
211-
203+
212204
$http(req).then(function successCallback(response) {
213-
205+
214206
if (response.data.status=="success") {
215207
console.log("Message:" + response.data.data.message);
216208
$scope.logOut();
217-
209+
218210
} else {
219211
console.log("Failure status returned by deleteAccount request");
220212
console.log("Message:" + response.data.data.message);
@@ -225,7 +217,7 @@
225217
templateUrl: 'app/pages/workflows/modals/errorModal.html',
226218
size: 'md',
227219
});
228-
220+
229221
}
230222
}, function errorCallback(response) {
231223
console.log("Error occurred during deleteAccount request");
@@ -241,9 +233,9 @@
241233
templateUrl: 'app/pages/workflows/modals/errorModal.html',
242234
size: 'md',
243235
});
244-
236+
245237
});
246-
238+
247239
}
248240

249241
function checkDeployedWorkflows(password) {
@@ -256,11 +248,11 @@
256248
},
257249
data: JSON.stringify({ "action" : "getWorkflows", "data" : { "user" : { "token" : token } } })
258250
}
259-
251+
260252
$http(req).then(function successCallback(response) {
261-
253+
262254
if (response.data.status=="success") {
263-
255+
264256
$scope.workflows = response.data.data.workflows;
265257
sharedData.setWorkflows(response.data.data.workflows);
266258
var deployedWorkflows = false;
@@ -274,7 +266,7 @@
274266
if (!deployedWorkflows) {
275267
deleteAccount(password);
276268
}
277-
269+
278270
} else {
279271
console.log("Failure status returned by getWorkflows");
280272
console.log("Message:" + response.data.data.message);
@@ -330,12 +322,12 @@
330322
},
331323
data: JSON.stringify({ "action" : "undeployWorkflow", "data" : { "user" : { "token" : token } , "workflow" : { "id" : $scope.workflows[index].id } } })
332324
}
333-
325+
334326
$http(req).then(function successCallback(response) {
335327

336328
if (response.data.status=="success") {
337329
setTimeout(function() {$scope.workflows[index].status='undeployed'; checkDeployedWorkflows(password); }, 2000);
338-
330+
339331
} else {
340332
console.log("Failure status returned by undeployWorkflow");
341333
console.log("Message:" + response.data.data.message);
@@ -370,20 +362,20 @@
370362
}
371363

372364
function changePassword(password, newPassword) {
373-
365+
374366
var req = {
375367
method: 'POST',
376368
url: urlPath,
377369
headers: {
378370
'Content-Type': 'application/json'
379371
},
380-
372+
381373
data: JSON.stringify({ "action" : "changePassword", "data" : { "user" : { "email" : $scope.email, "password" : password, "new_password" : newPassword } } })
382-
374+
383375
}
384-
376+
385377
$http(req).then(function successCallback(response) {
386-
378+
387379
if (response.data.status=="success") {
388380
console.log("Message:" + response.data.data.message);
389381
toastr.success('Your password has been updated successfully.');
@@ -397,7 +389,6 @@
397389
templateUrl: 'app/pages/workflows/modals/errorModal.html',
398390
size: 'md',
399391
});
400-
401392
}
402393
}, function errorCallback(response) {
403394
console.log("Error occurred during changePassword request");
@@ -413,11 +404,8 @@
413404
templateUrl: 'app/pages/workflows/modals/errorModal.html',
414405
size: 'md',
415406
});
416-
417407
});
418-
419408
}
420-
421-
}
409+
}
422410

423411
})();

0 commit comments

Comments
 (0)