mg-pso-gui 0.2.34__py3-none-any.whl → 0.2.35__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mg-pso-gui
3
- Version: 0.2.34
3
+ Version: 0.2.35
4
4
  Summary: GUI for MG-PSO
5
5
  Author: Robert Cordingly
6
6
  Author-email: <rcording@uw.ed>
@@ -44,7 +44,7 @@ mgpsogui/gui/images/test.png,sha256=MUnVpRK-isxhEHzx4Q6Yh0M6FRZD1qvgCHH2XmiSBbk,
44
44
  mgpsogui/gui/images/trash.png,sha256=j8cf0kWbJd-4Jp20lUVV1o1NSeQ4v1Ej4gfcIA3DVRQ,2958
45
45
  mgpsogui/gui/images/up.png,sha256=AQvFWCUqSQNaQ1E6LKZ9zNfSvW6t4mgy8uswdg9T2Hg,2457
46
46
  mgpsogui/util/GraphGenerator.py,sha256=dKzDPMK-0S6j1yIp5xoQIgN9GTKMhGpboAXjofCpmIk,31973
47
- mgpsogui/util/PSORunner.py,sha256=UATYIop8IofEhyRyE2CuoTn8A6ZuB2xN4xy5SP_X5rs,20105
47
+ mgpsogui/util/PSORunner.py,sha256=anp0ioxAz6uv8OFGtRhVHFrOsq3CRHN2x02ekMaKfn4,20830
48
48
  mgpsogui/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
49
49
  mgpsogui/util/debug.py,sha256=Swzny9_1S-CCONWGssj9iDoSpbwu5Vr4f95g_9L8bec,19759
50
50
  mgpsogui/util/helpers.py,sha256=Ht2rge_4pGO7halz6KoLsL2eukB0k2tlkx68lBBmBA8,2669
@@ -69,8 +69,8 @@ mgpsogui/util/recosu/utils/trace_writer.py,sha256=V9BJlOjCbNYGoXGEk3CF5wjifBxvar
69
69
  mgpsogui/util/recosu/utils/utils.py,sha256=QB8vftq3142ekG0ORjz0ZBHU5YknXbR0oTsrxrPAsF0,3951
70
70
  mgpsogui/util/recosu/utils/plot/__init__.py,sha256=h1KjM7_tNDv351pcwt8A6Ibb1jhwWyx5Gbu-zj-sI3Q,71
71
71
  mgpsogui/util/recosu/utils/plot/cost_steps.py,sha256=1Ce11AJyweWkmvjXPxEygzS-h8yVLmQEDLS53yjPLqQ,3779
72
- mg_pso_gui-0.2.34.dist-info/METADATA,sha256=pGYSwhKSxk5zV-zZP0Rmtg4OSQKO2-bkoUdEA7dzeVw,9455
73
- mg_pso_gui-0.2.34.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
74
- mg_pso_gui-0.2.34.dist-info/entry_points.txt,sha256=jg82VOFjR1XDGrchs1wJSCqKYE4Ozv12aBcCSp--koA,117
75
- mg_pso_gui-0.2.34.dist-info/top_level.txt,sha256=y7JuS9xJN5YdxUsQ3PSVjN8MzQAnR146bP3ZN3PYWdE,9
76
- mg_pso_gui-0.2.34.dist-info/RECORD,,
72
+ mg_pso_gui-0.2.35.dist-info/METADATA,sha256=YxvOLPbuFbEOeR3WLHdCtXJNzxPF4jTL1DGtZNWo7rM,9455
73
+ mg_pso_gui-0.2.35.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
74
+ mg_pso_gui-0.2.35.dist-info/entry_points.txt,sha256=jg82VOFjR1XDGrchs1wJSCqKYE4Ozv12aBcCSp--koA,117
75
+ mg_pso_gui-0.2.35.dist-info/top_level.txt,sha256=y7JuS9xJN5YdxUsQ3PSVjN8MzQAnR146bP3ZN3PYWdE,9
76
+ mg_pso_gui-0.2.35.dist-info/RECORD,,
@@ -30,53 +30,72 @@ def run_process(stdout_queue, stderr_queue, results_queue, data, folder, mode):
30
30
  folder (_type_): _description_
31
31
  mode (_type_): _description_
