def __init__(self, server_file, hostname, username, password, *args, **kwargs): self.servers_info = {} if server_file is not None: # read hostname-file host_names_and_paths_array = load_table_from_text_file( server_file, comment='#')[0] passw = None for i in range(host_names_and_paths_array.shape[0]): self.servers_info[host_names_and_paths_array[i, 0]] = { 'username': host_names_and_paths_array[i, 1], 'opus_path': host_names_and_paths_array[i, 2], 'communication_path_root': host_names_and_paths_array[i, 3], 'number_of_processes': int(host_names_and_paths_array[i, 4]) } previous_passw = None if (host_names_and_paths_array[i, 0] <> 'localhost'): default = '' if passw is not None: default = ' [previous password]' previous_passw = passw passw = getpass.getpass( 'Password for %s@%s%s:' % (self.servers_info[host_names_and_paths_array[i, 0]] ['username'], host_names_and_paths_array[i, 0], default)) if len(passw) == 0: passw = previous_passw self.servers_info[host_names_and_paths_array[ i, 0]]['password'] = passw else: self.servers_info[host_names_and_paths_array[ i, 0]]['password'] = None else: self.servers_info[hostname] = { 'username': username, 'opus_path': self.remote_opus_path, 'communication_path_root': self.remote_communication_path_root, 'number_of_processes': 1, 'password': password } for server in self.servers_info.keys(): self.servers_info[server][ 'python_command'] = self.python_commands.get( server, self.python_command) self.servers_info[server]['running'] = 0 # 0 processes are running RemoteRun.__init__(self, hostname, username, password, *args, **kwargs)
def __init__(self, server_file, hostname, username, password, *args, **kwargs): self.servers_info = {} if server_file is not None: # read hostname-file host_names_and_paths_array = load_table_from_text_file(server_file, comment='#')[0] passw = None for i in range(host_names_and_paths_array.shape[0]): self.servers_info[host_names_and_paths_array[i,0]] = { 'username': host_names_and_paths_array[i,1], 'opus_path': host_names_and_paths_array[i,2], 'communication_path_root': host_names_and_paths_array[i,3], 'number_of_processes': int(host_names_and_paths_array[i,4])} previous_passw = None if (host_names_and_paths_array[i,0] <> 'localhost'): default = '' if passw is not None: default = ' [previous password]' previous_passw = passw passw = getpass.getpass('Password for %s@%s%s:' % ( self.servers_info[host_names_and_paths_array[i,0]]['username'], host_names_and_paths_array[i,0], default)) if len(passw) == 0: passw = previous_passw self.servers_info[host_names_and_paths_array[i,0]]['password'] = passw else: self.servers_info[host_names_and_paths_array[i,0]]['password'] = None else: self.servers_info[hostname] = { 'username': username, 'opus_path': self.remote_opus_path, 'communication_path_root': self.remote_communication_path_root, 'number_of_processes': 1, 'password': password } for server in self.servers_info.keys(): self.servers_info[server]['python_command'] = self.python_commands.get(server, self.python_command) self.servers_info[server]['running'] = 0 # 0 processes are running RemoteRun.__init__(self, hostname, username, password, *args, **kwargs)
def read_run_id_file(self, filename): # filename is a file with a tuple (run_id, year, hostname) per row content = load_table_from_text_file(filename, convert_to_float=False)[0] for run_id, year, server in content: self.run_ids_dict[int(run_id)] = (int(year), server)
def plot_correlation_diagnose(filename): from opus_core.plot_functions import plot_matplot data, coef_names = load_table_from_text_file(filename, convert_to_float=True, header=True) plot_matplot(absolute(data), xlabels=coef_names, ylabels=coef_names)
def plot_utility_diagnose(filename): from opus_core.plot_functions import plot_barchart data, coef_names = load_table_from_text_file(filename, convert_to_float=True, header=True) plot_barchart(data[2, :], labels=coef_names)
def plot_correlation_diagnose(filename): from opus_core.plot_functions import plot_matplot data, coef_names = load_table_from_text_file(filename, convert_to_float=True, header=True) plot_matplot(absolute(data), xlabels = coef_names, ylabels=coef_names)
def plot_utility_diagnose(filename): from opus_core.plot_functions import plot_barchart data, coef_names = load_table_from_text_file(filename, convert_to_float=True, header=True) plot_barchart(data[2,:], labels = coef_names)