我的申请有效。它检查心脏监护仪的健康状况(由具有ID的医生监督),并收集医生当前的活动。下面我将展示我编写的部分代码(在ubuntu中使用python)。但是我想要的是:
如何使代码并行?这两台服务器相互独立。因为现在我要等到我拿到炉边的监护仪,然后医生才知道它在活动。在请求之前我做了一些搜索操作,请求之后我做了一些繁重的计算,所以我在寻找一种并行编程/CPU密集型的解决方案。你知道吗
@app.route('/getstatus',methods=['POST','GET'])
def get_score():
if request.method=='POST':
#we wait till the web user has filled in the ID of the doctor
id = request.form['id']
#hearthmonitor Processor 1 parallelactivity 1 before the request I am searching the servername of the hearthmonitor that belongs with the ID
urlhearth=serverhearth+id
rh= requests.get(serverhearth, allow_redirects=False)
h1=rh.content
#doctormonitor Processor 2 parallelactivity 2 before the request I am searching the servername of the doctorserver (department server) that belongs with the ID. This is what I want to run in parrallel with activity 1
urldoc=server+id
rd= requests.get(urldoc, allow_redirects=False)
d1= rd.content
#we make a list of their outcomes together
list=[doctor, hearth]
目前没有回答
相关问题 更多 >
编程相关推荐