cloudpss 4.0.11__tar.gz → 4.0.13__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cloudpss-4.0.11 → cloudpss-4.0.13}/PKG-INFO +1 -1
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/function/functionExecution.py +26 -3
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/model/model.py +0 -1
- cloudpss-4.0.13/cloudpss/version.py +1 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss.egg-info/PKG-INFO +1 -1
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss.egg-info/SOURCES.txt +3 -0
- cloudpss-4.0.13/test/test-yield.py +16 -0
- cloudpss-4.0.13/test/test.py +32 -0
- cloudpss-4.0.13/test/testRt-test.py +148 -0
- cloudpss-4.0.11/cloudpss/version.py +0 -1
- {cloudpss-4.0.11 → cloudpss-4.0.13}/README.md +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/__init__.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/function/__init__.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/function/function.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/function/job.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/ieslab/DataManageModel.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/ieslab/EvaluationModel.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/ieslab/IESLabPlan.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/ieslab/IESLabSimulation.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/ieslab/PlanModel.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/ieslab/__init__.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/model/__init__.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/model/implements/__init__.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/model/implements/component.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/model/implements/diagram.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/model/implements/implement.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/model/jobDefinitions.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/model/revision.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/model/topology.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/project/__init__.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/project/project.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/runner/IESLabEvaluationResult.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/runner/IESLabPlanResult.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/runner/IESLabTypicalDayResult.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/runner/MessageStreamReceiver.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/runner/__init__.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/runner/receiver.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/runner/result.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/runner/runner.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/runner/storage.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/runner/transform.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/utils/IO.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/utils/__init__.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/utils/dataEncoder.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/utils/graphqlUtil.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/utils/httprequests.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/utils/matlab.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/utils/yamlLoader.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss/verify.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss.egg-info/dependency_links.txt +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss.egg-info/requires.txt +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/cloudpss.egg-info/top_level.txt +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/setup.cfg +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/setup.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/test/test-async.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/test/test-async2.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/test/test-async3.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/test/test-plot.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/test/test-sdk.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/test/test-sdk1.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/test/test-snapshot.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/test/test-topology.py +0 -0
- /cloudpss-4.0.11/test/test.py → /cloudpss-4.0.13/test/test-topology1.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/test/test7950.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/test/testAsync.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/test/testEvent.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/test/testRt.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/test/testRt2.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/test/testSend.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/test/test_in_new_web_1.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/test/test_ws.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/test/test_ws2.py +0 -0
- {cloudpss-4.0.11 → cloudpss-4.0.13}/test/testb.py +0 -0
@@ -99,6 +99,26 @@ class FunctionExecution(object):
|
|
99
99
|
self._args = val
|
100
100
|
|
101
101
|
@staticmethod
|
102
|
+
def __listObj2Array(data):
|
103
|
+
arr=[]
|
104
|
+
for item in data:
|
105
|
+
if type(item) is list:
|
106
|
+
arr.append(FunctionExecution.__listObj2Array(item))
|
107
|
+
elif type(item) is dict and 'ɵid' in item :
|
108
|
+
a = list(range(len(item)-1))
|
109
|
+
for k, v in item.items():
|
110
|
+
if k == 'ɵid':
|
111
|
+
continue
|
112
|
+
k = int(k)
|
113
|
+
if type(v) is list:
|
114
|
+
a[k] = FunctionExecution.__listObj2Array(v)
|
115
|
+
else:
|
116
|
+
a[k] = v
|
117
|
+
arr.append(a)
|
118
|
+
else:
|
119
|
+
arr.append(item)
|
120
|
+
return arr
|
121
|
+
@staticmethod
|
102
122
|
def __loadArgs():
|
103
123
|
"""加载当前任务参数
|
104
124
|
|
@@ -110,9 +130,12 @@ class FunctionExecution(object):
|
|
110
130
|
if k.startswith('CLOUDPSS_JOB_ARG-'):
|
111
131
|
s = k.split('-')
|
112
132
|
key = bytes.decode(bytes.fromhex(s[1]))
|
113
|
-
|
114
|
-
|
115
|
-
|
133
|
+
data = json.loads(v)
|
134
|
+
|
135
|
+
if type(data) is list:
|
136
|
+
data = FunctionExecution.__listObj2Array(data)
|
137
|
+
|
138
|
+
args[key] = data
|
116
139
|
return args
|
117
140
|
|
118
141
|
def feedDog(self):
|
@@ -562,7 +562,6 @@ class Model(object):
|
|
562
562
|
for param in paramters:
|
563
563
|
for val in param['items']:
|
564
564
|
if config['args'].get(val['key'],None) is None:
|
565
|
-
print(val['key'])
|
566
565
|
config['args'][val['key']] = val['value']
|
567
566
|
|
568
567
|
def runEMT(self,job=None,config=None)->Runner[EMTResult]:
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = '4.0.13'
|
@@ -54,10 +54,13 @@ test/test-sdk.py
|
|
54
54
|
test/test-sdk1.py
|
55
55
|
test/test-snapshot.py
|
56
56
|
test/test-topology.py
|
57
|
+
test/test-topology1.py
|
58
|
+
test/test-yield.py
|
57
59
|
test/test.py
|
58
60
|
test/test7950.py
|
59
61
|
test/testAsync.py
|
60
62
|
test/testEvent.py
|
63
|
+
test/testRt-test.py
|
61
64
|
test/testRt.py
|
62
65
|
test/testRt2.py
|
63
66
|
test/testSend.py
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import time
|
2
|
+
def foo():
|
3
|
+
print("starting...")
|
4
|
+
for i in range(5):
|
5
|
+
print("before yield...",i)
|
6
|
+
res = yield 4
|
7
|
+
print("res:",res)
|
8
|
+
g = foo()
|
9
|
+
print(next(g))
|
10
|
+
print("*"*20)
|
11
|
+
time.sleep(2)
|
12
|
+
print(next(g))
|
13
|
+
print(next(g))
|
14
|
+
print(next(g))
|
15
|
+
print(next(g))
|
16
|
+
print(next(g))
|
@@ -0,0 +1,32 @@
|
|
1
|
+
|
2
|
+
import time
|
3
|
+
import sys
|
4
|
+
import os
|
5
|
+
|
6
|
+
sys.path.append(os.path.join(os.path.dirname(__file__), '..\\'))
|
7
|
+
import cloudpss
|
8
|
+
import time
|
9
|
+
import numpy as np
|
10
|
+
import pandas as pd
|
11
|
+
import json
|
12
|
+
|
13
|
+
if __name__ == '__main__':
|
14
|
+
os.environ['CLOUDPSS_API_URL'] = 'http://10.101.10.45/'
|
15
|
+
print('CLOUDPSS connected')
|
16
|
+
cloudpss.setToken(
|
17
|
+
'eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJhZG1pbiIsInNjb3BlcyI6WyJtb2RlbDo5ODMzNSIsImZ1bmN0aW9uOjk4MzM1IiwiYXBwbGljYXRpb246OTgzMzUiXSwicm9sZXMiOlsiYWRtaW4iXSwidHlwZSI6ImFwcGx5IiwiZXhwIjoxNzI0NTU3MDIzLCJub3RlIjoiYSIsImlhdCI6MTY5MzQ1MzAyM30._Xuyo62ESKLcIAFeNdnfBM44yPiiXli9OPKvXDzL2rPV4J1_qsGZP--bsS1tXAVy-x8ooUIIAAG1yhwmZuk7-Q')
|
18
|
+
print('Token done')
|
19
|
+
|
20
|
+
job = cloudpss.currentJob()
|
21
|
+
print(job.args,flush=True)
|
22
|
+
# project = cloudpss.Model.fetch('model/admin/7744b02b-0636-5a39-8c16-eca939259ee1')
|
23
|
+
# topology = cloudpss.ModelTopology.fetch("-xrS3SewFhpVYKBtIXLk-XDLCQRQnUmlIbXS3s4sdPUkPKeAMhXHjRgZD1JPjPfQ","emtp",{'args':{}})
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
# # topology= project.fetchTopology(config={'args':{}})
|
28
|
+
|
29
|
+
# topology.dump(topology,'test.json')
|
30
|
+
|
31
|
+
|
32
|
+
|
@@ -0,0 +1,148 @@
|
|
1
|
+
import os,sys
|
2
|
+
import time
|
3
|
+
sys.path.append(os.path.join(os.path.dirname(__file__), '..\\'))
|
4
|
+
import cloudpss
|
5
|
+
import socketio
|
6
|
+
import threading
|
7
|
+
import struct
|
8
|
+
import json
|
9
|
+
|
10
|
+
class RealTimeSream(socketio.ClientNamespace):
|
11
|
+
|
12
|
+
config = None
|
13
|
+
messages = []
|
14
|
+
series=[]
|
15
|
+
outputNumericValue={}
|
16
|
+
inputNumericValue={}
|
17
|
+
|
18
|
+
end=False
|
19
|
+
|
20
|
+
def __init__(self, namespace=None, *args, **kwargs):
|
21
|
+
super().__init__(namespace)
|
22
|
+
self.numericValueCallBack = kwargs.get('numericValueCallBack',None)
|
23
|
+
self.chartCallBack = kwargs.get('chartCallBack',None)
|
24
|
+
self.onStartJob = kwargs.get('onStartJob',None)
|
25
|
+
setattr(self, 'on_data-panel', self.on_data_panel)
|
26
|
+
setattr(self, 'on_start-job', self.on_start_job)
|
27
|
+
setattr(self, 'on_real-time-data', self.on_chart_data)
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
def on_connect(self):
|
33
|
+
print('connect')
|
34
|
+
# self.emit('start-job', { 'type': 'start-job', 'context': 'real-time-data' })
|
35
|
+
# self.emit('real-time-data', { 'type': 'real-time-data', 'context': 'real-time-data' })
|
36
|
+
# self.emit('data-panel', { 'type': 'data-panel', 'context': 'real-time-data' })
|
37
|
+
pass
|
38
|
+
|
39
|
+
def on_disconnect(self):
|
40
|
+
print('disconnect')
|
41
|
+
pass
|
42
|
+
|
43
|
+
def on_data_panel(self, data):
|
44
|
+
# self.numericValue=data
|
45
|
+
virtual_input=self.config['virtual_input']
|
46
|
+
virtual_output=self.config['virtual_output']
|
47
|
+
display=self.config['display']
|
48
|
+
|
49
|
+
d ={}
|
50
|
+
for x,v in display.items():
|
51
|
+
d[v]=x
|
52
|
+
|
53
|
+
for i in range(0,virtual_input):
|
54
|
+
self.inputNumericValue[d[i]]=data[i]
|
55
|
+
for i in range(0,virtual_output):
|
56
|
+
self.outputNumericValue[d[virtual_input+i]]=data[virtual_input+i]
|
57
|
+
if self.numericValueCallBack is not None:
|
58
|
+
self.numericValueCallBack(self.inputNumericValue,self.outputNumericValue)
|
59
|
+
|
60
|
+
def on_chart_data(self,msg):
|
61
|
+
print(msg)
|
62
|
+
|
63
|
+
def on_start_job(self,data):
|
64
|
+
self.config =data
|
65
|
+
if self.onStartJob is not None:
|
66
|
+
self.onStartJob(self.config)
|
67
|
+
print( 'on_start_job',self.config)
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
def close(self):
|
72
|
+
self.end =True
|
73
|
+
self.disconnect()
|
74
|
+
|
75
|
+
@staticmethod
|
76
|
+
def connect(*args, **kwargs):
|
77
|
+
sio = socketio.Client()
|
78
|
+
stream = RealTimeSream('',*args, **kwargs)
|
79
|
+
|
80
|
+
sio.register_namespace(stream)
|
81
|
+
|
82
|
+
url = os.environ.get('CLOUDPSS_API_URL')
|
83
|
+
|
84
|
+
if url is None:
|
85
|
+
url = 'http://10.101.10.91/'
|
86
|
+
|
87
|
+
|
88
|
+
print('connect to ',url,flush=True)
|
89
|
+
sio.connect(url,socketio_path='/api/real-time/socket.io')
|
90
|
+
|
91
|
+
thread = threading.Thread(target=sio.wait, args=())
|
92
|
+
thread.setDaemon(True)
|
93
|
+
thread.start()
|
94
|
+
return stream
|
95
|
+
|
96
|
+
if __name__ == '__main__':
|
97
|
+
# logging.basicConfig(level=logging.DEBUG)
|
98
|
+
job = cloudpss.currentJob()
|
99
|
+
|
100
|
+
remoteAddr= job.args.get('remoteAddr','http://10.101.10.91/')
|
101
|
+
|
102
|
+
if not remoteAddr.startswith('http://'):
|
103
|
+
remoteAddr='http://'+remoteAddr
|
104
|
+
|
105
|
+
os.environ['CLOUDPSS_API_URL'] = remoteAddr
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
def numericValueCallBack(inputNumericValue,outputNumericValue):
|
110
|
+
# job.log(json.dumps(inputNumericValue),key='numeric')
|
111
|
+
job.custom(inputNumericValue,'numeric')
|
112
|
+
job.custom(outputNumericValue,'output')
|
113
|
+
# print(json.dumps(inputNumericValue),flush=True)
|
114
|
+
|
115
|
+
def chartCallBack(series):
|
116
|
+
for serie in series:
|
117
|
+
job.plot([serie],key=serie['name'])
|
118
|
+
# job.plot(series,key='test1')
|
119
|
+
|
120
|
+
def onStartJob(config):
|
121
|
+
virtual_input=config['virtual_input']
|
122
|
+
virtual_output=config['virtual_output']
|
123
|
+
display=config['display']
|
124
|
+
d ={}
|
125
|
+
for x,v in display.items():
|
126
|
+
d[v]=x
|
127
|
+
items =[]
|
128
|
+
for i in range(0,virtual_output):
|
129
|
+
items.append({'title': d[virtual_input+i], 'placeholder': 'Data loading', 'html': False, 'query': d[virtual_input+i]})
|
130
|
+
|
131
|
+
job.container(items,key='output_container')
|
132
|
+
# print(d[virtual_input+i],flush=True)
|
133
|
+
# outputNumericValue[d[virtual_input+i]]=data[virtual_input+i]
|
134
|
+
|
135
|
+
|
136
|
+
stream = RealTimeSream.connect(onStartJob=onStartJob,numericValueCallBack=numericValueCallBack,chartCallBack=chartCallBack)
|
137
|
+
def exitCallback():
|
138
|
+
stream.close()
|
139
|
+
time.sleep(1)
|
140
|
+
print('exit')
|
141
|
+
job.exit(0)
|
142
|
+
|
143
|
+
job.on_abort(exitCallback, args=(), kwargs={})
|
144
|
+
|
145
|
+
print('start',flush=True)
|
146
|
+
while not stream.end :
|
147
|
+
time.sleep(1)
|
148
|
+
pass
|
@@ -1 +0,0 @@
|
|
1
|
-
__version__ = '4.0.11'
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|