def update_progname(session: FileOperator, old_prog_name: str, new_prog_name: str): progs = Sequence.get_for_program(session, old_prog_name) for p in progs: p.prog_name = new_prog_name session.commit() # Hacky: Since this used to be done by means of sqlite which would # just delete everything it finds, we eat the exceptions here... try: session.rename(Types.Sequence(), old_prog_name, f"{new_prog_name}_tmp") except: pass try: session.rename(Types.Sequence(), new_prog_name, f"{old_prog_name}_tmp") except: pass try: session.rename(Types.Sequence(), f"{new_prog_name}_tmp", new_prog_name) except: pass try: session.rename(Types.Sequence(), f"{old_prog_name}_tmp", old_prog_name) except: pass
def get_all(session: FileOperator, hardware: str, base: str, test_type: str) -> list: if test_type != 'all': return session.query(Types.Test())\ .filter(lambda Test: (Test.base == base and Test.hardware == hardware and Test.type == test_type))\ .all() else: return session.query(Types.Test())\ .filter(lambda Test: (Test.base == base and Test.hardware == hardware))\ .all()
def add(session: FileOperator, name: str, device: str, hardware: str, quality: str, grade: str, grade_reference: str, type: str, customer: str, is_enabled=True): # existing_products = Product.get_all(session) # if name in existing_products: # raise KeyError(f"product '{name}' already exists") product = { "name": name, "device": device, "hardware": hardware, "is_enabled": is_enabled, "grade": grade, "quality": quality, "grade_reference": grade_reference, "type": type, "customer": customer } session.query(Types.Product()) session.add(product) session.commit()
def update(session: FileOperator, name: str, hardware: str, base: str, type: str, definition: dict, is_enabled: bool): test = session.query(Types.Test())\ .filter(lambda Test: (Test.name == name and Test.hardware == hardware and Test.base == base))\ .one() test.definition = definition test.is_enabled = is_enabled session.commit()
def update(session: FileOperator, name: str, leads: int, is_naked_die: bool, is_enabled=True): package = session.query(Types.Package())\ .filter(lambda package: package.name == name)\ .one() package.leads = leads package.is_naked_die = is_naked_die package.is_enabled = is_enabled session.commit()
def _update_program_order(session: FileOperator, owner_name: str, prev_order: int, order: int, new_name: str): prog = session.query(Types.Program())\ .filter(lambda Program: (Program.owner_name == owner_name and Program.prog_order == prev_order))\ .one() prog.prog_name = new_name prog.prog_order = order session.commit()
def update_changed_state_test_targets(session: FileOperator, hardware: str, base: str, prog_name: str) -> list: tests = session.query(Types.Testtarget())\ .filter(lambda TestTarget: (TestTarget.prog_name == prog_name and TestTarget.hardware == hardware and TestTarget.base == base))\ .all() for test in tests: test.is_changed = False session.commit()
def add(session: FileOperator, name: str, customer: str, definition: dict, is_enabled: bool): maskset = { "name": name, "customer": customer, "definition": definition, "is_enabled": is_enabled } session.query(Types.Maskset()).add(maskset) session.commit()
def add(session: FileOperator, name: str, hardware: str, package: str, definition: dict, is_enabled: bool): # ToDo: implement constraints, i.e. hardware should exist device = { "name": name, "hardware": hardware, "package": package, "definition": definition, "is_enabled": is_enabled } session.query(Types.Device()).add(device) session.commit()
def add_sequence_information(session: FileOperator, owner_name: str, prog_name: str, test: str, order: int, definition: dict): s = { "owner_name": owner_name, "prog_name": prog_name, "test": test, "test_order": order, "definition": definition } session.query_with_subtype(Types.Sequence(), prog_name).add(s) session.commit()
def add(session: FileOperator, name: str, prog_name: str, hardware: str, base: str, test: str, is_default: bool, is_enabled: bool): target = { "name": name, "prog_name": prog_name, "hardware": hardware, "base": base, "test": test, "is_default": is_default, "is_enabled": is_enabled, "is_changed": False, "is_changed": False } session.query(Types.Testtarget()).add(target) session.commit()
def add(session: FileOperator, name, hardware, maskset, quality, grade, grade_reference, type, customer, is_enabled): die = { "name": name, "hardware": hardware, "maskset": maskset, "quality": quality, "grade": grade, "grade_reference": grade_reference, "type": type, "customer": customer, "is_enabled": is_enabled } session.query(Types.Die()).add(die) session.commit()
def add(session: FileOperator, name: str, hardware: str, base: str, target: str, usertext: str, sequencer_typ: str, temperature: str, owner_name: str, order: int, cache_type: str, caching_policy: str): prog = { "id": str(uuid1()), "prog_name": name, "hardware": hardware, "base": base, "target": target, "usertext": usertext, "sequencer_type": sequencer_typ, "temperature": temperature, "owner_name": owner_name, "prog_order": order, "is_valid": True, "cache_type": cache_type, "caching_policy": caching_policy } session.query(Types.Program()).add(prog) session.commit()
def remove(session: FileOperator, quali_flow_data: DBObject): session.query(Types.Qualification()) \ .filter(lambda QualificationFlowDatum: (QualificationFlowDatum.name == quali_flow_data.name and QualificationFlowDatum.type == quali_flow_data.type and QualificationFlowDatum.product == quali_flow_data.product))\ .delete() session.commit()
def _get_by_name(session: FileOperator, name: str) -> DBObject: return session.query(Types.Qualification())\ .filter(lambda QualificationFlowDatum: QualificationFlowDatum.name == name)\ .one_or_none()
def get_data_for_flow(session: FileOperator, flow_type: str, product: str) -> DBObject: return session.query(Types.Qualification())\ .filter(lambda QualificationFlowDatum: (QualificationFlowDatum.type == flow_type and QualificationFlowDatum.product == product))\ .all()
def get(session: FileOperator, name: str) -> DBObject: return session.query(Types.Hardware())\ .filter(lambda Hardware: Hardware.name == name)\ .one()
def remove(session: FileOperator, name: str): session.query(Types.Hardware())\ .filter(lambda Hardware: Hardware.name == name)\ .delete() session.commit()
def add(session: FileOperator, name: str, definition: dict, is_enabled: bool): hw = {"name": name, "definition": definition, "is_enabled": is_enabled} session.query(Types.Hardware()).add(hw) session.commit()
def get_all_for_hardware(session: FileOperator, hardware: str) -> list: return session.query(Types.Die())\ .filter(lambda Die: Die.hardware == hardware)\ .all()
def get_hardware(session: FileOperator, name: str) -> list: return session.query(Types.Die())\ .filter(lambda Die: Die.hardware == name and Die.is_enabled)\ .all()
def type(self): return Types.Maskset()
def get_all(session: FileOperator) -> list: return session.query(Types.Die()).all()
def update_state(session: FileOperator, name: str, state: bool): product = session.query(Types.Product())\ .filter(lambda Product: Product.name == name)\ .one() product.is_enabled = state session.commit()
def remove(session: FileOperator, name: str): session.query(Types.Die())\ .filter(lambda Die: Die.name == name)\ .delete() session.commit()
def get_for_device(session: FileOperator, device_name: str) -> list: return session.query(Types.Product())\ .filter(lambda Product: Product.device == device_name)\ .all()
def get_die(session: FileOperator, name: str) -> DBObject: return session.query(Types.Die())\ .filter(lambda Die: Die.name == name)\ .one()
def remove(session: FileOperator, name: str): session.query(Types.Product())\ .filter(lambda Product: Product.name == name)\ .delete() session.commit()
def get_all_for_maskset(session: FileOperator, maskset: str) -> list: return session.query(Types.Die())\ .filter(lambda Die: Die.maskset == maskset)\ .all()
def get_all_for_hardware(session: FileOperator, hardware: str) -> list: return session.query(Types.Product())\ .filter(lambda Product: Product.hardware == hardware)\ .all()