Source code for smia.launchers.smia_docker_starter
"""This is the SMIA launch file for Docker, which runs the program logic inside a virtualization container."""importloggingimportosimportsmiafromsmia.agents.smia_agentimportSMIAAgentfromsmia.utilities.general_utilsimportDockerUtilsfromsmia.utilitiesimportproperties_file_utils_logger=logging.getLogger(__name__)
[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_path=DockerUtils.get_aas_model_from_env_var()# When the AAS model path has been obtained, it is added to SMIAifaas_model_pathisnotNone:_logger.info("The AAS model file has been added as environmental variable.")smia.load_aas_model(aas_model_path)# The AAS model is obtained from the environmental variablesaas_id=DockerUtils.get_aas_id_from_env_var()# When the AAS model path has been obtained, it is added to SMIAifaas_idisnotNone:_logger.info("The AAS ID has been added as environmental variable.")smia.load_aas_id(aas_id)smia_i_kb_registration=DockerUtils.get_env_var('SMIAI_KB_REGISTRATION')ifsmia_i_kb_registrationisnotNone:properties_file_utils.set_dt_general_property('smia-i-kb-registration',smia_i_kb_registration)# 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()