@@ -233,6 +233,7 @@ def after_process(self):
233
233
234
234
# see if we have anything else lined up to run next
235
235
for next in self .parameters .get ("next" , []):
236
+ can_run_next = True
236
237
next_parameters = next .get ("parameters" , {})
237
238
next_type = next .get ("type" , "" )
238
239
try :
@@ -243,6 +244,7 @@ def after_process(self):
243
244
244
245
# run it only if the post-processor is actually available for this query
245
246
if self .dataset .data ["num_rows" ] <= 0 :
247
+ can_run_next = False
246
248
self .log .info ("Not running follow-up processor of type %s for dataset %s, no input data for follow-up" % (next_type , self .dataset .key ))
247
249
248
250
elif next_type in available_processors :
@@ -257,8 +259,32 @@ def after_process(self):
257
259
)
258
260
self .queue .add_job (next_type , remote_id = next_analysis .key )
259
261
else :
262
+ can_run_next = False
260
263
self .log .warning ("Dataset %s (of type %s) wants to run processor %s next, but it is incompatible" % (self .dataset .key , self .type , next_type ))
261
264
265
+ if not can_run_next :
266
+ # We are unable to continue the chain of processors, so we check to see if we are attaching to a parent
267
+ # preset; this allows the parent (for example a preset) to be finished and any successful processors displayed
268
+ if "attach_to" in self .parameters :
269
+ # Probably should not happen, but for some reason a mid processor has been designated as the processor
270
+ # the parent should attach to
271
+ pass
272
+ else :
273
+ # Check for "attach_to" parameter in descendents
274
+ have_attach_to = False
275
+ while not have_attach_to :
276
+ if "attach_to" in next_parameters :
277
+ self .parameters ["attach_to" ] = next_parameters ["attach_to" ]
278
+ break
279
+ else :
280
+ if "next" in next_parameters :
281
+ next_parameters = next_parameters ["next" ]
282
+ else :
283
+ # No more descendents
284
+ # Should not happen; we cannot find the source dataset
285
+ break
286
+
287
+
262
288
# see if we need to register the result somewhere
263
289
if "copy_to" in self .parameters :
264
290
# copy the results to an arbitrary place that was passed
0 commit comments