itkdb-gtk 0.10.9.dev4__tar.gz → 0.10.10.dev1__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.
Potentially problematic release.
This version of itkdb-gtk might be problematic. Click here for more details.
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/PKG-INFO +1 -1
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/itkdb_gtk/GetShipments.py +11 -39
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/itkdb_gtk/ITkDBlogin.py +6 -2
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/itkdb_gtk/ITkDButils.py +19 -2
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/itkdb_gtk/PanelVisualInspection.py +1 -1
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/itkdb_gtk/PetalReceptionTests.py +10 -3
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/itkdb_gtk/UploadPetalInformation.py +41 -2
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/itkdb_gtk/UploadTest.py +1 -1
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/itkdb_gtk/WireBondGui.py +155 -8
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/itkdb_gtk/__init__.py +1 -1
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/itkdb_gtk/dbGtkUtils.py +53 -15
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/itkdb_gtk/readAVSdata.py +5 -5
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/itkdb_gtk.egg-info/PKG-INFO +1 -1
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/itkdb_gtk.egg-info/SOURCES.txt +1 -0
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/pyproject.toml +1 -1
- itkdb_gtk-0.10.10.dev1/test/testBatch.py +87 -0
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/README.md +0 -0
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/itkdb_gtk/CreateShipments.py +0 -0
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/itkdb_gtk/GlueWeight.py +0 -0
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/itkdb_gtk/ITkDB.desktop +0 -0
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/itkdb_gtk/ITkDB.svg +0 -0
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/itkdb_gtk/SensorUtils.py +0 -0
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/itkdb_gtk/ShowAttachments.py +0 -0
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/itkdb_gtk/ShowComments.py +0 -0
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/itkdb_gtk/ShowDefects.py +0 -0
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/itkdb_gtk/UploadModuleIV.py +0 -0
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/itkdb_gtk/UploadMultipleTests.py +0 -0
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/itkdb_gtk/dashBoard.py +0 -0
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/itkdb_gtk/readGoogleSheet.py +0 -0
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/itkdb_gtk/untrash_component.py +0 -0
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/itkdb_gtk.egg-info/dependency_links.txt +0 -0
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/itkdb_gtk.egg-info/entry_points.txt +0 -0
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/itkdb_gtk.egg-info/requires.txt +0 -0
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/itkdb_gtk.egg-info/top_level.txt +0 -0
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/setup.cfg +0 -0
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/test/testAnimated.py +0 -0
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/test/testComponent.py +0 -0
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/test/test_attachment.py +0 -0
- {itkdb_gtk-0.10.9.dev4 → itkdb_gtk-0.10.10.dev1}/test/test_holes.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: itkdb_gtk
|
|
3
|
-
Version: 0.10.
|
|
3
|
+
Version: 0.10.10.dev1
|
|
4
4
|
Summary: A collection of Gtk based GUI to access ITkDB.
|
|
5
5
|
Author-email: Carlos Lacasta <carlos.lacasta@cern.ch>
|
|
6
6
|
Project-URL: Homepage, https://gitlab.cern.ch/atlas-itk/sw/db/itk-pdb-gtk-gui-utils
|
|
@@ -44,7 +44,7 @@ def find_vtrx(client, SN):
|
|
|
44
44
|
class ReceiveShipments(dbGtkUtils.ITkDBWindow):
|
|
45
45
|
"""Find shipments related to given recipient."""
|
|
46
46
|
|
|
47
|
-
def __init__(self, session, recipient=
|
|
47
|
+
def __init__(self, session, recipient=None, help_link=None):
|
|
48
48
|
"""Initialization.
|
|
49
49
|
|
|
50
50
|
Args:
|
|
@@ -52,7 +52,6 @@ class ReceiveShipments(dbGtkUtils.ITkDBWindow):
|
|
|
52
52
|
recipient: default recipient
|
|
53
53
|
|
|
54
54
|
"""
|
|
55
|
-
self.recipient = recipient
|
|
56
55
|
self.state = "inTransit"
|
|
57
56
|
self.institute = None
|
|
58
57
|
self.model = None
|
|
@@ -62,11 +61,15 @@ class ReceiveShipments(dbGtkUtils.ITkDBWindow):
|
|
|
62
61
|
|
|
63
62
|
global gtk_runs
|
|
64
63
|
if gtk_runs:
|
|
65
|
-
super().__init__(session=session, title="
|
|
64
|
+
super().__init__(session=session, title="Receive Shipments",
|
|
66
65
|
show_search="Click to search shipments",
|
|
67
66
|
gtk_runs=gtk_runs, help_link=help_link)
|
|
68
67
|
|
|
68
|
+
self.recipient = self.pdb_user["institutions"][0]["code"]
|
|
69
69
|
self.init_window()
|
|
70
|
+
else:
|
|
71
|
+
pdb_user = ITkDButils.get_db_user(session)
|
|
72
|
+
self.recipient = pdb_user["institutions"][0]["code"]
|
|
70
73
|
|
|
71
74
|
def init_window(self):
|
|
72
75
|
"""Initialize window."""
|
|
@@ -198,21 +201,6 @@ class ReceiveShipments(dbGtkUtils.ITkDBWindow):
|
|
|
198
201
|
|
|
199
202
|
return True
|
|
200
203
|
|
|
201
|
-
def get_institute_list(self):
|
|
202
|
-
"""Get the institute list."""
|
|
203
|
-
sites = self.session.get("listInstitutions", json={})
|
|
204
|
-
liststore = Gtk.ListStore(str, str)
|
|
205
|
-
for site in sites:
|
|
206
|
-
self.code2inst[site['code']] = site['name']
|
|
207
|
-
self.inst2code[site['name']] = site['code']
|
|
208
|
-
liststore.append([site["code"], site["code"]])
|
|
209
|
-
liststore.append([site["name"], site["code"]])
|
|
210
|
-
|
|
211
|
-
completion = Gtk.EntryCompletion()
|
|
212
|
-
completion.set_model(liststore)
|
|
213
|
-
completion.set_text_column(0)
|
|
214
|
-
return completion
|
|
215
|
-
|
|
216
204
|
def on_cell_toggled(self, widget, path):
|
|
217
205
|
"""A cell has been toggled."""
|
|
218
206
|
model = self.tree.get_model()
|
|
@@ -249,30 +237,12 @@ class ReceiveShipments(dbGtkUtils.ITkDBWindow):
|
|
|
249
237
|
|
|
250
238
|
self.state = name
|
|
251
239
|
|
|
252
|
-
def get_institute_from_combo(self, combo):
|
|
253
|
-
"""Get Institute from combo."""
|
|
254
|
-
tree_iter = combo.get_active_iter()
|
|
255
|
-
if tree_iter is not None:
|
|
256
|
-
model = combo.get_model()
|
|
257
|
-
name = model[tree_iter][1]
|
|
258
|
-
|
|
259
|
-
else:
|
|
260
|
-
name = combo.get_child().get_text()
|
|
261
|
-
if name in self.inst2code:
|
|
262
|
-
name = self.inst2code[name]
|
|
263
|
-
|
|
264
|
-
elif name not in self.code2inst:
|
|
265
|
-
name = None
|
|
266
|
-
|
|
267
|
-
return name
|
|
268
|
-
|
|
269
240
|
def on_receiver(self, combo):
|
|
270
241
|
"""Sets the recipient."""
|
|
271
242
|
name = self.get_institute_from_combo(combo)
|
|
272
243
|
if name:
|
|
273
244
|
self.recipient = name
|
|
274
|
-
|
|
275
|
-
hb.props.title = "{} shipments".format(self.recipient)
|
|
245
|
+
self.set_window_title("{} shipments".format(self.recipient))
|
|
276
246
|
|
|
277
247
|
def on_institute(self, combo):
|
|
278
248
|
"""New institute chosen."""
|
|
@@ -290,8 +260,10 @@ class ReceiveShipments(dbGtkUtils.ITkDBWindow):
|
|
|
290
260
|
return
|
|
291
261
|
|
|
292
262
|
payload = {
|
|
293
|
-
"
|
|
294
|
-
|
|
263
|
+
"filterMap": {
|
|
264
|
+
"code": self.recipient,
|
|
265
|
+
"status": self.state
|
|
266
|
+
}
|
|
295
267
|
}
|
|
296
268
|
shpmts = self.session.get("listShipmentsByInstitution", json=payload)
|
|
297
269
|
|
|
@@ -239,10 +239,10 @@ class ITkDBlogin(Gtk.Dialog):
|
|
|
239
239
|
self.ac1.set_visibility(False)
|
|
240
240
|
self.ac2.set_visibility(False)
|
|
241
241
|
|
|
242
|
-
grid.attach(Gtk.Label(label="
|
|
242
|
+
grid.attach(Gtk.Label(label="Access Code 1"), 0, irow, 1, 1)
|
|
243
243
|
grid.attach(self.ac1, 1, irow, 1, 1)
|
|
244
244
|
irow = irow + 1
|
|
245
|
-
grid.attach(Gtk.Label(label="
|
|
245
|
+
grid.attach(Gtk.Label(label="Access Code 2"), 0, irow, 1, 1)
|
|
246
246
|
grid.attach(self.ac2, 1, irow, 1, 1)
|
|
247
247
|
|
|
248
248
|
btn = self.get_widget_for_response(Gtk.ResponseType.OK)
|
|
@@ -336,6 +336,10 @@ if __name__ == "__main__":
|
|
|
336
336
|
# print(l)
|
|
337
337
|
|
|
338
338
|
print("Hello {}".format(dlg.name))
|
|
339
|
+
|
|
340
|
+
rc = client.get("getUser", json={"userIdentity": dlg.user.identity})
|
|
341
|
+
print(rc)
|
|
342
|
+
|
|
339
343
|
if gtk_runs:
|
|
340
344
|
try:
|
|
341
345
|
while True:
|
|
@@ -56,7 +56,6 @@ def get_db_response():
|
|
|
56
56
|
It is stores in a global variable. Trust the function if call
|
|
57
57
|
right after your interaction with the DB.
|
|
58
58
|
"""
|
|
59
|
-
global db_response
|
|
60
59
|
return db_response
|
|
61
60
|
|
|
62
61
|
|
|
@@ -84,7 +83,8 @@ def get_db_date(timestamp=None):
|
|
|
84
83
|
try:
|
|
85
84
|
this_date = dateutil.parser.parse(timestamp)
|
|
86
85
|
out = date2string(this_date)
|
|
87
|
-
|
|
86
|
+
|
|
87
|
+
except (OverflowError, dateutil.parser.ParserError):
|
|
88
88
|
out = ""
|
|
89
89
|
|
|
90
90
|
return out
|
|
@@ -666,3 +666,20 @@ def create_client():
|
|
|
666
666
|
client.user.authenticate()
|
|
667
667
|
print("Hello {} !".format(client.user.name))
|
|
668
668
|
return client
|
|
669
|
+
|
|
670
|
+
def get_db_user(client):
|
|
671
|
+
"""REturn PDB information of current user.
|
|
672
|
+
|
|
673
|
+
Args:
|
|
674
|
+
client (itkdb.Client): The DB client.
|
|
675
|
+
|
|
676
|
+
"""
|
|
677
|
+
global db_response
|
|
678
|
+
if client is None:
|
|
679
|
+
return None
|
|
680
|
+
|
|
681
|
+
try:
|
|
682
|
+
db_response = client.get("getUser", json={"userIdentity": client.user.identity})
|
|
683
|
+
return db_response
|
|
684
|
+
except Exception:
|
|
685
|
+
return None
|
|
@@ -47,7 +47,7 @@ class PanelVisualInspection(dbGtkUtils.ITkDBWindow):
|
|
|
47
47
|
show_search="Find object with given SN.",
|
|
48
48
|
help_link=help_link)
|
|
49
49
|
|
|
50
|
-
self.institute = "
|
|
50
|
+
self.institute = self.pdb_user["institutions"][0]["code"]
|
|
51
51
|
self.global_image = None
|
|
52
52
|
self.global_link = None
|
|
53
53
|
|
|
@@ -40,7 +40,7 @@ class PetalReceptionTests(dbGtkUtils.ITkDBWindow):
|
|
|
40
40
|
|
|
41
41
|
def __init__(self, session, help_link=None):
|
|
42
42
|
"""Initialization."""
|
|
43
|
-
super().__init__(title="
|
|
43
|
+
super().__init__(title="Petal Reception Tests",
|
|
44
44
|
session=session,
|
|
45
45
|
show_search="Find object with given SN.",
|
|
46
46
|
help_link=help_link)
|
|
@@ -83,7 +83,7 @@ class PetalReceptionTests(dbGtkUtils.ITkDBWindow):
|
|
|
83
83
|
lbl.set_xalign(0)
|
|
84
84
|
grid.attach(lbl, 0, 1, 1, 1)
|
|
85
85
|
|
|
86
|
-
self.institute = "
|
|
86
|
+
self.institute = self.pdb_user["institutions"][0]["code"]
|
|
87
87
|
inst = self.create_institute_combo()
|
|
88
88
|
inst.connect("changed", self.new_institute)
|
|
89
89
|
inst.set_tooltip_text("Select the Institute.")
|
|
@@ -114,6 +114,10 @@ class PetalReceptionTests(dbGtkUtils.ITkDBWindow):
|
|
|
114
114
|
# The text view
|
|
115
115
|
self.mainBox.pack_end(self.message_panel.frame, True, True, 5)
|
|
116
116
|
|
|
117
|
+
# Set the default institute
|
|
118
|
+
dbGtkUtils.set_combo_iter(inst, self.institute)
|
|
119
|
+
|
|
120
|
+
|
|
117
121
|
self.show_all()
|
|
118
122
|
|
|
119
123
|
def on_SN_changed(self, entry, value):
|
|
@@ -139,7 +143,7 @@ class PetalReceptionTests(dbGtkUtils.ITkDBWindow):
|
|
|
139
143
|
page.dict_dialog.factory_reset()
|
|
140
144
|
|
|
141
145
|
|
|
142
|
-
def create_test_box(self, label, test_name, institute=
|
|
146
|
+
def create_test_box(self, label, test_name, institute=None):
|
|
143
147
|
"""Create and add to notebook a test dialog.
|
|
144
148
|
|
|
145
149
|
Args:
|
|
@@ -148,6 +152,9 @@ class PetalReceptionTests(dbGtkUtils.ITkDBWindow):
|
|
|
148
152
|
institute: The institute.
|
|
149
153
|
|
|
150
154
|
"""
|
|
155
|
+
if institute is None:
|
|
156
|
+
institute = self.institute
|
|
157
|
+
|
|
151
158
|
defaults = {
|
|
152
159
|
"institution": institute,
|
|
153
160
|
"runNumber": "1",
|
|
@@ -5,7 +5,6 @@ import sys
|
|
|
5
5
|
from argparse import ArgumentParser
|
|
6
6
|
from datetime import datetime, timezone
|
|
7
7
|
from pathlib import Path
|
|
8
|
-
|
|
9
8
|
import dateutil.parser
|
|
10
9
|
import gi
|
|
11
10
|
|
|
@@ -119,6 +118,8 @@ class AVSPanel(dbGtkUtils.ITkDBWindow):
|
|
|
119
118
|
|
|
120
119
|
self.btn_state = Gtk.Button(label="Undef")
|
|
121
120
|
self.btn_state.set_name("btnState")
|
|
121
|
+
self.btn_state.connect("clicked", self.show_state)
|
|
122
|
+
self.btn_state.set_tooltip_text("If green all good. Click to see commnets and defects.")
|
|
122
123
|
|
|
123
124
|
grid.attach(Gtk.Label(label="Serial No."), 0, 0, 1, 1)
|
|
124
125
|
grid.attach(self.SN, 1, 0, 1, 1)
|
|
@@ -221,6 +222,44 @@ class AVSPanel(dbGtkUtils.ITkDBWindow):
|
|
|
221
222
|
|
|
222
223
|
self.show_all()
|
|
223
224
|
|
|
225
|
+
|
|
226
|
+
def show_state(self, *arg):
|
|
227
|
+
"""Shows the status"""
|
|
228
|
+
msg = ""
|
|
229
|
+
for test in self.test_list:
|
|
230
|
+
values = test.values
|
|
231
|
+
ndef = len(values["defects"])
|
|
232
|
+
ncomm = len(values["comments"])
|
|
233
|
+
if ndef==0 and ncomm==0:
|
|
234
|
+
continue
|
|
235
|
+
|
|
236
|
+
msg += "{}\n".format(values["testType"])
|
|
237
|
+
if ndef:
|
|
238
|
+
msg += "Defects\n"
|
|
239
|
+
|
|
240
|
+
for D in values["defects"]:
|
|
241
|
+
msg += "{}: {}\n".format(D["name"], D["description"])
|
|
242
|
+
|
|
243
|
+
if ncomm:
|
|
244
|
+
msg += "Comments\n"
|
|
245
|
+
|
|
246
|
+
for C in values["comments"]:
|
|
247
|
+
msg += "{}\n".format(C)
|
|
248
|
+
|
|
249
|
+
msg += "\n"
|
|
250
|
+
|
|
251
|
+
dialog = Gtk.MessageDialog(
|
|
252
|
+
transient_for=self,
|
|
253
|
+
flags=0,
|
|
254
|
+
message_type=Gtk.MessageType.INFO,
|
|
255
|
+
buttons=Gtk.ButtonsType.OK,
|
|
256
|
+
text="Problems found",
|
|
257
|
+
)
|
|
258
|
+
|
|
259
|
+
dialog.format_secondary_text(msg)
|
|
260
|
+
dialog.run()
|
|
261
|
+
dialog.destroy()
|
|
262
|
+
|
|
224
263
|
def on_reset(self, *args):
|
|
225
264
|
"""Reset SN"""
|
|
226
265
|
self.petal_core = None
|
|
@@ -669,7 +708,7 @@ class AVSPanel(dbGtkUtils.ITkDBWindow):
|
|
|
669
708
|
for test in self.test_list:
|
|
670
709
|
values = test.values
|
|
671
710
|
self.write_message("{}\n".format(values["testType"]))
|
|
672
|
-
res = ITkDButils.upload_test(self.session, values)
|
|
711
|
+
res = ITkDButils.upload_test(self.session, values, check_runNumber=True)
|
|
673
712
|
if res is not None:
|
|
674
713
|
dbGtkUtils.complain("Could not upload test {}".format(values["testType"]), res)
|
|
675
714
|
|
|
@@ -218,7 +218,7 @@ class UploadTest(dbGtkUtils.ITkDBWindow):
|
|
|
218
218
|
|
|
219
219
|
except TypeError:
|
|
220
220
|
self.load_payload(self.payload)
|
|
221
|
-
self.write_message("Loaded memory payload
|
|
221
|
+
self.write_message("Loaded memory payload.\n")
|
|
222
222
|
|
|
223
223
|
if len(self.attachments) > 0:
|
|
224
224
|
self.btn_attch.set_label("Attachments ({})".format(len(self.attachments)))
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
"""Wirebonding GUI for PSB."""
|
|
3
3
|
|
|
4
4
|
import sys
|
|
5
|
+
import re
|
|
5
6
|
import json
|
|
7
|
+
import copy
|
|
8
|
+
from pathlib import Path
|
|
6
9
|
import gi
|
|
7
10
|
|
|
8
11
|
gi.require_version("Gtk", "3.0")
|
|
@@ -22,6 +25,23 @@ __HELP_LINK__="https://itkdb-gtk.docs.cern.ch/wirebondTest.html"
|
|
|
22
25
|
from itkdb_gtk import dbGtkUtils
|
|
23
26
|
from itkdb_gtk import ITkDBlogin, ITkDButils, UploadTest
|
|
24
27
|
|
|
28
|
+
|
|
29
|
+
#valid_channel = re.compile("(^[0-9]+)-([0-9]+)")
|
|
30
|
+
valid_channel = re.compile("^[0-9]+[\\s*\\,\\s,-[0-9]+]*")
|
|
31
|
+
|
|
32
|
+
def range_to_list(V):
|
|
33
|
+
"""Convert a range (ch1-ch2) to a list."""
|
|
34
|
+
if '-' not in V:
|
|
35
|
+
return [V]
|
|
36
|
+
|
|
37
|
+
out = []
|
|
38
|
+
endpoints = list(map(int, V.split('-')))
|
|
39
|
+
endpoints.sort()
|
|
40
|
+
for i in range(endpoints[0], endpoints[1]+1):
|
|
41
|
+
out.append(str(i))
|
|
42
|
+
|
|
43
|
+
return out
|
|
44
|
+
|
|
25
45
|
test_parameters = {
|
|
26
46
|
"Repaired Row 1": "REPAIRED_FRONTEND_ROW1",
|
|
27
47
|
"Failed Row 1": "FAILED_FRONTEND_ROW1",
|
|
@@ -422,12 +442,13 @@ class WireBond(dbGtkUtils.ITkDBWindow):
|
|
|
422
442
|
self.pdb = None
|
|
423
443
|
self.models = {}
|
|
424
444
|
self.holes = {}
|
|
425
|
-
self.institute = "
|
|
445
|
+
self.institute = self.pdb_user["institutions"][0]["code"]
|
|
426
446
|
self.inst_combo = None
|
|
427
447
|
self.module_SN = None
|
|
428
448
|
self.alternativeID = None
|
|
429
449
|
self.combo = None
|
|
430
450
|
self.tree = None
|
|
451
|
+
self.lut = {}
|
|
431
452
|
self.init_window()
|
|
432
453
|
|
|
433
454
|
def init_window(self):
|
|
@@ -464,15 +485,31 @@ class WireBond(dbGtkUtils.ITkDBWindow):
|
|
|
464
485
|
grid = Gtk.Grid(column_spacing=5, row_spacing=1)
|
|
465
486
|
|
|
466
487
|
# The shipment receiver
|
|
467
|
-
institute = self.create_institute_combo()
|
|
488
|
+
institute = self.create_institute_combo(True)
|
|
468
489
|
institute.connect("changed", self.on_institute)
|
|
469
490
|
institute.set_tooltip_text("Select the Institute.")
|
|
470
491
|
dbGtkUtils.set_combo_iter(institute, self.institute)
|
|
471
|
-
|
|
492
|
+
|
|
493
|
+
lbl = Gtk.Label(label="Institute")
|
|
494
|
+
lbl.set_xalign(0)
|
|
495
|
+
grid.attach(lbl, 0, 0, 1, 1)
|
|
472
496
|
grid.attach(institute, 1, 0, 1, 1)
|
|
473
497
|
self.inst_combo = institute
|
|
474
498
|
|
|
475
499
|
|
|
500
|
+
|
|
501
|
+
# The lookup table
|
|
502
|
+
lbl = Gtk.Label(label="Lookup Table")
|
|
503
|
+
lbl.set_xalign(0)
|
|
504
|
+
grid.attach(lbl, 2, 0, 1, 1)
|
|
505
|
+
|
|
506
|
+
self.testF = Gtk.FileChooserButton()
|
|
507
|
+
self.testF.set_tooltip_text("Click to select Lookup table.")
|
|
508
|
+
|
|
509
|
+
grid.attach(self.testF, 3, 0, 1, 1)
|
|
510
|
+
self.testF.connect("file-set", self.on_lut)
|
|
511
|
+
|
|
512
|
+
|
|
476
513
|
for i, tit in enumerate(["Operator", "Bond Machine", "Wire Batch", "SN", "Date"]):
|
|
477
514
|
lbl = Gtk.Label(label=tit)
|
|
478
515
|
lbl.set_xalign(0)
|
|
@@ -514,7 +551,7 @@ class WireBond(dbGtkUtils.ITkDBWindow):
|
|
|
514
551
|
box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
|
|
515
552
|
self.mainBox.pack_start(box, False, False, 0)
|
|
516
553
|
dbGtkUtils.add_button_to_container(box, "Add Bond",
|
|
517
|
-
"Click to add a new bond.",
|
|
554
|
+
"Click to add a new bond or bond range.",
|
|
518
555
|
self.add_item)
|
|
519
556
|
|
|
520
557
|
dbGtkUtils.add_button_to_container(box, "Remove Bond",
|
|
@@ -527,6 +564,64 @@ class WireBond(dbGtkUtils.ITkDBWindow):
|
|
|
527
564
|
self.mainBox.pack_start(self.message_panel.frame, True, True, 0)
|
|
528
565
|
self.write_message("wirebond GUI\n")
|
|
529
566
|
|
|
567
|
+
def on_lut(self, fdlg):
|
|
568
|
+
"""Get look-up table."""
|
|
569
|
+
fnam = Path(fdlg.get_filename())
|
|
570
|
+
if not fnam.exists():
|
|
571
|
+
dbGtkUtils.complain("Cannot open Luukup Table.",
|
|
572
|
+
"File {} does not exist.".format(fnam))
|
|
573
|
+
return
|
|
574
|
+
|
|
575
|
+
lut = {}
|
|
576
|
+
with open(fnam, 'r', encoding="UTF-8") as fin:
|
|
577
|
+
for line in fin:
|
|
578
|
+
line = line.strip()
|
|
579
|
+
|
|
580
|
+
if len(line) == 0:
|
|
581
|
+
continue
|
|
582
|
+
|
|
583
|
+
# Remove comments.
|
|
584
|
+
if line[0]=='#':
|
|
585
|
+
continue
|
|
586
|
+
|
|
587
|
+
ipos = line.find('#')
|
|
588
|
+
if ipos >= 0:
|
|
589
|
+
line = line[:ipos].strip()
|
|
590
|
+
|
|
591
|
+
if len(line) == 0:
|
|
592
|
+
continue
|
|
593
|
+
|
|
594
|
+
values = list(map(str.strip, line.split(',')))
|
|
595
|
+
if len(values)!=2:
|
|
596
|
+
dbGtkUtils.complain("Cannot read Lookup table.", "Wrong line format: {}".format(line))
|
|
597
|
+
return
|
|
598
|
+
|
|
599
|
+
v_local = range_to_list(values[0])
|
|
600
|
+
v_std = range_to_list(values[1])
|
|
601
|
+
|
|
602
|
+
if len(v_local) != len(v_std):
|
|
603
|
+
dbGtkUtils.complain("Wrong Lookup table.",
|
|
604
|
+
"Ranges have different length: {}".format(line))
|
|
605
|
+
return
|
|
606
|
+
|
|
607
|
+
for L, S in zip(v_local, v_std):
|
|
608
|
+
lut[L] = S
|
|
609
|
+
|
|
610
|
+
self.lut = lut
|
|
611
|
+
|
|
612
|
+
def convert_channel(self, C):
|
|
613
|
+
"""Convert channel according to LUT
|
|
614
|
+
|
|
615
|
+
Args:
|
|
616
|
+
C (str): channel number
|
|
617
|
+
|
|
618
|
+
"""
|
|
619
|
+
try:
|
|
620
|
+
return self.lut[C]
|
|
621
|
+
|
|
622
|
+
except KeyError:
|
|
623
|
+
return C
|
|
624
|
+
|
|
530
625
|
def on_institute(self, combo):
|
|
531
626
|
"""Institute changed."""
|
|
532
627
|
name = self.get_institute_from_combo(combo)
|
|
@@ -540,7 +635,7 @@ class WireBond(dbGtkUtils.ITkDBWindow):
|
|
|
540
635
|
|
|
541
636
|
|
|
542
637
|
obj = itkdb_gtk.ITkDButils.get_DB_component(self.session, value)
|
|
543
|
-
if obj is not None:
|
|
638
|
+
if obj is not None and obj["serialNumber"] is not None:
|
|
544
639
|
entry.set_text(obj["serialNumber"])
|
|
545
640
|
self.alternativeID = obj["alternativeIdentifier"]
|
|
546
641
|
|
|
@@ -620,8 +715,9 @@ class WireBond(dbGtkUtils.ITkDBWindow):
|
|
|
620
715
|
def channel_edited(self, widget, path, text):
|
|
621
716
|
"""Handles edition in channel number cell."""
|
|
622
717
|
if not text.isnumeric():
|
|
623
|
-
|
|
624
|
-
|
|
718
|
+
if valid_channel.match(text) is None:
|
|
719
|
+
dbGtkUtils.complain("Wrong channel number", "Invalid channel number: {}".format(text))
|
|
720
|
+
return
|
|
625
721
|
|
|
626
722
|
self.text_edited(0, path, text)
|
|
627
723
|
|
|
@@ -705,6 +801,7 @@ class WireBond(dbGtkUtils.ITkDBWindow):
|
|
|
705
801
|
param = get_module_param(self.SN.get_text())
|
|
706
802
|
except ValueError as E:
|
|
707
803
|
dbGtkUtils.complain("Wrong SN number", str(E))
|
|
804
|
+
return None
|
|
708
805
|
|
|
709
806
|
M = ModuleHoles(param=param)
|
|
710
807
|
|
|
@@ -766,6 +863,9 @@ class WireBond(dbGtkUtils.ITkDBWindow):
|
|
|
766
863
|
def get_unconnected(self, skeleton):
|
|
767
864
|
"""Fill the test DTO with unconnected information."""
|
|
768
865
|
out = self.compute_unconnected()
|
|
866
|
+
if out is None:
|
|
867
|
+
raise ValueError("Wrong SN")
|
|
868
|
+
|
|
769
869
|
for key, val in out.items():
|
|
770
870
|
skeleton["results"][key] = val
|
|
771
871
|
|
|
@@ -832,6 +932,47 @@ class WireBond(dbGtkUtils.ITkDBWindow):
|
|
|
832
932
|
|
|
833
933
|
data["results"][key] = out
|
|
834
934
|
|
|
935
|
+
def fix_list_of_channels(self, data):
|
|
936
|
+
"""Expand ranges and, eventually, apply LUT.
|
|
937
|
+
|
|
938
|
+
Args:
|
|
939
|
+
data: The test payload.
|
|
940
|
+
"""
|
|
941
|
+
for tit, section in data["results"].items():
|
|
942
|
+
if not isinstance(section, dict):
|
|
943
|
+
continue
|
|
944
|
+
|
|
945
|
+
range_items = []
|
|
946
|
+
added_items = []
|
|
947
|
+
for key, comment in section.items():
|
|
948
|
+
values = list(map(str.strip, key.split(',')))
|
|
949
|
+
if ',' in key or '-' in key:
|
|
950
|
+
range_items.append(key)
|
|
951
|
+
|
|
952
|
+
else:
|
|
953
|
+
continue
|
|
954
|
+
|
|
955
|
+
for V in values:
|
|
956
|
+
if '-' in V:
|
|
957
|
+
for i in range_to_list(V):
|
|
958
|
+
added_items.append((str(i), comment))
|
|
959
|
+
|
|
960
|
+
elif len(V)>0:
|
|
961
|
+
added_items.append((V, comment))
|
|
962
|
+
|
|
963
|
+
for key in range_items:
|
|
964
|
+
section.pop(key)
|
|
965
|
+
|
|
966
|
+
for key, comm in added_items:
|
|
967
|
+
section[key] = comm
|
|
968
|
+
|
|
969
|
+
if len(self.lut)>0 and len(section)>0:
|
|
970
|
+
tmp = copy.deepcopy(section)
|
|
971
|
+
section.clear()
|
|
972
|
+
for key, val in tmp.items():
|
|
973
|
+
section[self.convert_channel(key)] = val
|
|
974
|
+
|
|
975
|
+
|
|
835
976
|
def save_test(self, *args):
|
|
836
977
|
"""Save Test file."""
|
|
837
978
|
dialog = Gtk.FileChooserDialog(
|
|
@@ -863,6 +1004,7 @@ class WireBond(dbGtkUtils.ITkDBWindow):
|
|
|
863
1004
|
data = {
|
|
864
1005
|
"institution": self.institute,
|
|
865
1006
|
"date": ITkDButils.get_db_date(),
|
|
1007
|
+
"runNumber": "1",
|
|
866
1008
|
"properties": {},
|
|
867
1009
|
"results": {},
|
|
868
1010
|
"comments": [],
|
|
@@ -927,7 +1069,12 @@ class WireBond(dbGtkUtils.ITkDBWindow):
|
|
|
927
1069
|
|
|
928
1070
|
self.get_test_header(skeleton)
|
|
929
1071
|
self.get_list_of_channels(skeleton)
|
|
930
|
-
self.
|
|
1072
|
+
self.fix_list_of_channels(skeleton)
|
|
1073
|
+
try:
|
|
1074
|
+
self.get_unconnected(skeleton)
|
|
1075
|
+
|
|
1076
|
+
except ValueError:
|
|
1077
|
+
return
|
|
931
1078
|
|
|
932
1079
|
uploadW = UploadTest.UploadTest(self.session, payload=skeleton)
|
|
933
1080
|
# uploadW.run()
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""A set of GTK utilities for DB scripts."""
|
|
2
|
+
import sys
|
|
2
3
|
import json
|
|
3
4
|
import time
|
|
4
5
|
import pathlib
|
|
@@ -18,6 +19,16 @@ gi.require_version("Gtk", "3.0")
|
|
|
18
19
|
from gi.repository import Gtk, GObject, Gio, GLib
|
|
19
20
|
|
|
20
21
|
|
|
22
|
+
try:
|
|
23
|
+
import itkdb_gtk
|
|
24
|
+
|
|
25
|
+
except ImportError:
|
|
26
|
+
cwd = pathlib.Path(__file__).parent.parent
|
|
27
|
+
sys.path.append(cwd.as_posix())
|
|
28
|
+
|
|
29
|
+
from itkdb_gtk import ITkDButils
|
|
30
|
+
|
|
31
|
+
|
|
21
32
|
def setup_scanner(callback):
|
|
22
33
|
"""Setup scanner and callback function."""
|
|
23
34
|
for fnam in ["/dev/ttyACM0", "/dev/cu.usbmodemS_N_G19F204881"]:
|
|
@@ -51,9 +62,10 @@ def parse_date(txt):
|
|
|
51
62
|
try:
|
|
52
63
|
return dateutil.parser.parse(txt, fuzzy=False)
|
|
53
64
|
|
|
54
|
-
except
|
|
65
|
+
except dateutil.parser.ParserError:
|
|
55
66
|
return None
|
|
56
67
|
|
|
68
|
+
|
|
57
69
|
def parse_date_as_string(txt):
|
|
58
70
|
"""Parse data and return DB compatible string."""
|
|
59
71
|
D = parse_date(txt)
|
|
@@ -76,7 +88,7 @@ def is_a_date(txt):
|
|
|
76
88
|
dateutil.parser.parse(txt, fuzzy=False)
|
|
77
89
|
return True
|
|
78
90
|
|
|
79
|
-
except
|
|
91
|
+
except (dateutil.parser.ParserError, OverflowError):
|
|
80
92
|
return False
|
|
81
93
|
|
|
82
94
|
def new_small_text_entry():
|
|
@@ -223,7 +235,6 @@ def ask_for_confirmation(main_title, second_text, parent=None):
|
|
|
223
235
|
dialog.destroy()
|
|
224
236
|
return (out == Gtk.ResponseType.OK)
|
|
225
237
|
|
|
226
|
-
|
|
227
238
|
class TextEntry(GObject.GObject):
|
|
228
239
|
"""Create a Gtk text entry/view object."""
|
|
229
240
|
__gsignals__ = {
|
|
@@ -259,7 +270,7 @@ class TextEntry(GObject.GObject):
|
|
|
259
270
|
|
|
260
271
|
def do_my_signal(self, *args):
|
|
261
272
|
"""Signal handler."""
|
|
262
|
-
|
|
273
|
+
return
|
|
263
274
|
|
|
264
275
|
def on_enter(self, *args):
|
|
265
276
|
"""On enter."""
|
|
@@ -285,6 +296,9 @@ class TextEntry(GObject.GObject):
|
|
|
285
296
|
|
|
286
297
|
def set_text(self, text):
|
|
287
298
|
"""Sets text."""
|
|
299
|
+
if text is None:
|
|
300
|
+
return
|
|
301
|
+
|
|
288
302
|
if self.nlines > 1:
|
|
289
303
|
self.entry.get_buffer().set_text(text)
|
|
290
304
|
else:
|
|
@@ -304,7 +318,7 @@ def get_a_value(main_title, second_text=None, is_tv=False, parent=None):
|
|
|
304
318
|
value: The value in the entry
|
|
305
319
|
|
|
306
320
|
"""
|
|
307
|
-
dlg = Gtk.Dialog(title="
|
|
321
|
+
dlg = Gtk.Dialog(title="Get a Value",
|
|
308
322
|
transient_for=parent,
|
|
309
323
|
flags=0)
|
|
310
324
|
dlg.add_buttons(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
|
|
@@ -385,7 +399,8 @@ def get_a_list_of_values(main_title, labels, defaults=None, second_text=None, pa
|
|
|
385
399
|
entry = TextEntry(3 if use_tv else -1)
|
|
386
400
|
try:
|
|
387
401
|
entry.set_text(defaults[i])
|
|
388
|
-
|
|
402
|
+
|
|
403
|
+
except (TypeError, IndexError):
|
|
389
404
|
pass
|
|
390
405
|
|
|
391
406
|
vbox.pack_start(entry.widget, False, False, 0)
|
|
@@ -510,6 +525,7 @@ class ITkDBWindow(Gtk.Window):
|
|
|
510
525
|
self.code2inst = {}
|
|
511
526
|
self.message_panel = None
|
|
512
527
|
self.help = help_link
|
|
528
|
+
self.pdb_user = ITkDButils.get_db_user(self.session)
|
|
513
529
|
|
|
514
530
|
if gtk_runs:
|
|
515
531
|
super().__init__(title=title)
|
|
@@ -552,12 +568,13 @@ class ITkDBWindow(Gtk.Window):
|
|
|
552
568
|
self.mainBox.set_property("margin-left", 6)
|
|
553
569
|
self.mainBox.set_property("margin-right", 6)
|
|
554
570
|
|
|
571
|
+
self.title_label = None
|
|
555
572
|
if len(title)>0:
|
|
556
573
|
lbl = Gtk.Label()
|
|
557
574
|
lbl.set_markup("<big><b>{}\n</b></big>".format(title))
|
|
558
575
|
lbl.set_xalign(0.5)
|
|
559
|
-
self.mainBox.pack_start(lbl,
|
|
560
|
-
|
|
576
|
+
self.mainBox.pack_start(lbl, False, False, 2)
|
|
577
|
+
self.title_label = lbl
|
|
561
578
|
|
|
562
579
|
self.add(self.mainBox)
|
|
563
580
|
|
|
@@ -573,6 +590,13 @@ class ITkDBWindow(Gtk.Window):
|
|
|
573
590
|
|
|
574
591
|
self.mainBox.pack_end(btnBox, False, True, 0)
|
|
575
592
|
|
|
593
|
+
def set_window_title(self, title):
|
|
594
|
+
"""Set window title."""
|
|
595
|
+
hb = self.get_titlebar()
|
|
596
|
+
hb.props.title = title
|
|
597
|
+
if self.title_label:
|
|
598
|
+
self.title_label.set_markup("<big><b>{}\n</b></big>".format(title))
|
|
599
|
+
|
|
576
600
|
def quit(self, *args):
|
|
577
601
|
"""Quits the application."""
|
|
578
602
|
self.hide()
|
|
@@ -584,7 +608,7 @@ class ITkDBWindow(Gtk.Window):
|
|
|
584
608
|
|
|
585
609
|
def query_db(self, *args):
|
|
586
610
|
"""Search button clicked."""
|
|
587
|
-
|
|
611
|
+
return
|
|
588
612
|
|
|
589
613
|
def new_login(self, obj, msg):
|
|
590
614
|
"""A new user logged in."""
|
|
@@ -603,18 +627,32 @@ class ITkDBWindow(Gtk.Window):
|
|
|
603
627
|
if hasattr(self.session, "user_gui"):
|
|
604
628
|
self.session.user_gui.reconnect(force=True)
|
|
605
629
|
|
|
606
|
-
def create_institute_combo(self):
|
|
607
|
-
"""Create a combe with all institutes.
|
|
608
|
-
|
|
630
|
+
def create_institute_combo(self, only_user=False):
|
|
631
|
+
"""Create a combe with all institutes.
|
|
632
|
+
|
|
633
|
+
Args:
|
|
634
|
+
only_user: if True, add only institutes the user belongs to.
|
|
635
|
+
|
|
636
|
+
"""
|
|
637
|
+
compltn = self.get_institute_list(only_user)
|
|
609
638
|
combo = Gtk.ComboBox.new_with_model_and_entry(compltn.get_model())
|
|
610
639
|
combo.set_entry_text_column(0)
|
|
611
640
|
combo.get_child().set_completion(compltn)
|
|
612
641
|
|
|
613
642
|
return combo
|
|
614
643
|
|
|
615
|
-
def get_institute_list(self):
|
|
616
|
-
"""Get the institute list.
|
|
617
|
-
|
|
644
|
+
def get_institute_list(self, only_user=False):
|
|
645
|
+
"""Get the institute list.
|
|
646
|
+
|
|
647
|
+
Args:
|
|
648
|
+
only_user: if True, add only institutes the user belongs to.
|
|
649
|
+
|
|
650
|
+
"""
|
|
651
|
+
if only_user and self.pdb_user:
|
|
652
|
+
sites = self.pdb_user["institutions"]
|
|
653
|
+
else:
|
|
654
|
+
sites = self.session.get("listInstitutions", json={})
|
|
655
|
+
|
|
618
656
|
liststore = Gtk.ListStore(str, str)
|
|
619
657
|
for site in sites:
|
|
620
658
|
self.code2inst[site['code']] = site['name']
|
|
@@ -367,7 +367,7 @@ def check_for_problems(sheet, the_test, row_range):
|
|
|
367
367
|
reason = cell_value(sheet, "i{}".format(row))
|
|
368
368
|
|
|
369
369
|
if reason:
|
|
370
|
-
if len(reason) <
|
|
370
|
+
if len(reason) < 1:
|
|
371
371
|
msg = "{}: {}".format(hdr, reason)
|
|
372
372
|
the_test["defects"].append({"name": msg})
|
|
373
373
|
else:
|
|
@@ -395,7 +395,7 @@ def readFATfile(session, file_path, SN=None):
|
|
|
395
395
|
"""
|
|
396
396
|
# Open spreadsheet
|
|
397
397
|
try:
|
|
398
|
-
wb = XL.load_workbook(file_path)
|
|
398
|
+
wb = XL.load_workbook(file_path, data_only=True)
|
|
399
399
|
except InvalidFileException as ee:
|
|
400
400
|
print("Could not open input file: ", file_path)
|
|
401
401
|
print(ee)
|
|
@@ -566,7 +566,7 @@ def readProductionSheet(session, file_path, SN):
|
|
|
566
566
|
|
|
567
567
|
"""
|
|
568
568
|
try:
|
|
569
|
-
wb = XL.load_workbook(file_path)
|
|
569
|
+
wb = XL.load_workbook(file_path, data_only=True)
|
|
570
570
|
except InvalidFileException as ee:
|
|
571
571
|
print("Could not open input file: ", file_path)
|
|
572
572
|
print(ee.message)
|
|
@@ -688,6 +688,6 @@ if __name__ == "__main__":
|
|
|
688
688
|
sys.exit()
|
|
689
689
|
|
|
690
690
|
fnam = Path(options.files[0]).expanduser().resolve()
|
|
691
|
-
|
|
692
|
-
readFATfile(client, fnam, options.SN)
|
|
691
|
+
readProductionSheet(client, fnam, options.SN)
|
|
692
|
+
# readFATfile(client, fnam, options.SN)
|
|
693
693
|
dlg.die()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: itkdb_gtk
|
|
3
|
-
Version: 0.10.
|
|
3
|
+
Version: 0.10.10.dev1
|
|
4
4
|
Summary: A collection of Gtk based GUI to access ITkDB.
|
|
5
5
|
Author-email: Carlos Lacasta <carlos.lacasta@cern.ch>
|
|
6
6
|
Project-URL: Homepage, https://gitlab.cern.ch/atlas-itk/sw/db/itk-pdb-gtk-gui-utils
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Test Batches."""
|
|
3
|
+
|
|
4
|
+
try:
|
|
5
|
+
import itkdb_gtk
|
|
6
|
+
|
|
7
|
+
except ImportError:
|
|
8
|
+
import sys
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
cwd = Path(__file__).parent.parent
|
|
11
|
+
sys.path.append(cwd.as_posix())
|
|
12
|
+
|
|
13
|
+
from itkdb_gtk import ITkDBlogin, ITkDButils
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def get_all_Petals(session):
|
|
17
|
+
"""Find all petal cores"""
|
|
18
|
+
# find all cores
|
|
19
|
+
# Now all the objects
|
|
20
|
+
payload = {
|
|
21
|
+
"filterMap": {
|
|
22
|
+
#"componentType": ["BT"],
|
|
23
|
+
"componentType": ["CORE_PETAL"],
|
|
24
|
+
"type": ["CORE_AVS"],
|
|
25
|
+
#"currentLocation": ["IFIC"],
|
|
26
|
+
},
|
|
27
|
+
"sorterList": [
|
|
28
|
+
{"key": "alternativeIdentifier", "descending": False }
|
|
29
|
+
],
|
|
30
|
+
}
|
|
31
|
+
core_list = session.get("listComponents", json=payload)
|
|
32
|
+
return core_list
|
|
33
|
+
|
|
34
|
+
def list_petal_core_batches(session):
|
|
35
|
+
"""Get list of Petal core batches"""
|
|
36
|
+
payload = {
|
|
37
|
+
"project": "S",
|
|
38
|
+
"batchType": ["PETAL_CORE_PROTO", "PETAL_CORE_PREPROD", "PETAL_CORE_PROD"],
|
|
39
|
+
}
|
|
40
|
+
batch_list = session.get("listBatches", json=payload)
|
|
41
|
+
rc = {}
|
|
42
|
+
for B in batch_list:
|
|
43
|
+
rc[B["code"] ]= B["id"]
|
|
44
|
+
|
|
45
|
+
return rc
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def main(session):
|
|
50
|
+
batch_list = list_petal_core_batches(session)
|
|
51
|
+
|
|
52
|
+
# # create the batches
|
|
53
|
+
# for bc, bid in batch_list.items():
|
|
54
|
+
# payload = {
|
|
55
|
+
# "project": "S",
|
|
56
|
+
# "batchType": bc,
|
|
57
|
+
# "number": "1",
|
|
58
|
+
# "ownerInstituteList": ["AVS", "IFIC", "DESYHH"]
|
|
59
|
+
# }
|
|
60
|
+
# rc = session.post("createBatch", json=payload)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
for petal_core in get_all_Petals(session):
|
|
64
|
+
aliasID = petal_core["alternativeIdentifier"]
|
|
65
|
+
if "PPB" in aliasID:
|
|
66
|
+
batch_code = "PETAL_CORE_PREPROD"
|
|
67
|
+
elif "PPC" in aliasID:
|
|
68
|
+
batch_code = "PETAL_CORE_PROD"
|
|
69
|
+
elif "test" in aliasID.lower():
|
|
70
|
+
continue
|
|
71
|
+
else:
|
|
72
|
+
batch_code = "PETAL_CORE_PROTO"
|
|
73
|
+
|
|
74
|
+
print("{} - {}".format(aliasID, batch_code))
|
|
75
|
+
rc = session.post("addBatchComponent", json={"id":batch_list[batch_code], "component": petal_core["id"]})
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
if __name__ == "__main__":
|
|
79
|
+
# ITk_PB authentication
|
|
80
|
+
dlg = ITkDBlogin.ITkDBlogin()
|
|
81
|
+
session = dlg.get_client()
|
|
82
|
+
|
|
83
|
+
try:
|
|
84
|
+
main(session)
|
|
85
|
+
|
|
86
|
+
except Exception as E:
|
|
87
|
+
print(E)
|
|
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
|