def _do_startup(self, cloud): ''' Starts up the service. The first node will be the job master as well as an hadoop worker. ''' startCloud = self._init_cloud(cloud) try: self.context = {'FIRST': 'true', 'MGMT_SERVER': ''} self.controller.add_context_replacement(self.context, cloud = startCloud) instance = self.controller.create_nodes(1, client.check_agent_process, 5555, startCloud) self.nodes += instance self.logger.info('Created node: %s', instance[0]) client.startup(instance[0].ip, 5555, instance[0].ip, instance[0].private_ip) self.logger.info('Called startup: %s', instance[0]) self.context = {'FIRST': 'false', 'MGMT_SERVER': instance[0].ip} self.controller.add_context_replacement(self.context, cloud = startCloud) except: self.logger.exception('do_startup: Failed to request a new node') self.state = self.S_STOPPED return self.state = self.S_RUNNING
def _do_startup(self, cloud): ''' Starts up the service. The first node will be the job master as well as an hadoop worker. ''' startCloud = self._init_cloud(cloud) try: self.context = {'FIRST': 'true', 'MGMT_SERVER': ''} self.controller.add_context_replacement(self.context, cloud=startCloud) instance = self.controller.create_nodes(1, client.check_agent_process, 5555, startCloud) self.nodes += instance self.logger.info('Created node: %s', instance[0]) client.startup(instance[0].ip, 5555, instance[0].ip, instance[0].private_ip) self.logger.info('Called startup: %s', instance[0]) self.context = {'FIRST': 'false', 'MGMT_SERVER': instance[0].ip} self.controller.add_context_replacement(self.context, cloud=startCloud) except: self.logger.exception('do_startup: Failed to request a new node') self.state = self.S_STOPPED return self.state = self.S_RUNNING
def _do_add_nodes(self, count, cloud): startCloud = self._init_cloud(cloud) try: self.logger.info('Starting nodes: %d', count) node_instances = self.controller.create_nodes(count, \ client.check_agent_process, 5555, startCloud) self.logger.info('Create nodes: %s', node_instances) self.nodes += node_instances # Startup agents for node in node_instances: client.startup(node.ip, 5555, node.ip, node.private_ip) self.logger.info('Started nodes: %d %s', count, self.state) return HttpJsonResponse() except HttpError as e: self.logger.info('exception in _do_add_nodes2: %s', e) return HttpJsonResponse() except Exception as e: self.logger.info('exception in _do_add_nodes1: %s', e) return HttpJsonResponse() finally: #TODO error handling (propagte error to client, i.e. browser) self.state = self.S_RUNNING self.logger.info('finished _do_add_nodes') return HttpJsonResponse()