cyrusyc commited on
Commit
5f271cc
·
1 Parent(s): 84a2a83

bugfix save_to_hdf

Browse files
mlip_arena/tasks/eos_alloy/flow.py CHANGED
@@ -9,7 +9,7 @@ from huggingface_hub import hf_hub_download
9
  from prefect import Task, flow, task
10
  from prefect.client.schemas.objects import TaskRun
11
  from prefect.futures import wait
12
- from prefect.states import State
13
  from prefect_dask import DaskTaskRunner
14
 
15
  from ase.db import connect
@@ -40,9 +40,15 @@ def save_to_hdf(
40
  Define a hook on completion of EOS task to save results to HDF5 file.
41
  """
42
 
43
- if run.state.is_completed():
44
- result = run.state.result(raise_on_failure=False)
45
 
 
 
 
 
 
 
46
  atoms = result["atoms"]
47
  calculator_name = (
48
  run.task_inputs["calculator_name"] or result["calculator_name"]
@@ -83,6 +89,8 @@ def save_to_hdf(
83
  data_columns=True,
84
  min_itemsize={"formula": 50, "method": 20},
85
  )
 
 
86
 
87
 
88
  @flow
 
9
  from prefect import Task, flow, task
10
  from prefect.client.schemas.objects import TaskRun
11
  from prefect.futures import wait
12
+ from prefect.states import State, Failed
13
  from prefect_dask import DaskTaskRunner
14
 
15
  from ase.db import connect
 
40
  Define a hook on completion of EOS task to save results to HDF5 file.
41
  """
42
 
43
+ if run.state.is_failed():
44
+ return
45
 
46
+ result = run.state.result(raise_on_failure=False)
47
+
48
+ if not isinstance(result, dict):
49
+ return
50
+
51
+ try:
52
  atoms = result["atoms"]
53
  calculator_name = (
54
  run.task_inputs["calculator_name"] or result["calculator_name"]
 
89
  data_columns=True,
90
  min_itemsize={"formula": 50, "method": 20},
91
  )
92
+ except Exception as e:
93
+ print(e)
94
 
95
 
96
  @flow
mlip_arena/tasks/eos_alloy/run.ipynb CHANGED
@@ -107,18 +107,30 @@
107
  "source ~/.bashrc\n",
108
  "module load python\n",
109
  "source activate /pscratch/sd/c/cyrusyc/.conda/mlip-arena\n",
 
110
  "/pscratch/sd/c/cyrusyc/.conda/mlip-arena/bin/python -m distributed.cli.dask_worker tcp://128.55.64.37:38383 --name dummy-name --nthreads 1 --memory-limit 59.60GiB --nanny --death-timeout 60\n",
 
 
 
111
  "\n"
112
  ]
113
  },
