diff --git a/geo_filter.py b/geo_filter.py index 3ca1868..134f231 100644 --- a/geo_filter.py +++ b/geo_filter.py @@ -53,8 +53,10 @@ def process_files(path, dirs, files, geo_filtered_dict): os.makedirs('processed') except FileExistsError: pass + processes = [] for i in range(100): p = multiprocessing.Process(target=worker, args=(q, geo_filtered_dict)) + processes.append(p) p.start() os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = 'twitter-sentiment-analysis-f22ce784b0a8.json' try: @@ -67,5 +69,7 @@ def process_files(path, dirs, files, geo_filtered_dict): with open('geo_filtered.pkl', 'wb') as f: pickle.dump(geo_filtered, f) print('done') + for p in processes: + p.kill()