cloudpss 4.0.0a7__tar.gz → 4.0.2__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.0a7 → cloudpss-4.0.2}/PKG-INFO +1 -1
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/utils/httprequests.py +1 -1
- cloudpss-4.0.2/cloudpss/version.py +1 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss.egg-info/PKG-INFO +1 -1
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss.egg-info/SOURCES.txt +7 -1
- cloudpss-4.0.2/test/test7950.py +34 -0
- cloudpss-4.0.2/test/testAsync.py +33 -0
- cloudpss-4.0.2/test/testEvent.py +46 -0
- cloudpss-4.0.2/test/testRt copy.py +107 -0
- cloudpss-4.0.2/test/testRt.py +150 -0
- cloudpss-4.0.2/test/testSend.py +39 -0
- cloudpss-4.0.2/test/testb.py +18 -0
- cloudpss-4.0.0a7/cloudpss/version.py +0 -1
- cloudpss-4.0.0a7/test/testSend.py +0 -39
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/README.md +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/__init__.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/function/__init__.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/function/function.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/function/functionExecution.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/function/job.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/ieslab/DataManageModel.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/ieslab/EvaluationModel.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/ieslab/IESLabPlan.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/ieslab/IESLabSimulation.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/ieslab/PlanModel.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/ieslab/__init__.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/model/__init__.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/model/implements/__init__.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/model/implements/component.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/model/implements/diagram.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/model/implements/implement.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/model/jobDefinitions.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/model/model.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/model/revision.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/model/topology.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/project/__init__.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/project/project.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/runner/IESLabEvaluationResult.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/runner/IESLabPlanResult.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/runner/IESLabTypicalDayResult.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/runner/__init__.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/runner/receiver.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/runner/result.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/runner/runner.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/runner/storage.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/runner/transform.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/utils/__init__.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/utils/dataEncoder.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/utils/graphqlUtil.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/utils/matlab.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/utils/yamlLoader.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss/verify.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss.egg-info/dependency_links.txt +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss.egg-info/requires.txt +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/cloudpss.egg-info/top_level.txt +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/setup.cfg +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/setup.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/test/test-sdk.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/test/test-snapshot.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/test/test.py +0 -0
- {cloudpss-4.0.0a7 → cloudpss-4.0.2}/test/test_in_new_web_1.py +0 -0
@@ -24,7 +24,7 @@ def request(method, uri, baseUrl=None, params={}, token=None, **kwargs):
|
|
24
24
|
raise Exception(
|
25
25
|
'当前SDK版本(ver 3.X.X)与服务器版本(3.0.0 以下)不兼容,请更换服务器地址或更换SDK版本。')
|
26
26
|
os.environ['X_CLOUDPSS_VERSION'] = r.headers['X-Cloudpss-Version']
|
27
|
-
if float(r.headers['X-Cloudpss-Version'])
|
27
|
+
if float(r.headers['X-Cloudpss-Version']) >= 5:
|
28
28
|
raise Exception('当前SDK版本(ver '+__version__ +')与服务器版本(ver ' +
|
29
29
|
r.headers['X-Cloudpss-Version'] +
|
30
30
|
'.X.X)不兼容,请更换服务器地址或更换SDK版本(pip 使用 pip install -U cloudpss 命令更新, conda 使用 conda update cloudpss 命令更新)。')
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = '4.0.2'
|
@@ -47,5 +47,11 @@ cloudpss/utils/yamlLoader.py
|
|
47
47
|
test/test-sdk.py
|
48
48
|
test/test-snapshot.py
|
49
49
|
test/test.py
|
50
|
+
test/test7950.py
|
51
|
+
test/testAsync.py
|
52
|
+
test/testEvent.py
|
53
|
+
test/testRt copy.py
|
54
|
+
test/testRt.py
|
50
55
|
test/testSend.py
|
51
|
-
test/test_in_new_web_1.py
|
56
|
+
test/test_in_new_web_1.py
|
57
|
+
test/testb.py
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import os, sys
|
2
|
+
|
3
|
+
sys.path.append(os.path.join(os.path.dirname(__file__), '../'))
|
4
|
+
import cloudpss
|
5
|
+
import json
|
6
|
+
import time
|
7
|
+
if __name__ == '__main__':
|
8
|
+
print('start')
|
9
|
+
cloudpss.setToken(
|
10
|
+
'eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJhZG1pbiIsInNjb3BlcyI6W10sInR5cGUiOiJhcHBseSIsImV4cCI6MTcyNjkwMjA0MCwiaWF0IjoxNjk1Nzk4MDQwfQ.qktX85dOW21jJb-sunrXZjiYSAj94ZRfh6XPE_pnMGsBMXffRc5zp40sDuJ4jVSlI2ak6ybAsm9vbY0cPWpiBg'
|
11
|
+
)
|
12
|
+
|
13
|
+
os.environ['CLOUDPSS_API_URL'] = 'http://10.101.10.119/'
|
14
|
+
ts1 = time.time()
|
15
|
+
### 获取指定 rid 的项目
|
16
|
+
model = cloudpss.Model.fetch('model/admin/core_test')
|
17
|
+
|
18
|
+
job=model.jobs[2]
|
19
|
+
job['args']['n_cpu']='8'
|
20
|
+
job['args']['@debug']='min_cpu=0'
|
21
|
+
|
22
|
+
ts2 = time.time()
|
23
|
+
print('time 1:', ts2 - ts1, flush=True)
|
24
|
+
runner = model.run()
|
25
|
+
while not runner.status():
|
26
|
+
time.sleep(1)
|
27
|
+
|
28
|
+
logs = runner.result.getLogs()
|
29
|
+
for log in logs:
|
30
|
+
if log['type'] == 'log':
|
31
|
+
if log['data']['content'].find('thread 0 total time')>0:
|
32
|
+
print(log['data']['content'])
|
33
|
+
break
|
34
|
+
print('end')
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# define an asynchronous iterator
|
2
|
+
import asyncio
|
3
|
+
|
4
|
+
|
5
|
+
class AsyncIterator():
|
6
|
+
# constructor, define some state
|
7
|
+
def __init__(self):
|
8
|
+
self.counter = 0
|
9
|
+
|
10
|
+
# create an instance of the iterator
|
11
|
+
def __aiter__(self):
|
12
|
+
return self
|
13
|
+
|
14
|
+
# return the next awaitable
|
15
|
+
async def __anext__(self):
|
16
|
+
# check for no further items
|
17
|
+
if self.counter >= 10:
|
18
|
+
raise StopAsyncIteration
|
19
|
+
# increment the counter
|
20
|
+
self.counter += 1
|
21
|
+
await asyncio.sleep(1)
|
22
|
+
# return the counter value
|
23
|
+
return self.counter
|
24
|
+
|
25
|
+
async def testAsync():
|
26
|
+
# create an instance of the iterator
|
27
|
+
asyncIterator = AsyncIterator()
|
28
|
+
# iterate over the async iterator
|
29
|
+
async for item in asyncIterator:
|
30
|
+
print(item)
|
31
|
+
|
32
|
+
if __name__ == "__main__":
|
33
|
+
asyncio.run(testAsync())
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import os,sys
|
2
|
+
import time
|
3
|
+
import uuid
|
4
|
+
sys.path.append(os.path.join(os.path.dirname(__file__), '..\\'))
|
5
|
+
import cloudpss
|
6
|
+
import logging
|
7
|
+
|
8
|
+
def next(m):
|
9
|
+
m.write({'type': 'debug', 'step': '-1'})
|
10
|
+
def goto(m,step):
|
11
|
+
m.write({'type': 'debug', 'step': step})
|
12
|
+
def pause(m):
|
13
|
+
m.write({'type': 'debug', 'step': 10})
|
14
|
+
|
15
|
+
|
16
|
+
def memory(m,path,buffer,offset):
|
17
|
+
m.write({'type': 'memory', 'path': path,'value':buffer,'offset':offset})
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
if __name__ == '__main__':
|
22
|
+
# logging.basicConfig(level=logging.DEBUG)
|
23
|
+
os.environ['CLOUDPSS_API_URL'] = 'http://10.101.10.45/'
|
24
|
+
cloudpss.setToken('eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJhZG1pbiIsInNjb3BlcyI6WyJtb2RlbDo5ODMzNSIsImZ1bmN0aW9uOjk4MzM1IiwiYXBwbGljYXRpb246OTgzMzUiXSwicm9sZXMiOlsiYWRtaW4iXSwidHlwZSI6ImFwcGx5IiwiZXhwIjoxNzI2MjA4NjM5LCJub3RlIjoidGVzdDIiLCJpYXQiOjE2OTUxMDQ2Mzl9.ZlFSPCH3u4OSBlDBJWve4GZkWIZAku_DI1j-or-uDtAtyDy-RZecn7RBhymsILNPsmKnwkXcx1UnsjRNiAf5yA')
|
25
|
+
# job = cloudpss.Job.fetch()
|
26
|
+
|
27
|
+
model = cloudpss.Model.fetch('model/admin/debug')
|
28
|
+
|
29
|
+
jobConfig = model.jobs[4]
|
30
|
+
jobConfig['args']['stop_on_entry']='1'
|
31
|
+
modelJob =model.run(job=jobConfig)
|
32
|
+
|
33
|
+
view =modelJob.result
|
34
|
+
i=0
|
35
|
+
while not view.end:
|
36
|
+
i+=1
|
37
|
+
print(view.getLogs())
|
38
|
+
# print(view.getPlots())
|
39
|
+
print('status2',view.end)
|
40
|
+
view.next()
|
41
|
+
view.control({
|
42
|
+
"key":"/component_new_constant_1",
|
43
|
+
"value":str(i),
|
44
|
+
'uuid': str(uuid.uuid1()),
|
45
|
+
})
|
46
|
+
time.sleep(0.01)
|
@@ -0,0 +1,107 @@
|
|
1
|
+
import os,sys
|
2
|
+
import time
|
3
|
+
|
4
|
+
import socketio
|
5
|
+
import threading
|
6
|
+
import struct
|
7
|
+
sio = socketio.Client()
|
8
|
+
class SocketStream():
|
9
|
+
def __init__(self):
|
10
|
+
# sio.connect('ws://10.101.10.119/',socketio_path='/api/real-time/socket.io')
|
11
|
+
pass
|
12
|
+
|
13
|
+
def connect(self):
|
14
|
+
sio.emit('start-job', { 'type': 'start-job', 'context': 'real-time-data' })
|
15
|
+
sio.emit('real-time-data', { 'type': 'real-time-data', 'context': 'real-time-data' })
|
16
|
+
sio.emit('data-panel', { 'type': 'data-panel', 'context': 'real-time-data' })
|
17
|
+
print("I'm connected!")
|
18
|
+
|
19
|
+
@sio.event
|
20
|
+
def connect_error(self,data):
|
21
|
+
print("The connection failed!")
|
22
|
+
|
23
|
+
@sio.event
|
24
|
+
def disconnect(self):
|
25
|
+
print("I'm disconnected!")
|
26
|
+
|
27
|
+
@sio.on('data-panel')
|
28
|
+
def on_event(self,data):
|
29
|
+
print( data)
|
30
|
+
@sio.on('start-job')
|
31
|
+
def start_job(self,data):
|
32
|
+
print( data)
|
33
|
+
@sio.on('stop-job')
|
34
|
+
def stop_job(self,data):
|
35
|
+
print( data)
|
36
|
+
@sio.on('close-job')
|
37
|
+
def close_job(self,data):
|
38
|
+
print( data)
|
39
|
+
@sio.on('recording')
|
40
|
+
def recording(self,data):
|
41
|
+
print( data)
|
42
|
+
@sio.on('load-record-data')
|
43
|
+
def load_record_data(self,data):
|
44
|
+
print( data)
|
45
|
+
@sio.on('real-time-data')
|
46
|
+
def real_time_data(self,data):
|
47
|
+
data =struct.unpack('f'*int(len(data)/4),data)
|
48
|
+
|
49
|
+
print(len(data))
|
50
|
+
|
51
|
+
|
52
|
+
if __name__ == '__main__':
|
53
|
+
# logging.basicConfig(level=logging.DEBUG)
|
54
|
+
os.environ['CLOUDPSS_API_URL'] = 'ws://10.101.10.119/'
|
55
|
+
# job = cloudpss.Job.fetch()
|
56
|
+
|
57
|
+
|
58
|
+
# @sio.event
|
59
|
+
# def connect():
|
60
|
+
# sio.emit('start-job', { 'type': 'start-job', 'context': 'real-time-data' })
|
61
|
+
# sio.emit('real-time-data', { 'type': 'real-time-data', 'context': 'real-time-data' })
|
62
|
+
# sio.emit('data-panel', { 'type': 'data-panel', 'context': 'real-time-data' })
|
63
|
+
# print("I'm connected!")
|
64
|
+
|
65
|
+
# @sio.event
|
66
|
+
# def connect_error(data):
|
67
|
+
# print("The connection failed!")
|
68
|
+
|
69
|
+
# @sio.event
|
70
|
+
# def disconnect():
|
71
|
+
# print("I'm disconnected!")
|
72
|
+
|
73
|
+
# @sio.on('data-panel')
|
74
|
+
# def on_event(data):
|
75
|
+
# print( data)
|
76
|
+
# @sio.on('start-job')
|
77
|
+
# def start_job(data):
|
78
|
+
# print( data)
|
79
|
+
# @sio.on('stop-job')
|
80
|
+
# def stop_job(data):
|
81
|
+
# print( data)
|
82
|
+
# @sio.on('close-job')
|
83
|
+
# def close_job(data):
|
84
|
+
# print( data)
|
85
|
+
# @sio.on('recording')
|
86
|
+
# def recording(data):
|
87
|
+
# print( data)
|
88
|
+
# @sio.on('load-record-data')
|
89
|
+
# def load_record_data(data):
|
90
|
+
# print( data)
|
91
|
+
# @sio.on('real-time-data')
|
92
|
+
# def real_time_data(data):
|
93
|
+
# data =struct.unpack('f'*int(len(data)/4),data)
|
94
|
+
|
95
|
+
# print(len(data))
|
96
|
+
|
97
|
+
|
98
|
+
sio.connect('ws://10.101.10.119/',socketio_path='/api/real-time/socket.io')
|
99
|
+
|
100
|
+
thread = threading.Thread(target=sio.wait, args=())
|
101
|
+
thread.setDaemon(True)
|
102
|
+
thread.start()
|
103
|
+
|
104
|
+
while True:
|
105
|
+
time.sleep(1)
|
106
|
+
print('main')
|
107
|
+
pass
|
@@ -0,0 +1,150 @@
|
|
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
|
+
|
23
|
+
setattr(self, 'on_data-panel', self.on_data_panel)
|
24
|
+
setattr(self, 'on_start-job', self.on_start_job)
|
25
|
+
setattr(self, 'on_stop-job', self.on_stop_job)
|
26
|
+
setattr(self, 'on_close-job', self.on_close_job)
|
27
|
+
setattr(self, 'on_load-record-data', self.on_load_record_data)
|
28
|
+
setattr(self, 'on_real-time-data', self.on_real_time_data)
|
29
|
+
self.numericValueCallBack = kwargs.get('numericValueCallBack',None)
|
30
|
+
self.chartCallBack = kwargs.get('chartCallBack',None)
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
def on_connect(self):
|
36
|
+
self.emit('start-job', { 'type': 'start-job', 'context': 'real-time-data' })
|
37
|
+
self.emit('real-time-data', { 'type': 'real-time-data', 'context': 'real-time-data' })
|
38
|
+
self.emit('data-panel', { 'type': 'data-panel', 'context': 'real-time-data' })
|
39
|
+
pass
|
40
|
+
|
41
|
+
def on_disconnect(self):
|
42
|
+
pass
|
43
|
+
|
44
|
+
def on_data_panel(self, data):
|
45
|
+
# self.numericValue=data
|
46
|
+
virtual_input=self.config['virtual_input']
|
47
|
+
virtual_output=self.config['virtual_output']
|
48
|
+
display=self.config['display']
|
49
|
+
|
50
|
+
d ={}
|
51
|
+
for x,v in display.items():
|
52
|
+
d[v]=x
|
53
|
+
|
54
|
+
for i in range(0,virtual_input):
|
55
|
+
self.inputNumericValue[d[i]]=data[i]
|
56
|
+
for i in range(0,virtual_output):
|
57
|
+
self.outputNumericValue[d[virtual_input+i]]=data[virtual_input+i]
|
58
|
+
if self.numericValueCallBack is not None:
|
59
|
+
self.numericValueCallBack(self.inputNumericValue,self.outputNumericValue)
|
60
|
+
def on_start_job(self,data):
|
61
|
+
self.config =data
|
62
|
+
print( 'on_start_job',self.config)
|
63
|
+
def on_stop_job(self,data):
|
64
|
+
print('on_stop_job',flush=True)
|
65
|
+
self.disconnect()
|
66
|
+
self.end=True
|
67
|
+
def on_close_job(self,data):
|
68
|
+
print('on_close_job',flush=True)
|
69
|
+
self.disconnect()
|
70
|
+
self.end=True
|
71
|
+
def on_recording(self,data):
|
72
|
+
print( 'on_recording',data)
|
73
|
+
def on_load_record_data(self,data):
|
74
|
+
print( 'on_load_record_data',data)
|
75
|
+
def on_real_time_data(self,d):
|
76
|
+
|
77
|
+
data =struct.unpack('d'*int(len(d)/8),d)
|
78
|
+
i = 0
|
79
|
+
runTime =0
|
80
|
+
channelLength=int(self.config['portNumber'])+1
|
81
|
+
virtual_input=int(self.config['virtual_input'])
|
82
|
+
for index in range(0,len(data)):
|
83
|
+
val = data[index]
|
84
|
+
if(index%channelLength==0):
|
85
|
+
i=0
|
86
|
+
runTime = val
|
87
|
+
elif i>virtual_input:
|
88
|
+
serieIndex = i - virtual_input - 1
|
89
|
+
|
90
|
+
if len(self.series)-1<serieIndex:
|
91
|
+
|
92
|
+
serie= {
|
93
|
+
'name': 'data%d'%serieIndex,
|
94
|
+
'type': 'scatter',
|
95
|
+
'x': [],
|
96
|
+
'y': []
|
97
|
+
}
|
98
|
+
self.series.append(serie)
|
99
|
+
else:
|
100
|
+
serie=self.series[serieIndex]
|
101
|
+
|
102
|
+
serie['x'].append(runTime)
|
103
|
+
serie['y'].append(val)
|
104
|
+
i+=1
|
105
|
+
if self.chartCallBack is not None:
|
106
|
+
self.chartCallBack(self.series)
|
107
|
+
|
108
|
+
def close(self):
|
109
|
+
self.end =True
|
110
|
+
self.emit('close-job', { 'type': 'close-job', 'context': 'close-job' })
|
111
|
+
def write(self,data):
|
112
|
+
self.emit('send-message', data)
|
113
|
+
@staticmethod
|
114
|
+
def connect(*args, **kwargs):
|
115
|
+
sio = socketio.Client()
|
116
|
+
stream = RealTimeSream('',*args, **kwargs)
|
117
|
+
|
118
|
+
sio.register_namespace(stream)
|
119
|
+
sio.connect('ws://10.101.10.119/',socketio_path='/api/real-time/socket.io')
|
120
|
+
|
121
|
+
thread = threading.Thread(target=sio.wait, args=())
|
122
|
+
thread.setDaemon(True)
|
123
|
+
thread.start()
|
124
|
+
return stream
|
125
|
+
|
126
|
+
if __name__ == '__main__':
|
127
|
+
# logging.basicConfig(level=logging.DEBUG)
|
128
|
+
os.environ['CLOUDPSS_API_URL'] = 'ws://10.101.10.119/'
|
129
|
+
job = cloudpss.currentJob()
|
130
|
+
|
131
|
+
|
132
|
+
def numericValueCallBack(inputNumericValue,outputNumericValue):
|
133
|
+
print(inputNumericValue,flush=True)
|
134
|
+
|
135
|
+
def chartCallBack(series):
|
136
|
+
job.plot(series,key='test1')
|
137
|
+
|
138
|
+
stream = RealTimeSream.connect(numericValueCallBack=numericValueCallBack,chartCallBack=chartCallBack)
|
139
|
+
def exitCallback():
|
140
|
+
stream.close()
|
141
|
+
time.sleep(1)
|
142
|
+
print('exit')
|
143
|
+
job.exit(0)
|
144
|
+
|
145
|
+
job.on_abort(exitCallback, args=(), kwargs={})
|
146
|
+
|
147
|
+
print('start',flush=True)
|
148
|
+
while not stream.end :
|
149
|
+
time.sleep(1)
|
150
|
+
pass
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import os,sys
|
2
|
+
import time
|
3
|
+
sys.path.append(os.path.join(os.path.dirname(__file__), '..\\'))
|
4
|
+
import cloudpss
|
5
|
+
import logging
|
6
|
+
|
7
|
+
def next(m):
|
8
|
+
m.write({'type': 'debug', 'step': '-1'})
|
9
|
+
def goto(m,step):
|
10
|
+
m.write({'type': 'debug', 'step': step})
|
11
|
+
def pause(m):
|
12
|
+
m.write({'type': 'debug', 'step': 10})
|
13
|
+
|
14
|
+
|
15
|
+
def memory(m,path,buffer,offset):
|
16
|
+
m.write({'type': 'memory', 'path': path,'value':buffer,'offset':offset})
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
if __name__ == '__main__':
|
21
|
+
# logging.basicConfig(level=logging.DEBUG)
|
22
|
+
os.environ['CLOUDPSS_API_URL'] = 'http://10.101.10.45/'
|
23
|
+
cloudpss.setToken('eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJhZG1pbiIsInNjb3BlcyI6WyJtb2RlbDo5ODMzNSIsImZ1bmN0aW9uOjk4MzM1IiwiYXBwbGljYXRpb246OTgzMzUiXSwicm9sZXMiOlsiYWRtaW4iXSwidHlwZSI6ImFwcGx5IiwiZXhwIjoxNzI2MjA4NjM5LCJub3RlIjoidGVzdDIiLCJpYXQiOjE2OTUxMDQ2Mzl9.ZlFSPCH3u4OSBlDBJWve4GZkWIZAku_DI1j-or-uDtAtyDy-RZecn7RBhymsILNPsmKnwkXcx1UnsjRNiAf5yA')
|
24
|
+
# job = cloudpss.Job.fetch()
|
25
|
+
|
26
|
+
model = cloudpss.Model.fetch('model/admin/shm_test_2')
|
27
|
+
|
28
|
+
jobConfig = model.jobs[0]
|
29
|
+
jobConfig['args']['stop_on_entry']='1'
|
30
|
+
modelJob =model.run(job=jobConfig)
|
31
|
+
|
32
|
+
view =modelJob.result
|
33
|
+
i=0
|
34
|
+
while not view.end:
|
35
|
+
i+=1
|
36
|
+
print(view.getLogs())
|
37
|
+
view.next()
|
38
|
+
view.writeShm('flag2',float(i),0)
|
39
|
+
time.sleep(0.01)
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import os,sys
|
2
|
+
import time
|
3
|
+
|
4
|
+
import socketio
|
5
|
+
import threading
|
6
|
+
import struct
|
7
|
+
|
8
|
+
|
9
|
+
if __name__ == '__main__':
|
10
|
+
a = [1.21,2.22,3.33]
|
11
|
+
x = struct.pack('d'*len(a),*a)
|
12
|
+
print(x)
|
13
|
+
print(len(x))
|
14
|
+
|
15
|
+
t = struct.unpack('d'*int(len(x)/8),x)
|
16
|
+
|
17
|
+
|
18
|
+
print(t)
|
@@ -1 +0,0 @@
|
|
1
|
-
__version__ = '4.0.0-alpha.7'
|
@@ -1,39 +0,0 @@
|
|
1
|
-
from messageStreamSend import MessageStreamSend
|
2
|
-
import os
|
3
|
-
import time
|
4
|
-
|
5
|
-
|
6
|
-
def next(m):
|
7
|
-
m.write({'type': 'debug', 'step': '-1'})
|
8
|
-
def goto(m,step):
|
9
|
-
m.write({'type': 'debug', 'step': step})
|
10
|
-
def pause(m):
|
11
|
-
m.write({'type': 'debug', 'step': 10})
|
12
|
-
|
13
|
-
if __name__ == '__main__':
|
14
|
-
os.environ['CLOUDPSS_API_URL'] = 'http://10.101.10.45/'
|
15
|
-
m = MessageStreamSend('882ad478-11cf-4041-b3cd-017cba15c606')
|
16
|
-
|
17
|
-
m.connect()
|
18
|
-
|
19
|
-
while m.status != 1:
|
20
|
-
time.sleep(1)
|
21
|
-
|
22
|
-
while True:
|
23
|
-
next(m)
|
24
|
-
time.sleep(0.001)
|
25
|
-
# cmd = input('input cmd:')
|
26
|
-
# if cmd == 'next':
|
27
|
-
# next(m)
|
28
|
-
# elif cmd == 'goto':
|
29
|
-
# step = input('input step:')
|
30
|
-
# goto(m,step)
|
31
|
-
# elif cmd == 'pause':
|
32
|
-
# pause(m)
|
33
|
-
# elif cmd == 'exit':
|
34
|
-
# break
|
35
|
-
# else:
|
36
|
-
# print('input error')
|
37
|
-
|
38
|
-
|
39
|
-
m.close()
|
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
|