Skip to content

Commit

Permalink
Merge pull request #17 from UMN-CMS/rand_dev
Browse files Browse the repository at this point in the history
new lbGBT schema and current draw test
  • Loading branch information
bovard-r authored Aug 30, 2024
2 parents 43a249e + ee4fe20 commit de0f154
Show file tree
Hide file tree
Showing 11 changed files with 988 additions and 55 deletions.
31 changes: 31 additions & 0 deletions cgi-bin/EngineDB/CurrentDrawData.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/python3

import cgi
import cgitb
import base
import module_functions
import sys
import current_draw_plots as mp

def run(static):
base.header(title='Current Draw')
base.top(static)

print('''
<script>
data = {};
Bokeh.embed.embed_item(data, 'exfilter');
</script>
<div id='exfilter' class='bk-root'></div>
'''.format(mp.Filter()))

base.bottom(static)

if __name__ == '__main__':
cgitb.enable()
#cgi header
print("Content-type: text/html\n")

run(False)


195 changes: 169 additions & 26 deletions cgi-bin/EngineDB/add_test_station_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,18 @@
form = cgi.FieldStorage()

zcu = form.getvalue('ZCU')
east_interposer = form.getvalue('east_interposer')
west_interposer = form.getvalue('west_interposer')
try:
east_interposer = form.getvalue('east_interposer')
west_interposer = form.getvalue('west_interposer')
except:
east_interposer = None
west_interposer = None

try:
hd_interposer = form.getvalue('hd_interposer')
except:
hd_interposer = None

test_stand = form.getvalue('test_stand')

cur.execute('select role_id from Tester_Roles where description="ZCU"')
Expand All @@ -32,6 +42,15 @@
cur.execute('select role_id from Tester_Roles where description="West Interposer"')
west_int_id = cur.fetchall()[0][0]

cur.execute('select role_id from Tester_Roles where description="HD Interposer"')
hd_int_id = cur.fetchall()[0][0]

cur.execute('select role_id from Tester_Roles where description="DAQ 1 VTRX"')
vtrx1_id = cur.fetchall()[0][0]

cur.execute('select role_id from Tester_Roles where description="DAQ 2 VTRX"')
vtrx2_id = cur.fetchall()[0][0]

cur.execute('select teststand_id from Teststand where name="%s"' % test_stand)
test_stand_id = cur.fetchall()
if test_stand_id:
Expand All @@ -52,26 +71,34 @@

bridge_2 = form.getvalue('bridge_2')

vtrx_1 = form.getvalue('vtrx_1')
vtrx_2 = form.getvalue('vtrx_2')

info_dict = {zcu_id: zcu,
east_int_id: east_interposer,
west_int_id: west_interposer,
hd_int_id: hd_interposer,
vtrx1_id: vtrx_1,
vtrx2_id: vtrx_2,
bridge_1_id: bridge_1,
bridge_2_id: bridge_2,
}

for k,v in info_dict.items():
cur.execute('select component_id from Tester_Component where full_id="%s"' % v)
component = cur.fetchall()
if component:
pass
else:
cur.execute('insert into Tester_Component (full_id) values ("%s")' % v)
db.commit()
if v:
cur.execute('select component_id from Tester_Component where full_id="%s"' % v)
component = cur.fetchall()
if component:
pass
else:
cur.execute('insert into Tester_Component (full_id) values ("%s")' % v)
db.commit()

for k,v in info_dict.items():
cur.execute('select component_id from Tester_Component where full_id="%s"' % v)
component = cur.fetchall()
info_dict[k] = component[0][0]
if v:
cur.execute('select component_id from Tester_Component where full_id="%s"' % v)
component = cur.fetchall()
info_dict[k] = component[0][0]

cur.execute('select config_id from Tester_Configuration order by config_id desc')
try:
Expand All @@ -85,27 +112,143 @@
config1 = cur.fetchall()
if config1:
for c in config1:
cur.execute('select config_id from Tester_Configuration where config_id=%s and component_id=%s' % (c[0], info_dict[east_int_id]))
cur.execute('select config_id from Tester_Configuration where config_id=%s and component_id=%s and role_id=%s' % (c[0], info_dict[bridge_1_id], bridge_1_id))
config2 = cur.fetchall()
if config2:
cur.execute('select config_id from Tester_Configuration where config_id=%s and component_id=%s' % (c[0], info_dict[west_int_id]))
cur.execute('select config_id from Tester_Configuration where config_id=%s and component_id=%s and role_id=%s' % (c[0], info_dict[bridge_2_id], bridge_2_id))
config3 = cur.fetchall()
if config3:
cur.execute('select config_id from Tester_Configuration where config_id=%s and component_id=%s and role_id=%s' % (c[0], info_dict[bridge_1_id], bridge_1_id))
config4 = cur.fetchall()
if config4:
cur.execute('select config_id from Tester_Configuration where config_id=%s and component_id=%s and role_id=%s' % (c[0], info_dict[bridge_2_id], bridge_2_id))
config5 = cur.fetchall()
if config5:
print('Begin')
print(c[0])
print('End')
found_config.append(True)
break
if vtrx_1:
cur.execute('select config_id from Tester_Configuration where config_id=%s and component_id=%s and role_id=%s' % (c[0], info_dict[vtrx1_id], vtrx1_id))
config4 = cur.fetchall()
if config4:
if vtrx_2:
cur.execute('select config_id from Tester_Configuration where config_id=%s and component_id=%s and role_id=%s' % (c[0], info_dict[vtrx2_id], vtrx2_id))
config5 = cur.fetchall()
if config5:
if hd_interposer:
cur.execute('select config_id from Tester_Configuration where config_id=%s and component_id=%s' % (c[0], info_dict[hd_int_id]))
config6 = cur.fetchall()
if config6:
print('Begin')
print(c[0])
print('End')
found_config.append(True)
break
else:
found_config.append(False)
else:
cur.execute('select config_id from Tester_Configuration where config_id=%s and component_id=%s' % (c[0], info_dict[east_int_id]))
config6 = cur.fetchall()
if config6:
cur.execute('select config_id from Tester_Configuration where config_id=%s and component_id=%s' % (c[0], info_dict[west_int_id]))
config7 = cur.fetchall()
if config7:
print('Begin')
print(c[0])
print('End')
found_config.append(True)
break
else:
found_config.append(False)
else:
found_config.append(False)
else:
found_config.append(False)
else:
if hd_interposer:
cur.execute('select config_id from Tester_Configuration where config_id=%s and component_id=%s' % (c[0], info_dict[hd_int_id]))
config6 = cur.fetchall()
if config6:
print('Begin')
print(c[0])
print('End')
found_config.append(True)
break
else:
found_config.append(False)
else:
cur.execute('select config_id from Tester_Configuration where config_id=%s and component_id=%s' % (c[0], info_dict[east_int_id]))
config6 = cur.fetchall()
if config6:
cur.execute('select config_id from Tester_Configuration where config_id=%s and component_id=%s' % (c[0], info_dict[west_int_id]))
config7 = cur.fetchall()
if config7:
print('Begin')
print(c[0])
print('End')
found_config.append(True)
break
else:
found_config.append(False)
else:
found_config.append(False)

