CORD-770 ignore parents when computing delete set; catch purge errors
portions selectively picked from master commit 0b2d60945362d7bff9df1eb8f7147fed209e1b6d

Change-Id: I0bb1f3c83c3624a13e151b7079596858d2107899
diff --git a/xos/synchronizers/model_policy.py b/xos/synchronizers/model_policy.py
index ef5f4b0..f7521a9 100644
--- a/xos/synchronizers/model_policy.py
+++ b/xos/synchronizers/model_policy.py
@@ -157,6 +157,9 @@
         for model in models:
             if model==m:
                 continue
+            if issubclass(m.__class__, model.__class__):
+                # collector will return our parent classes; ignore them.
+                continue
             deps.append(model)
     return deps
 
@@ -208,7 +211,12 @@
                 if (not deps):
                     journal_object(d, "reaper.purge")
                     print 'Reaper: purging object %r'%d
-                    d.delete(purge=True)
+                    try:
+                        d.delete(purge=True)
+                    except:
+                        journal_object(d, "reaper.purge.exception")
+                        print 'Reaper: exception purging object %r'%d
+                        traceback.print_exc()
 
         try:
             reset_queries()