def _get_nodes(self, starttime, endtime): planning = get_planning(elements=[self.cluster], starttime=starttime, endtime=endtime, out_of_chart=self.options.outofchart) slots = compute_slots(planning, self.options.walltime) startdate = slots[0][0] i_slot = 0 n_nodes = slots[i_slot][2][self.cluster] while n_nodes < self.n_nodes: logger.debug(slots[i_slot]) startdate = slots[i_slot][0] n_nodes = slots[i_slot][2][self.cluster] i_slot += 1 if i_slot == len(slots) - 1: return False, False return startdate, self.n_nodes
def _get_nodes(self, starttime, endtime): """ """ planning = get_planning(elements=[self.cluster], starttime=starttime, endtime=endtime, out_of_chart=self.options.outofchart) slots = compute_slots(planning, self.options.walltime) startdate = slots[0][0] i_slot = 0 n_nodes = self.options.n_nodes * \ (slots[i_slot][2][self.cluster] // self.options.n_nodes) while n_nodes < self.options.n_nodes: logger.debug(slots[i_slot]) startdate = slots[i_slot][0] n_nodes = self.options.n_nodes * \ (slots[i_slot][2][self.cluster] // self.options.n_nodes) i_slot += 1 if i_slot == len(slots) - 1: return False, False logger.debug('Reserving %s nodes at %s', n_nodes, format_date(startdate)) return startdate, 1
def _get_nodes(self, starttime, endtime): """ """ planning = get_planning(elements=[self.cluster], starttime=starttime, endtime=endtime, out_of_chart=self.options.outofchart) slots = compute_slots(planning, self.options.walltime) startdate = slots[0][0] i_slot = 0 n_nodes = self.options.n_nodes * \ (slots[i_slot][2][self.cluster] // self.options.n_nodes) while n_nodes < self.options.n_nodes: logger.debug(slots[i_slot]) startdate = slots[i_slot][0] n_nodes = self.options.n_nodes * \ (slots[i_slot][2][self.cluster] // self.options.n_nodes) i_slot += 1 if i_slot == len(slots) - 1: return False, False logger.debug('Reserving %s nodes at %s', n_nodes, format_date(startdate)) return startdate, n_nodes
def _get_nodes(self, starttime, endtime): """ return the nearest slot (startdate) that has enough available nodes to perform the client's actions Parameters ---------- starttime: str the time to start the reservation endtime: str the time to stop the reservation Returns ------- str the start time of the reservation """ planning = get_planning(elements=self.clusters.keys(), starttime=starttime, endtime=endtime, out_of_chart=self.out_of_chart) slots = compute_slots(planning, self.configs['walltime']) startdate = None for slot in slots: is_enough_nodes = True for cluster_name, n_nodes in self.clusters.items(): if slot[2][cluster_name] < n_nodes: is_enough_nodes = False break if is_enough_nodes: startdate = slot[0] break if startdate is not None: logger.info('A slot is found for your request at %s' % format_date(startdate)) return startdate
exit() job_name = "PaasageExecWare" packages = "jsvc maven openjdk-8-jdk" walltime = "3:00:00" sites = ['lyon', 'rennes', 'nancy', 'grenoble', 'nantes'] source_code = "/home/lpouilloux/src/executionware_backend/" default_connection_params['user'] = '******' logger.info("Looking for a running job") job = get_job_by_name(job_name, sites) if not job[0]: planning = get_planning(sites) blacklisted = ['talc', 'mbi'] slots = compute_slots(planning, walltime, excluded_elements=blacklisted) wanted = {'grid5000': 1} start_date, end_date, resources = find_first_slot(slots, wanted) for c in filter(lambda x: x in get_g5k_clusters(), resources.keys()): if resources[c] > 1: wanted = {c: 1} break jobs_specs = get_jobs_specs(wanted, name=job_name) for sub, frontend in jobs_specs: sub.walltime = walltime sub.job_type = "deploy" job = oarsub(jobs_specs)[0] nodes = get_oar_job_nodes(job[0], job[1]) logger.info('Deploying host %s', nodes[0].address)