@@ -89,6 +89,8 @@ def run_task(self, fw_spec):
89
89
multirun = multirun ,
90
90
)
91
91
92
+ logger .info ("Drone finished!" )
93
+
92
94
# parse the GRAD file, if desired and if it is present
93
95
if self .get ("parse_grad_file" , False ):
94
96
grad_file = None
@@ -112,23 +114,28 @@ def run_task(self, fw_spec):
112
114
if grad_file is None :
113
115
task_doc ["warnings" ]["grad_file_missing" ] = True
114
116
else :
117
+ logger .info ("Parsing gradient file" )
115
118
grad = []
116
119
if grad_file [- 5 :] == "131.0" or grad_file [- 8 :] == "131.0.gz" :
117
120
tmp_grad_data = []
121
+ logger .info ("Gradient file is binary" )
118
122
with zopen (grad_file , mode = "rb" ) as file :
119
123
binary = file .read ()
120
- for ii in range (int (len (binary )/ 8 )):
121
- tmp_grad_data .append (struct .unpack ("d" ,binary [ii * 8 :(ii + 1 )* 8 ])[0 ])
124
+ for ii in range (int (len (binary ) / 8 )):
125
+ tmp_grad_data .append (
126
+ struct .unpack ("d" , binary [ii * 8 : (ii + 1 ) * 8 ])[0 ]
127
+ )
122
128
grad = []
123
- for ii in range (int (len (tmp_grad_data )/ 3 )):
129
+ for ii in range (int (len (tmp_grad_data ) / 3 )):
124
130
grad .append (
125
131
[
126
- float (tmp_grad_data [ii * 3 ]),
127
- float (tmp_grad_data [ii * 3 + 1 ]),
128
- float (tmp_grad_data [ii * 3 + 2 ])
132
+ float (tmp_grad_data [ii * 3 ]),
133
+ float (tmp_grad_data [ii * 3 + 1 ]),
134
+ float (tmp_grad_data [ii * 3 + 2 ]),
129
135
]
130
136
)
131
137
else :
138
+ logger .info ("Gradient file is text" )
132
139
with zopen (grad_file , mode = "rt" , encoding = "ISO-8859-1" ) as f :
133
140
lines = f .readlines ()
134
141
for line in lines :
@@ -142,6 +149,7 @@ def run_task(self, fw_spec):
142
149
]
143
150
)
144
151
task_doc ["output" ]["precise_gradients" ] = grad
152
+ logger .info ("Done parsing gradient. Now removing scratch directory" )
145
153
if os .path .exists (os .path .join (calc_dir , "scratch" )):
146
154
shutil .rmtree (os .path .join (calc_dir , "scratch" ))
147
155
@@ -161,23 +169,31 @@ def run_task(self, fw_spec):
161
169
if len (hess_files ) == 0 :
162
170
task_doc ["warnings" ]["hess_file_missing" ] = True
163
171
else :
172
+ logger .info ("Parsing Hessian file" )
164
173
hess_data = {}
165
174
for hess_name in hess_files :
166
175
if hess_name [- 5 :] == "132.0" or hess_name [- 8 :] == "132.0.gz" :
176
+ logger .info ("Hessian file is binary" )
167
177
tmp_hess_data = []
168
- with zopen (os .path .join (calc_dir , hess_name ), mode = "rb" ) as file :
178
+ with zopen (
179
+ os .path .join (calc_dir , hess_name ), mode = "rb"
180
+ ) as file :
169
181
binary = file .read ()
170
- for ii in range (int (len (binary )/ 8 )):
171
- tmp_hess_data .append (struct .unpack ("d" ,binary [ii * 8 :(ii + 1 )* 8 ])[0 ])
182
+ for ii in range (int (len (binary ) / 8 )):
183
+ tmp_hess_data .append (
184
+ struct .unpack ("d" , binary [ii * 8 : (ii + 1 ) * 8 ])[0 ]
185
+ )
172
186
hess_data [hess_name ] = tmp_hess_data
173
187
else :
188
+ logger .info ("Hessian file is text" )
174
189
with zopen (
175
190
os .path .join (calc_dir , hess_name ),
176
191
mode = "rt" ,
177
192
encoding = "ISO-8859-1" ,
178
193
) as f :
179
194
hess_data [hess_name ] = f .readlines ()
180
195
task_doc ["output" ]["hess_data" ] = hess_data
196
+ logger .info ("Done parsing Hessian. Now removing scratch directory" )
181
197
if os .path .exists (os .path .join (calc_dir , "scratch" )):
182
198
shutil .rmtree (os .path .join (calc_dir , "scratch" ))
183
199
0 commit comments