Skip to content
Snippets Groups Projects
Commit 523bdf4b authored by wactbprot's avatar wactbprot
Browse files

write info to key

parent 63eb59dd
No related branches found
No related tags found
No related merge requests found
......@@ -31,7 +31,8 @@ def calids():
msg = "http request to endpoint */cal_ids*"
s.log.info(msg)
s.r.publish('info', msg)
s.aset('info', 0, msg)
keys = s.get_keys('cal_id')
cal_ids = []
for key in keys:
......@@ -46,6 +47,8 @@ def target_pressure():
msg = "http request to */target_pressure* endpoint"
s.log.info(msg)
s.r.publish('info', msg)
s.aset('info', 0, msg)
req = request.get_json()
# start values:
......@@ -65,7 +68,7 @@ def target_pressure():
doc = db.get_doc(cal_id)
todo_dict = utils.extract_todo_pressure(doc)
todo_pressures_acc, n_todo, todo_unit = utils.acc_pressure(value_dict=todo_dict,form_pressure_acc=todo_pressures_acc, n_acc=n_todo)
todo_pressures_acc, n_todo, todo_unit = utils.acc_pressure(value_dict=todo_dict, form_pressure_acc=todo_pressures_acc, n_acc=n_todo)
last_rating = db.get_last_rating(doc)
if last_rating and last_rating > highest_rating:
......@@ -75,10 +78,8 @@ def target_pressure():
if last_pressure < last_measured_pressure:
last_pressure = last_measured_pressure
target_dict = utils.extract_target_pressure(doc)
remaining_pressures, remaining_unit = utils.remaining_pressure(target_dict, todo_pressures_acc, n_todo)
measurement_complete = len(remaining_pressures) == 0
......@@ -88,23 +89,23 @@ def target_pressure():
continue_measurement = True
# next pressure with ok rating
next_pressure, next_unit = remaining_pressures[0], remaining_unit
s.r.publish('info', "The previous measurement point has a rating of *{:.1f}* of [0..9].".format(highest_rating))
s.r.publish('info', "Proceed with the next pressure point.")
s.r.publish( 'info', "The calibration pressure will be *{} {}*.".format(next_pressure, next_unit))
msg = "The previous measurement point has a rating of *{:.1f}* of [0..9]. Proceed with the next pressure point. The calibration pressure will be *{} {}*.".format(highest_rating, next_pressure, next_unit)
s.r.publish('info', msg)
s.aset('info', 0, msg)
else:
continue_measurement = False
s.r.publish('info', "The previous measurement point has a rating of *{:.1f}* of [0..9].".format(highest_rating))
s.r.publish('info', "It was the *last measurement point*.")
msg = "The previous measurement point has a rating of *{:.1f}* of [0..9].It was the *last measurement point*.".format(highest_rating)
s.r.publish('info', msg)
s.aset('info', 0, msg)
if highest_rating > repeat_over_rating:
continue_measurement = True
# next pressure with ok rating not ok
next_pressure, next_unit = last_pressure, last_pressure_unit
s.r.publish('info', "The previous measurement point has a rating of *{:.1f}*. This is *not ok*.".format(highest_rating))
s.r.publish('info', "Repeat the previous pressure point ")
msg = "The previous measurement point has a rating of *{:.1f}*. This is *not ok*. Repeat the previous pressure point.".format(highest_rating)
s.r.publish('info', msg)
s.aset('info', 0, msg)
if continue_measurement:
s.aset("current_target_pressure", 0, "{} {}".format(next_pressure, next_unit))
......@@ -132,6 +133,7 @@ def save_dut_branch():
msg = "http request to endpoint */save_dut_branch*"
s.log.info(msg)
s.r.publish('info', msg)
s.aset('info', 0, msg)
res = {"ok":True}
req = request.get_json()
......@@ -160,6 +162,7 @@ def save_maintainer():
msg = "http request to endpoint */save_maintainer*"
s.log.info(msg)
s.r.publish('info', msg)
s.aset('info', 0, msg)
res = {"ok":True}
req = request.get_json()
......@@ -189,6 +192,7 @@ def save_gas():
msg = "http request to endpoint */save_gas*"
s.log.info(msg)
s.r.publish('info', msg)
s.aset('info', 0, msg)
res = {"ok":True}
req = request.get_json()
......@@ -219,6 +223,8 @@ def dut_max():
msg = "http request to endpoint */dut_max*"
s.log.info(msg)
s.r.publish('info', msg)
s.aset('info', 0, msg)
req = request.get_json()
if 'Target_pressure_value' in req and 'Target_pressure_unit' in req:
......@@ -316,6 +322,7 @@ def target_pressures():
msg = "http request to endpoint */target_pressures*"
s.log.info(msg)
s.r.publish('info', msg)
s.aset('info', 0, msg)
res = {
"Target_pressure": {
......@@ -358,7 +365,8 @@ def offset_sequences():
msg = "http request to endpoint */offset_sequences*"
s.log.info(msg)
s.r.publish('info', msg)
s.aset('info', 0, msg)
seq_array = []
lines = s.get_lines('offset_all_sequence')
......@@ -385,6 +393,8 @@ def offset():
msg = "http request to endpoint */offset*"
s.log.info(msg)
s.r.publish('info', msg)
s.aset('info', 0, msg)
res = {"ok":True}
req = request.get_json()
......@@ -446,7 +456,8 @@ def ind():
msg = "http request to endpoint */ind*"
s.log.info(msg)
s.r.publish('info', msg)
s.aset('info', 0, msg)
res = {"ok":True}
req = request.get_json()
......@@ -517,7 +528,9 @@ def wait_sequences_complete(seq_array):
task_element_completed = item.get('data')
seq_array.remove(task_element_completed)
if len(seq_array) == 0:
s.log.info("wait_sequences_complete function will return, all done!")
msg = "wait_sequences_complete function will return, all tasks resolved!"
s.log.info(msg)
s.aset('info', 0, msg)
break
else:
s.log.info("remaining tasks elements: {}".format(seq_array))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment