def deployment_tasks(self, plugins, stage): tasks = [] for plugin in plugins: plugin_tasks = filter(lambda t: (t['stage'] == stage), plugin.tasks) for task in plugin_tasks: uids = get_uids_for_roles(self.nodes, task['role']) if not uids: continue if task['type'] == 'shell': tasks.append( self.serialize_task( plugin, task, templates.make_shell_task( uids, task, plugin.slaves_scripts_path))) elif task['type'] == 'puppet': tasks.append( self.serialize_task( plugin, task, templates.make_puppet_task( uids, task, plugin.slaves_scripts_path))) else: logger.warn('Task is skipped {0}, because its type is ' 'not supported').format(task) return tasks
def deployment_tasks(self, plugins, stage): tasks = [] for plugin in plugins: puppet_tasks = filter( lambda t: (t['type'] == 'puppet' and t['stage'] == stage), plugin.tasks) shell_tasks = filter( lambda t: (t['type'] == 'shell' and t['stage'] == stage), plugin.tasks) for task in shell_tasks: uids = get_uids_for_roles(self.nodes, task['role']) if not uids: continue tasks.append(self.serialize_task( plugin, task, templates.make_shell_task( uids, task, plugin.slaves_scripts_path))) for task in puppet_tasks: uids = get_uids_for_roles(self.nodes, task['role']) if not uids: continue tasks.append(self.serialize_task( plugin, task, templates.make_puppet_task( uids, task, plugin.slaves_scripts_path))) return tasks
def deployment_tasks(self, plugins, stage): tasks = [] for plugin in plugins: puppet_tasks = filter( lambda t: (t['type'] == 'puppet' and t['stage'] == stage), plugin.tasks) shell_tasks = filter( lambda t: (t['type'] == 'shell' and t['stage'] == stage), plugin.tasks) for task in shell_tasks: uids = self.get_uids_for_task(task) if not uids: continue tasks.append(self.serialize_task( plugin, task, templates.make_shell_task( uids, task, plugin.slaves_scripts_path))) for task in puppet_tasks: uids = self.get_uids_for_task(task) if not uids: continue tasks.append(self.serialize_task( plugin, task, templates.make_puppet_task( uids, task, plugin.slaves_scripts_path))) return tasks
def serialize(self): q_nodes = objects.Cluster.get_nodes_not_for_deletion(self.cluster) # task can be executed only on deployed nodes nodes = set(q_nodes.filter_by(status=consts.NODE_STATUSES.ready)) # add nodes scheduled for deployment since they could be filtered out # above and task must be run also on them nodes.update(self.nodes) uids = [n.uid for n in nodes] yield templates.make_puppet_task(uids, self.task)
def serialize_tasks(self, node): """Serialize tasks with necessary for orchestrator attributes :param node: dict with serialized node """ tasks = self.graph.get_tasks(node['role']).topology serialized = [] priority = ps.Priority() for task in tasks: if task['type'] == consts.ORCHESTRATOR_TASK_TYPES.puppet: item = templates.make_puppet_task( [node['uid']], task) elif task['type'] == consts.ORCHESTRATOR_TASK_TYPES.shell: item = templates.make_shell_task( [node['uid']], task) item['priority'] = priority.next() serialized.append(item) return serialized
def serialize(self): uids = self.get_uids() yield templates.make_puppet_task(uids, self.task)
def serialize(self): yield templates.make_puppet_task([self.node['uid']], self.task)
def serialize(self): nodes = deployment_serializers.get_nodes_not_for_deletion(self.cluster) uids = [n.uid for n in nodes] yield templates.make_puppet_task(uids, self.task)
def serialize(self): nodes = deployment_serializers.get_nodes_not_for_deletion( self.cluster) uids = [n.uid for n in nodes] yield templates.make_puppet_task(uids, self.task)