Exemplo n.º 1
0
 def _compose_worker_user_data(self):
     """
     Compose worker instance user data, returning a dictionary.
     """
     worker_ud = {}
     worker_ud['role'] = 'worker'
     worker_ud['master_public_ip'] = self.get_public_ip()
     worker_ud['master_ip'] = self.get_private_ip()
     worker_ud['master_hostname'] = self.get_local_hostname()
     worker_ud['master_hostname_alt'] = misc.get_hostname()
     worker_ud['cluster_type'] = self.app.manager.initial_cluster_type
     # Merge the worker's user data with the master's user data
     worker_ud = dict(self.app.config.items() + worker_ud.items())
     return worker_ud
Exemplo n.º 2
0
 def _compose_worker_user_data(self):
     """
     Compose worker instance user data, returning a dictionary.
     """
     worker_ud = {}
     worker_ud['role'] = 'worker'
     worker_ud['master_public_ip'] = self.get_public_ip()
     worker_ud['master_ip'] = self.get_private_ip()
     worker_ud['master_hostname'] = self.get_local_hostname()
     worker_ud['master_hostname_alt'] = misc.get_hostname()
     worker_ud['cluster_type'] = self.app.manager.initial_cluster_type
     # Merge the worker's user data with the master's user data
     worker_ud = dict(self.app.config.items() + worker_ud.items())
     return worker_ud
Exemplo n.º 3
0
 def _build_slurm_conf():
     log.debug("Setting slurm.conf parameters")
     # Make sure the slurm root dir exists and is owned by slurm user
     misc.make_dir(self.app.path_resolver.slurm_root_tmp)
     os.chown(self.app.path_resolver.slurm_root_tmp,
              pwd.getpwnam("slurm")[2], grp.getgrnam("slurm")[2])
     worker_nodes, worker_names = _worker_nodes_conf()
     slurm_conf_template = conf_manager.load_conf_template(conf_manager.SLURM_CONF_TEMPLATE)
     slurm_conf_params = {
         "master_hostname": misc.get_hostname(),
         "num_cpus": max(self.app.manager.num_cpus - 1, 1),  # Reserve 1 CPU
         "total_memory": max(1, self.app.manager.total_memory / 1024),
         "slurm_root_tmp": self.app.path_resolver.slurm_root_tmp,
         "worker_nodes": worker_nodes,
         "worker_names": worker_names
     }
     return slurm_conf_template.substitute(slurm_conf_params)
Exemplo n.º 4
0
 def _build_slurm_conf():
     log.debug("Setting slurm.conf parameters")
     # Make sure the slurm root dir exists and is owned by slurm user
     misc.make_dir(self.app.path_resolver.slurm_root_tmp)
     os.chown(self.app.path_resolver.slurm_root_tmp,
              pwd.getpwnam("slurm")[2], grp.getgrnam("slurm")[2])
     worker_nodes, worker_names = _worker_nodes_conf()
     slurm_conf_template = conf_manager.load_conf_template(conf_manager.SLURM_CONF_TEMPLATE)
     slurm_conf_params = {
         "master_hostname": misc.get_hostname(),
         "num_cpus": max(self.app.manager.num_cpus - 1, 1),  # Reserve 1 CPU
         "total_memory": max(1, self.app.manager.total_memory / 1024),
         "slurm_root_tmp": self.app.path_resolver.slurm_root_tmp,
         "worker_nodes": worker_nodes,
         "worker_names": worker_names
     }
     return slurm_conf_template.substitute(slurm_conf_params)