Source code for smia.launchers.smia_docker_starter
importloggingimportosimportsmiafromsmiaimportSMIAGeneralInfofromsmia.agents.smia_agentimportSMIAAgent_logger=logging.getLogger(__name__)"""This is the launch file of the SMIA, which runs the logic of the program."""
[docs]defmain():# First, the initial configuration must be executedsmia.initial_self_configuration()_logger.info("Initializing SMIA software...")# The AAS model is obtained from the environmental variablesaas_model_name=os.environ.get('AAS_MODEL_NAME')ifaas_model_nameisNone:_logger.error("The environment variable 'AAS_MODEL_NAME' for the AAS model is not set, so SMIA cannot start. ""Please add the information and restart the container.")return_logger.info('Loaded AAS model: {}'.format(aas_model_name))aas_model_path=SMIAGeneralInfo.CONFIGURATION_AAS_FOLDER_PATH+'/'+aas_model_name# When the AAS model path has been obtained, it is added to SMIAsmia.load_aas_model(aas_model_path)# The jid and password can also be set as environmental variables. In case they are not set, the values are obtained# from the initialization properties filesmia_jid=os.environ.get('AGENT_ID')smia_psswd=os.environ.get('AGENT_PASSWD')# Create the agent objectsmia_agent=SMIAAgent(smia_jid,smia_psswd)smia.run(smia_agent)
if__name__=='__main__':# Run main program with SMIAmain()