def execute_specify(self, dict_local): in_path = dict_local["input_path"] out_path = dict_local["output_path"] subdir_list = FM.get_dir_names(in_path) csv_names = (dict_local["csv_names_list"]).split(",") for csv_name in csv_names: merge_csv(csv_name, subdir_list, in_path, out_path)
def main(): LC.configure() logger = logging.getLogger(__name__) input_path = "C://Users//Agnieszka//Documents//Out" output_path = "C://Users//Agnieszka//Documents//Out" csv_names = ['Cells.csv', 'Cytoplasm.csv', 'ExpandedNucleiLess.csv', 'ExpandedNucleiMore.csv', 'Image.csv', 'Nuclei.csv', 'RingCytoplasm.csv', 'ShrinkedNuclei.csv'] #'Experiment.csv' was not icluded in 'csv_names' list of files, because of different structure subdir_list = FM.get_dir_names(input_path) # getting the subdirectories' list (1 subdir = 1 well data) of the given directory for csv_name in csv_names: # merging data file (type) by file csv.merge(csv_name, subdir_list, input_path, output_path)
def execute_specify(self, dict_local): processes_number = int(self.config_dict["number_of_cores"]) folders_number = int(dict_local["folders_number"]) sleep_time = 5 #int(dict_local["sleep_time"]) pool = multiprocessing.Pool(processes_number) input_path = str(dict_local["input_path"]) dir_list = FM.get_dir_names(input_path) args = ((dict_local, element) for element in dir_list) #or just pass task, because we're able to get task_list and settings_dict from init if both functions will stay here pool.map_async(self.execute_queue, args) while True: if len(dir_list) < folders_number: sleep(sleep_time) new_dir_list = FM.get_dir_names(input_path) new_dirs = [i for i in new_dir_list if i not in dir_list] if len(new_dirs) > 0: args = ((dict_local, element) for element in new_dirs) #or just pass task, because we're able to get task_list and settings_dict from init if both functions will stay here pool.map_async(self.execute_queue, args) dir_list = new_dir_list else: break pool.close() pool.join()