def validate_simulation_files(simulation): #Checks that the simulation files are still valid e.g. havent been moved """""" sim_name=simulation.simulation_name logger.debug("Checking simulation: %s" %sim_name) sim_valid=True #Check sim file sim_file=simulation.sim_setup.sim_file try: validate_setup_file(sim_file) logger.debug("VALID sim_file: %s" % sim_file) except ValidationError as e: logger.debug("INVALID sim_file: %s" % sim_file) logger.debug(e) sim_valid=False #Check agent files agent_file=simulation.agent_setup.agent_file try: validate_setup_file(agent_file) logger.debug("VALID agent_file: %s" % agent_file) except ValidationError as e: logger.debug("INVALID agent_file: %s" % agent_file) logger.debug(e) sim_valid=False view_setup_list=simulation.view_setup.all() for view_setup in view_setup_list: view_file=view_setup.view_file try: validate_setup_file(view_file) logger.debug("VALID view_file: %s" % view_file) except ValidationError as e: logger.debug("INVALID view_file %s" % view_file ) logger.debug(e) sim_valid=False return sim_valid
def validate_setup_files(sim_file,agent_file,view_file): validate_setup_file(sim_file) validate_setup_file(agent_file) validate_setup_file(view_file)