def setUp(self): self._start_container() self.container.start_rel_from_url('res/deploy/r2deploy.yml') self._pubsub_client = PubsubManagementServiceClient(node=self.container.node) self.PLATFORM_CONFIG = { 'platform_id': self.PLATFORM_ID, 'driver_config': DVR_CONFIG, } # Start data suscribers, add stop to cleanup. # Define stream_config. self._async_data_result = AsyncResult() self._data_greenlets = [] self._stream_config = {} self._samples_received = [] self._data_subscribers = [] self._start_data_subscribers() self.addCleanup(self._stop_data_subscribers) self._agent_config = { 'agent' : {'resource_id': PA_RESOURCE_ID}, 'stream_config' : self._stream_config, # pass platform config here 'platform_config': self.PLATFORM_CONFIG } log.debug("launching with agent_config=%s", str(self._agent_config)) if os.getenv("STANDALONE") is not None: standalone = { 'platform_id': self.PLATFORM_ID, 'container': self.container, 'pubsub_client': self._pubsub_client } self._launcher = LauncherFactory.createLauncher(standalone=standalone) self._pid = self._launcher.launch(self.PLATFORM_ID, self._agent_config) self._pa_client = self._pid log.debug("STANDALONE: LAUNCHED PLATFORM_ID=%r", self.PLATFORM_ID) else: self._launcher = LauncherFactory.createLauncher() self._pid = self._launcher.launch(self.PLATFORM_ID, self._agent_config) log.debug("LAUNCHED PLATFORM_ID=%r", self.PLATFORM_ID) # Start a resource agent client to talk with the agent. self._pa_client = ResourceAgentClient(PA_RESOURCE_ID, process=FakeProcess()) log.info('Got pa client %s.' % str(self._pa_client))
def setUp(self): self._start_container() self.container.start_rel_from_url("res/deploy/r2deploy.yml") self._pubsub_client = PubsubManagementServiceClient(node=self.container.node) self.PLATFORM_CONFIG = {"platform_id": self.PLATFORM_ID, "driver_config": DVR_CONFIG} # Start data suscribers, add stop to cleanup. # Define stream_config. self._async_data_result = AsyncResult() self._data_greenlets = [] self._stream_config = {} self._samples_received = [] self._data_subscribers = [] self._start_data_subscribers() self.addCleanup(self._stop_data_subscribers) self._agent_config = { "agent": {"resource_id": PA_RESOURCE_ID}, "stream_config": self._stream_config, # pass platform config here "platform_config": self.PLATFORM_CONFIG, } log.debug("launching with agent_config=%s", str(self._agent_config)) self._launcher = LauncherFactory.createLauncher() self._pid = self._launcher.launch(self.PLATFORM_ID, self._agent_config) log.debug("LAUNCHED PLATFORM_ID=%r", self.PLATFORM_ID) # Start a resource agent client to talk with the agent. self._pa_client = ResourceAgentClient(PA_RESOURCE_ID, process=FakeProcess()) log.info("Got pa client %s." % str(self._pa_client))
def setUp(self): self._start_container() self.container.start_rel_from_url('res/deploy/r2deploy.yml') self._pubsub_client = PubsubManagementServiceClient( node=self.container.node) # Start data subscribers, add stop to cleanup. # Define stream_config. self._async_data_result = AsyncResult() self._data_greenlets = [] self._stream_config = {} self._samples_received = [] self._data_subscribers = [] self._start_data_subscribers() self.addCleanup(self._stop_data_subscribers) # start event subscriber: self._async_event_result = AsyncResult() self._event_subscribers = [] self._events_received = [] self.addCleanup(self._stop_event_subscribers) self._start_event_subscriber() self._agent_config = { 'agent': { 'resource_id': PA_RESOURCE_ID }, 'stream_config': self._stream_config, # pass platform config here 'platform_config': self.PLATFORM_CONFIG } if log.isEnabledFor(logging.TRACE): log.trace("launching with agent_config=%s" % str(self._agent_config)) self._launcher = LauncherFactory.createLauncher() self._pid = self._launcher.launch(self.PLATFORM_ID, self._agent_config) log.debug("LAUNCHED PLATFORM_ID=%r", self.PLATFORM_ID) # Start a resource agent client to talk with the agent. self._pa_client = ResourceAgentClient(PA_RESOURCE_ID, process=FakeProcess()) log.info('Got pa client %s.' % str(self._pa_client))
def test(self): self._start_container() self.container.start_rel_from_url('res/deploy/r2deploy.yml') launcher = LauncherFactory.createLauncher() platform_id = "My_platformId" PA_RESOURCE_ID = 'My_platformId_001' agent_config = { 'agent' : {'resource_id': PA_RESOURCE_ID}, 'stream_config' : {} } pid = launcher.launch(platform_id, agent_config) sleep(2) launcher.cancel_process(pid)
def setUp(self): self._start_container() self.container.start_rel_from_url('res/deploy/r2deploy.yml') self._pubsub_client = PubsubManagementServiceClient(node=self.container.node) # Start data subscribers, add stop to cleanup. # Define stream_config. self._async_data_result = AsyncResult() self._data_greenlets = [] self._stream_config = {} self._samples_received = [] self._data_subscribers = [] self._start_data_subscribers() self.addCleanup(self._stop_data_subscribers) # start event subscriber: self._async_event_result = AsyncResult() self._event_subscribers = [] self._events_received = [] self.addCleanup(self._stop_event_subscribers) self._start_event_subscriber() self._agent_config = { 'agent' : {'resource_id': PA_RESOURCE_ID}, 'stream_config' : self._stream_config, # pass platform config here 'platform_config': self.PLATFORM_CONFIG } if log.isEnabledFor(logging.TRACE): log.trace("launching with agent_config=%s" % str(self._agent_config)) self._launcher = LauncherFactory.createLauncher() self._pid = self._launcher.launch(self.PLATFORM_ID, self._agent_config) log.debug("LAUNCHED PLATFORM_ID=%r", self.PLATFORM_ID) # Start a resource agent client to talk with the agent. self._pa_client = ResourceAgentClient(PA_RESOURCE_ID, process=FakeProcess()) log.info('Got pa client %s.' % str(self._pa_client))
def test(self): self._start_container() self.container.start_rel_from_url('res/deploy/r2deploy.yml') launcher = LauncherFactory.createLauncher() platform_id = "My_platformId" PA_RESOURCE_ID = 'My_platformId_001' agent_config = { 'agent': { 'resource_id': PA_RESOURCE_ID }, 'stream_config': {} } pid = launcher.launch(platform_id, agent_config) sleep(2) launcher.cancel_process(pid)