public boolean shouldDeleteTask(Task<?> task) { Set<Object> tags = task.getTags(); if (tags.contains(ManagementContextInternal.TRANSIENT_TASK_TAG)) return true; if (tags.contains(ManagementContextInternal.EFFECTOR_TAG) || tags.contains(ManagementContextInternal.NON_TRANSIENT_TASK_TAG)) return false; if (task.getSubmittedByTask()!=null && !shouldDeleteTask(task.getSubmittedByTask())) return false; // e.g. scheduled tasks, sensor events, etc // TODO (in future may keep these for a shorter duration, e.g. to investigate) return true; }
/** returns the first tag found on the given task which matches the given type, looking up the submission hierarachy if necessary */ @SuppressWarnings("unchecked") public static <T> T tag(@Nullable Task<?> task, Class<T> type, boolean recurseHierarchy) { // support null task to make it easier for callers to walk hierarchies if (task==null) return null; for (Object tag: task.getTags()) if (type.isInstance(tag)) return (T)tag; if (!recurseHierarchy) return null; return tag(task.getSubmittedByTask(), type, true); }
public static boolean isAncestorCancelled(Task<?> t) { if (t==null) return false; if (t.isCancelled()) return true; return isAncestorCancelled(t.getSubmittedByTask()); }
task.getStatusSummary(), children, asLink(task.getSubmittedByTask()), task instanceof TaskInternal ? asLink(((TaskInternal<?>)task).getBlockingTask()) : null, task instanceof TaskInternal ? ((TaskInternal<?>)task).getBlockingDetails() : null,