else:
found_config.append(False)
else:
found_config.append(False)
if vtrx_2:
cur.execute('select config_id from Tester_Configuration where config_id=%s and component_id=%s and role_id=%s' % (c[0], info_dict[vtrx2_id], vtrx2_id))
config5 = cur.fetchall()
if config5:
if hd_interposer:
cur.execute('select config_id from Tester_Configuration where config_id=%s and component_id=%s' % (c[0], info_dict[hd_int_id]))
config6 = cur.fetchall()
if config6:
print('Begin')
print(c[0])
print('End')
found_config.append(True)
break
else:
found_config.append(False)
else:
cur.execute('select config_id from Tester_Configuration where config_id=%s and component_id=%s' % (c[0], info_dict[east_int_id]))
config6 = cur.fetchall()
if config6:
cur.execute('select config_id from Tester_Configuration where config_id=%s and component_id=%s' % (c[0], info_dict[west_int_id]))
config7 = cur.fetchall()
if config7:
print('Begin')
print(c[0])
print('End')
found_config.append(True)
break
else:
found_config.append(False)
else:
found_config.append(False)
else:
found_config.append(False)
else:
if hd_interposer:
cur.execute('select config_id from Tester_Configuration where config_id=%s and component_id=%s' % (c[0], info_dict[hd_int_id]))
config6 = cur.fetchall()
if config6:
print('Begin')
print(c[0])
print('End')
found_config.append(True)
break
else:
found_config.append(False)
else:
cur.execute('select config_id from Tester_Configuration where config_id=%s and component_id=%s' % (c[0], info_dict[east_int_id]))
config6 = cur.fetchall()
if config6:
cur.execute('select config_id from Tester_Configuration where config_id=%s and component_id=%s' % (c[0], info_dict[west_int_id]))
config7 = cur.fetchall()
if config7:
print('Begin')
print(c[0])
print('End')
found_config.append(True)
break
else:
found_config.append(False)
else:
found_config.append(False)

else:
found_config.append(False)
else:
Expand Down
2 changes: 2 additions & 0 deletions cgi-bin/EngineDB/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def top(static):
<li><a class="dropdown-item" href="X_PWRData.html">X PWR</a></li>
<li><a class="dropdown-item" href="I2CData.html">I2C</a></li>
<li><a class="dropdown-item" href="GPIO_functionality.html">GPIO Functionality</a></li>
<li><a class="dropdown-item" href="CurrentDrawData.html">Current Draw</a></li>
</ul>
</li>
</ul>
Expand Down Expand Up @@ -185,6 +186,7 @@ def top(static):
<li><a class="dropdown-item" href="X_PWRData.py">X PWR</a></li>
<li><a class="dropdown-item" href="I2CData.py">I2C</a></li>
<li><a class="dropdown-item" href="GPIO_functionality.py">GPIO Functionality</a></li>
<li><a class="dropdown-item" href="CurrentDrawData.py">Current Draw</a></li>
</ul>
</li>
<li class="nav-item">
Expand Down
19 changes: 15 additions & 4 deletions cgi-bin/EngineDB/board_checkout2.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from connect import connect, get_base_url

base_url = get_base_url()
db = connect(0)
db = connect(1)
cur = db.cursor()

#print("Location: %s/summary.py\n\n" % base_url)
Expand All @@ -28,9 +28,20 @@
except:
person_id = form.getvalue('person_id')
cur.execute('select person_id from People where person_name="%s"' % person_id)
person_id = cur.fetchall()[0][0]

comments = form.getvalue("comments")
try:
person_id = cur.fetchall()[0][0]
except:
cur.execute('insert into People (person_name) values ("%s")' % person_id)
db.commit()

cur.execute('select person_id from People where person_name="%s"' % person_id)
person_id = cur.fetchall()[0][0]

try:
comments = form.getvalue("comments")
except:
location = form.getvalue("location")
comments = "Shipped to " + location

base.header(title='Board Check Out')
base.top(False)
Expand Down
Loading

0 comments on commit de0f154

Please sign in to comment.