32
32
  """
33
+ try:
34
+ # Setup folders
35
+ if not os.path.exists(folder):
36
+ os.makedirs(folder)
33
37
 
34
- # Setup folders
35
- if not os.path.exists(folder):
36
- os.makedirs(folder)
38
+ if not os.path.exists(os.path.join(folder, "results")):
39
+ os.makedirs(os.path.join(folder, "results"))
37
40
 
38
- if not os.path.exists(os.path.join(folder, "results")):
39
- os.makedirs(os.path.join(folder, "results"))
41
+ if (os.path.exists(os.path.join(folder, 'output.txt'))):
42
+ os.remove(os.path.join(folder, 'output.txt'))
43
+
44
+ if (os.path.exists(os.path.join(folder, 'error.txt'))):
45
+ os.remove(os.path.join(folder, 'error.txt'))
40
46
 
41
- if (os.path.exists(os.path.join(folder, 'output.txt'))):
42
- os.remove(os.path.join(folder, 'output.txt'))
47
+ # Redirect stdout and stderr to files
48
+ old_stdout = sys.stdout
49
+ old_stderr = sys.stderr
43
50
 
44
- if (os.path.exists(os.path.join(folder, 'error.txt'))):
45
- os.remove(os.path.join(folder, 'error.txt'))
51
+ read_stdout, write_stdout = os.pipe()
52
+ read_stderr, write_stderr = os.pipe()
53
+
54
+ sys.stdout = os.fdopen(write_stdout, 'w')
55
+ sys.stderr = os.fdopen(write_stderr, 'w')
56
+
57
+ stdout_thread = threading.Thread(target=enqueue_output, args=(os.fdopen(read_stdout, 'r'), stdout_queue))
58
+ stderr_thread = threading.Thread(target=enqueue_output, args=(os.fdopen(read_stderr, 'r'), stderr_queue))
59
+ stdout_thread.daemon = True
60
+ stderr_thread.daemon = True
61
+ stdout_thread.start()
62
+ stderr_thread.start()
63
+
64
+ if mode == "Sampling: Halton":
65
+ run_sampling(data, "halton", folder, results_queue)
66
+ elif mode == "Sampling: Random":
67
+ run_sampling(data, "random", folder, results_queue)
68
+ elif mode == "Sensitivity Analysis":
69
+ run_sensitivity_analysis(data, folder, results_queue)
70
+ elif mode == "Optimization":
71
+ run_optimization(data, folder, results_queue)
72
+ else:
73
+ print("Invalid mode")
46
74
 
47
- # Redirect stdout and stderr to files
48
- old_stdout = sys.stdout
49
- old_stderr = sys.stderr
50
-
51
- read_stdout, write_stdout = os.pipe()
52
- read_stderr, write_stderr = os.pipe()
53
-
54
- sys.stdout = os.fdopen(write_stdout, 'w')
55
- sys.stderr = os.fdopen(write_stderr, 'w')
56
-
57
- stdout_thread = threading.Thread(target=enqueue_output, args=(os.fdopen(read_stdout, 'r'), stdout_queue))
58
- stderr_thread = threading.Thread(target=enqueue_output, args=(os.fdopen(read_stderr, 'r'), stderr_queue))
59
- stdout_thread.daemon = True
60
- stderr_thread.daemon = True
61
- stdout_thread.start()
62
- stderr_thread.start()
75
+ stdout_thread.join()
76
+ stderr_thread.join()
77
+
78
+ sys.stdout = old_stdout
79
+ sys.stderr = old_stderr
80
+
81
+ except Exception as e:
82
+ print("An exception occurred: ", flush=True)
83
+ print(str(e))
84
+ # Print stack trace
85
+ import traceback
86
+ traceback.print_exc()
63
87
 
64
- if mode == "Sampling: Halton":
65
- run_sampling(data, "halton", folder, results_queue)
66
- elif mode == "Sampling: Random":
67
- run_sampling(data, "random", folder, results_queue)
68
- elif mode == "Sensitivity Analysis":
69
- run_sensitivity_analysis(data, folder, results_queue)
70
- elif mode == "Optimization":
71
- run_optimization(data, folder, results_queue)
72
- else:
73
- print("Invalid mode")
74
-
75
- stdout_thread.join()
76
- stderr_thread.join()
77
-
78
- sys.stdout = old_stdout
79
- sys.stderr = old_stderr
88
+ # Write all of this information to a crash file
89
+ with open(os.path.join(folder, 'crash.txt'), 'w') as f:
90
+ f.write(str(e))
91
+ f.write("\n")
92
+ traceback.print_exc(file=f)
93
+ finally:
94
+ stdout_thread.join()
95
+ stderr_thread.join()
96
+
97
+ sys.stdout = old_stdout
98
+ sys.stderr = old_stderr
80
99
 
81
100
  def process_list(data, parameter_map, args, options, oh_strategy, config, metainfo, list_name):
82
101
  """_summary_