def __fetch_hawq_configuration(self): '''Fetch master hostname, segments hostname, data directory of HAWQ.''' self.hawq_master = config.getMasterHostName() self.hawq_segments = config.getSegHostNames() self.hawq_paths = [] self.hawq_config = {} sql = "SELECT gsc.hostname, pfe.fselocation FROM gp_segment_configuration gsc, pg_filespace_entry pfe WHERE gsc.dbid = pfe.fsedbid AND pfe.fselocation NOT LIKE 'hdfs%' ORDER BY pfe.fselocation;" (ok, out) = psql.runcmd( dbname = 'postgres', cmd = sql , ofile = '-', flag = '-q -t' ) if not ok: print out raise Exception("Failed to get HAWQ configuration paths.") else: for line in out: line = line.strip() if line: (host, path) = line.split( '|' ) if not self.hawq_config.has_key(host.strip()): self.hawq_config[host.strip()] = [] self.hawq_config[host.strip()].append(path.strip()) # self.hawq_config.append( (host.strip(), path.strip()) ) self.hawq_paths.append( path.strip() ) print self.hawq_master print self.hawq_segments print self.hawq_config
def __fetch_hawq_configuration(self): '''Fetch master hostname, segments hostname, data directory of HAWQ.''' self.hawq_master = config.getMasterHostName() self.hawq_segments = config.getSegHostNames() self.hawq_paths = [] self.hawq_config = {} sql = "SELECT gsc.hostname, pfe.fselocation FROM gp_segment_configuration gsc, pg_filespace_entry pfe WHERE gsc.dbid = pfe.fsedbid AND pfe.fselocation NOT LIKE 'hdfs%' ORDER BY pfe.fselocation;" (ok, out) = psql.runcmd(dbname='postgres', cmd=sql, ofile='-', flag='-q -t') if not ok: print out raise Exception("Failed to get HAWQ configuration paths.") else: for line in out: line = line.strip() if line: (host, path) = line.split('|') if not self.hawq_config.has_key(host.strip()): self.hawq_config[host.strip()] = [] self.hawq_config[host.strip()].append(path.strip()) # self.hawq_config.append( (host.strip(), path.strip()) ) self.hawq_paths.append(path.strip()) print self.hawq_master print self.hawq_segments print self.hawq_config
def __init__(self, workload_specification, workload_directory, report_directory, report_sql_file, cs_id, tr_id, user): # init base common setting such as dbname, load_data, run_workload , niteration etc Workload.__init__(self, workload_specification, workload_directory, report_directory, report_sql_file, cs_id, tr_id, user) self.fname = self.tmp_folder + os.sep + 'gpfdist.lineitem.tbl' self.dss = self.workload_directory + os.sep + 'dists.dss' self.host_name = config.getMasterHostName()
def _prepare_hostfile(self): # prep hostfile_master master_host_name = config.getMasterHostName() with open(self.hostfile_master, 'w') as f: f.write(str(master_host_name) + '\n') # prep hostfile_seg self.seg_hostname_list = config.getSegHostNames() self.seg_host_num = len(self.seg_hostname_list) with open(self.hostfile_seg, 'w') as f: f.write('\n'.join(self.seg_hostname_list))