114
  {
115
  "data": {
116
  "text/html": [
 
117
  "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">22:51:52.414 | <span style=\"color: #008080; text-decoration-color: #008080\">INFO</span> | prefect.engine - Created flow run<span style=\"color: #800080; text-decoration-color: #800080\"> 'sly-owl'</span> for flow<span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\"> 'run-from-db'</span>\n",
118
  "</pre>\n"
119
  ],
120
  "text/plain": [
121
  "22:51:52.414 | \u001b[36mINFO\u001b[0m | prefect.engine - Created flow run\u001b[35m 'sly-owl'\u001b[0m for flow\u001b[1;35m 'run-from-db'\u001b[0m\n"
 
 
 
 
 
 
 
122
  ]
123
  },
124
  "metadata": {},
@@ -127,11 +139,19 @@
127
  {
128
  "data": {
129
  "text/html": [
 
130
  "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">22:51:52.419 | <span style=\"color: #008080; text-decoration-color: #008080\">INFO</span> | prefect.engine - View at <span style=\"color: #0000ff; text-decoration-color: #0000ff\">https://app.prefect.cloud/account/f7d40474-9362-4bfa-8950-ee6a43ec00f3/workspace/d4bb0913-5f5e-49f7-bfc5-06509088baeb/runs/flow-run/d2afea80-afd7-4be2-b734-087f31274217</span>\n",
131
  "</pre>\n"
132
  ],
133
  "text/plain": [
134
  "22:51:52.419 | \u001b[36mINFO\u001b[0m | prefect.engine - View at \u001b[94mhttps://app.prefect.cloud/account/f7d40474-9362-4bfa-8950-ee6a43ec00f3/workspace/d4bb0913-5f5e-49f7-bfc5-06509088baeb/runs/flow-run/d2afea80-afd7-4be2-b734-087f31274217\u001b[0m\n"
 
 
 
 
 
 
 
135
  ]
136
  },
137
  "metadata": {},
@@ -140,11 +160,19 @@
140
  {
141
  "data": {
142
  "text/html": [
 
143
  "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">22:51:53.100 | <span style=\"color: #008080; text-decoration-color: #008080\">INFO</span> | prefect.task_runner.dask - Connecting to existing Dask cluster SLURMCluster(f5a25e18, 'tcp://128.55.64.37:38383', workers=0, threads=0, memory=0 B)\n",
144
  "</pre>\n"
145
  ],
146
  "text/plain": [
147
  "22:51:53.100 | \u001b[36mINFO\u001b[0m | prefect.task_runner.dask - Connecting to existing Dask cluster SLURMCluster(f5a25e18, 'tcp://128.55.64.37:38383', workers=0, threads=0, memory=0 B)\n"
 
 
 
 
 
 
 
148
  ]
149
  },
150
  "metadata": {},
@@ -153,11 +181,19 @@
153
  {
154
  "data": {
155
  "text/html": [
 
156
  "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">22:52:10.768 | <span style=\"color: #008080; text-decoration-color: #008080\">INFO</span> | Task run 'get_atoms_from_db-f27' - Created task run 'get_atoms_from_db-f27' for task 'get_atoms_from_db'\n",
157
  "</pre>\n"
158
  ],
159
  "text/plain": [
160
  "22:52:10.768 | \u001b[36mINFO\u001b[0m | Task run 'get_atoms_from_db-f27' - Created task run 'get_atoms_from_db-f27' for task 'get_atoms_from_db'\n"
 
 
 
 
 
 
 
161
  ]
162
  },
163
  "metadata": {},
@@ -166,11 +202,19 @@
166
  {
167
  "data": {
168
  "text/html": [
 
169
  "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">22:52:41.782 | <span style=\"color: #008080; text-decoration-color: #008080\">INFO</span> | Task run 'get_atoms_from_db-f27' - Finished in state <span style=\"color: #008000; text-decoration-color: #008000\">Completed</span>()\n",
170
  "</pre>\n"
171
  ],
172
  "text/plain": [
173
  "22:52:41.782 | \u001b[36mINFO\u001b[0m | Task run 'get_atoms_from_db-f27' - Finished in state \u001b[32mCompleted\u001b[0m()\n"
 
 
 
 
 
 
 
174
  ]
175
  },
176
  "metadata": {},
 
107
  "source ~/.bashrc\n",
108
  "module load python\n",
109
  "source activate /pscratch/sd/c/cyrusyc/.conda/mlip-arena\n",
110
+ <<<<<<< Updated upstream
111
  "/pscratch/sd/c/cyrusyc/.conda/mlip-arena/bin/python -m distributed.cli.dask_worker tcp://128.55.64.37:38383 --name dummy-name --nthreads 1 --memory-limit 59.60GiB --nanny --death-timeout 60\n",
112
+ =======
113
+ "/pscratch/sd/c/cyrusyc/.conda/mlip-arena/bin/python -m distributed.cli.dask_worker tcp://128.55.64.21:34485 --name dummy-name --nthreads 1 --memory-limit 59.60GiB --nanny --death-timeout 60\n",
114
+ >>>>>>> Stashed changes
115
  "\n"
116
  ]
117
  },
118
  {
119
  "data": {
120
  "text/html": [
121
+ <<<<<<< Updated upstream
122
  "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">22:51:52.414 | <span style=\"color: #008080; text-decoration-color: #008080\">INFO</span> | prefect.engine - Created flow run<span style=\"color: #800080; text-decoration-color: #800080\"> 'sly-owl'</span> for flow<span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\"> 'run-from-db'</span>\n",
123
  "</pre>\n"
124
  ],
125
  "text/plain": [
126
  "22:51:52.414 | \u001b[36mINFO\u001b[0m | prefect.engine - Created flow run\u001b[35m 'sly-owl'\u001b[0m for flow\u001b[1;35m 'run-from-db'\u001b[0m\n"
127
+ =======
128
+ "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">13:44:10.434 | <span style=\"color: #008080; text-decoration-color: #008080\">INFO</span> | prefect.engine - Created flow run<span style=\"color: #800080; text-decoration-color: #800080\"> 'khaki-spider'</span> for flow<span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\"> 'run-from-db'</span>\n",
129
+ "</pre>\n"
130
+ ],
131
+ "text/plain": [
132
+ "13:44:10.434 | \u001b[36mINFO\u001b[0m | prefect.engine - Created flow run\u001b[35m 'khaki-spider'\u001b[0m for flow\u001b[1;35m 'run-from-db'\u001b[0m\n"
133
+ >>>>>>> Stashed changes
134
  ]
135
  },
136
  "metadata": {},
 
139
  {
140
  "data": {
141
  "text/html": [
142
+ <<<<<<< Updated upstream
143
  "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">22:51:52.419 | <span style=\"color: #008080; text-decoration-color: #008080\">INFO</span> | prefect.engine - View at <span style=\"color: #0000ff; text-decoration-color: #0000ff\">https://app.prefect.cloud/account/f7d40474-9362-4bfa-8950-ee6a43ec00f3/workspace/d4bb0913-5f5e-49f7-bfc5-06509088baeb/runs/flow-run/d2afea80-afd7-4be2-b734-087f31274217</span>\n",
144
  "</pre>\n"
145
  ],
146
  "text/plain": [
147
  "22:51:52.419 | \u001b[36mINFO\u001b[0m | prefect.engine - View at \u001b[94mhttps://app.prefect.cloud/account/f7d40474-9362-4bfa-8950-ee6a43ec00f3/workspace/d4bb0913-5f5e-49f7-bfc5-06509088baeb/runs/flow-run/d2afea80-afd7-4be2-b734-087f31274217\u001b[0m\n"
148
+ =======
149
+ "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">13:44:10.439 | <span style=\"color: #008080; text-decoration-color: #008080\">INFO</span> | prefect.engine - View at <span style=\"color: #0000ff; text-decoration-color: #0000ff\">https://app.prefect.cloud/account/f7d40474-9362-4bfa-8950-ee6a43ec00f3/workspace/d4bb0913-5f5e-49f7-bfc5-06509088baeb/runs/flow-run/1acc1e4f-4cbc-49d7-964d-a132abd28d08</span>\n",
150
+ "</pre>\n"
151
+ ],
152
+ "text/plain": [
153
+ "13:44:10.439 | \u001b[36mINFO\u001b[0m | prefect.engine - View at \u001b[94mhttps://app.prefect.cloud/account/f7d40474-9362-4bfa-8950-ee6a43ec00f3/workspace/d4bb0913-5f5e-49f7-bfc5-06509088baeb/runs/flow-run/1acc1e4f-4cbc-49d7-964d-a132abd28d08\u001b[0m\n"
154
+ >>>>>>> Stashed changes
155
  ]
156
  },
157
  "metadata": {},
 
160
  {
161
  "data": {
162
  "text/html": [
163
+ <<<<<<< Updated upstream
164
  "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">22:51:53.100 | <span style=\"color: #008080; text-decoration-color: #008080\">INFO</span> | prefect.task_runner.dask - Connecting to existing Dask cluster SLURMCluster(f5a25e18, 'tcp://128.55.64.37:38383', workers=0, threads=0, memory=0 B)\n",
165
  "</pre>\n"
166
  ],
167
  "text/plain": [
168
  "22:51:53.100 | \u001b[36mINFO\u001b[0m | prefect.task_runner.dask - Connecting to existing Dask cluster SLURMCluster(f5a25e18, 'tcp://128.55.64.37:38383', workers=0, threads=0, memory=0 B)\n"
169
+ =======
170
+ "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">13:44:11.086 | <span style=\"color: #008080; text-decoration-color: #008080\">INFO</span> | prefect.task_runner.dask - Connecting to existing Dask cluster SLURMCluster(58a52fcd, 'tcp://128.55.64.21:34485', workers=0, threads=0, memory=0 B)\n",
171
+ "</pre>\n"
172
+ ],
173
+ "text/plain": [
174
+ "13:44:11.086 | \u001b[36mINFO\u001b[0m | prefect.task_runner.dask - Connecting to existing Dask cluster SLURMCluster(58a52fcd, 'tcp://128.55.64.21:34485', workers=0, threads=0, memory=0 B)\n"
175
+ >>>>>>> Stashed changes
176
  ]
177
  },
178
  "metadata": {},
 
181
  {
182
  "data": {
183
  "text/html": [
184
+ <<<<<<< Updated upstream
185
  "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">22:52:10.768 | <span style=\"color: #008080; text-decoration-color: #008080\">INFO</span> | Task run 'get_atoms_from_db-f27' - Created task run 'get_atoms_from_db-f27' for task 'get_atoms_from_db'\n",
186
  "</pre>\n"
187
  ],
188
  "text/plain": [
189
  "22:52:10.768 | \u001b[36mINFO\u001b[0m | Task run 'get_atoms_from_db-f27' - Created task run 'get_atoms_from_db-f27' for task 'get_atoms_from_db'\n"
190
+ =======
191
+ "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">13:45:41.275 | <span style=\"color: #008080; text-decoration-color: #008080\">INFO</span> | Task run 'get_atoms_from_db-8e2' - Created task run 'get_atoms_from_db-8e2' for task 'get_atoms_from_db'\n",
192
+ "</pre>\n"
193
+ ],
194
+ "text/plain": [
195
+ "13:45:41.275 | \u001b[36mINFO\u001b[0m | Task run 'get_atoms_from_db-8e2' - Created task run 'get_atoms_from_db-8e2' for task 'get_atoms_from_db'\n"
196
+ >>>>>>> Stashed changes
197
  ]
198
  },
199
  "metadata": {},
 
202
  {
203
  "data": {
204
  "text/html": [
205
+ <<<<<<< Updated upstream
206
  "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">22:52:41.782 | <span style=\"color: #008080; text-decoration-color: #008080\">INFO</span> | Task run 'get_atoms_from_db-f27' - Finished in state <span style=\"color: #008000; text-decoration-color: #008000\">Completed</span>()\n",
207
  "</pre>\n"
208
  ],
209
  "text/plain": [
210
  "22:52:41.782 | \u001b[36mINFO\u001b[0m | Task run 'get_atoms_from_db-f27' - Finished in state \u001b[32mCompleted\u001b[0m()\n"
211
+ =======
212
+ "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">13:46:12.488 | <span style=\"color: #008080; text-decoration-color: #008080\">INFO</span> | Task run 'get_atoms_from_db-8e2' - Finished in state <span style=\"color: #008000; text-decoration-color: #008000\">Completed</span>()\n",
213
+ "</pre>\n"
214
+ ],
215
+ "text/plain": [
216
+ "13:46:12.488 | \u001b[36mINFO\u001b[0m | Task run 'get_atoms_from_db-8e2' - Finished in state \u001b[32mCompleted\u001b[0m()\n"
217
+ >>>>>>> Stashed changes
218
  ]
219
  },
220
  "metadata": {},