def _combine_hosts(self): ct = ConfiguredTest() ct.resources = Resources.resources.resources() ct.hosts = {} ct.end_policy = Schedule.get_schedule().test_end_policy() ct.setup_phase_delay = Schedule.get_schedule().setup_phase_delay() ct.triggers = Schedule.get_schedule().triggers() for h in Model.get_model().hosts(): host = ConfiguredHost() host.model = h host.device = h.bound() host.schedule = Schedule.get_schedule().host_schedule(h['name']) resources = set(h.needed_resources()) for event in host.schedule: resources.update(event.command().needed_resources()) def resolve_resource(r): if isinstance(r, str): return Utils.resolve_resource_name(r) return r host.resources = set(map(resolve_resource, resources)) ct.hosts[h['name']] = host ct.sanity_check() ct.model = Model.get_model() ct.laboratory = Laboratory.get_laboratory() ct.schedule = Schedule.get_schedule() ct.mapping = Mapping.get_mapping() self._configured_test = ct
def _sanity_check(self): if not Model.get_model(): raise Exceptions.SanityError("No model defined. You need to create a model. Did you forget to use 'create_model(name)' in your configuration?") if not Laboratory.get_laboratory(): raise Exceptions.SanityError("No laboratory defined. You need to create a laboratory. Did you forget to use 'create_laboratory(name)' in your configuration?") if not Mapping.get_mapping(): raise Exceptions.SanityError("No mapping defined. You need to create a mapping. Did you forget to use 'create_mapping(name)' in your configuration?") if not Schedule.get_schedule(): raise Exceptions.SanityError("No schedule defined. You need to create a schedule. Did you forget to use 'create_schedule(name)' in your configuration?")
from Laboratory import * # Populate some technicians tech1 = Technician("Sherlock Holmes", "55926-36619") tech1.loadExperimentsFromFile("report 55926-36619.txt") tech2 = Technician("Irene Adler", "69069-29232") tech2.loadExperimentsFromFile("report 69069-29232.txt") tech3 = Technician("John Watson", "75471-28954") tech3.loadExperimentsFromFile("report 75471-28954.txt") # Create a new lab lillyLab = Laboratory("Eli Lilly") lillyLab.addTechnician(tech1) lillyLab.addTechnician(tech2) lillyLab.addTechnician(tech3) # Prepare the report firstLine = "About the Current Laboratory:" separator = "-" * 50 reportLines = [firstLine] reportLines.append(separator) reportLines.append(str(lillyLab)) reportLines.append("") reportLines.append("Current Activities in the Lab:") reportLines.append(separator) reportLines.append(lillyLab.generateLabActivity()) # Persist in a file.