[docs]classCheckCoreInitializationBehaviour(CyclicBehaviour):""" This class implements the behaviour responsible for check that the AAS Core has been initialized. """def__init__(self,agent_object):""" The constructor method is rewritten to add the object of the agent Args: agent_object (spade.Agent): the SPADE agent object of the AAS Manager agent. """# The constructor of the inherited class is executed.super().__init__()# The SPADE agent object is stored as a variable of the behaviour classself.myagent=agent_object
[docs]asyncdefrun(self):""" This method implements the logic of the behaviour. """# If the file does not exist the behaviour continues to start and check againifos.path.isfile(AASarchiveInfo.CORE_STATUS_FILE_PATH)isTrue:core_status_json=file_to_json(AASarchiveInfo.CORE_STATUS_FILE_PATH)# If the file exists, but the JSON has not been created properly, the AAS Core is not ready yet.ifcore_status_jsonisnotNone:ifcore_status_json['status']!="Initializing":# If the status is not "Initializing" the AAS Core is ready, so the behaviour is finished_logger.info('AAS Core has initialized, so the AAS Manager can be switched to the run state.')self.kill()