Fixed issues in object dependencies
diff --git a/planetstack/observer/event_loop.py b/planetstack/observer/event_loop.py
index 55f9a98..6dc34da 100644
--- a/planetstack/observer/event_loop.py
+++ b/planetstack/observer/event_loop.py
@@ -218,7 +218,14 @@
sync_step = step(driver=self.driver)
sync_step.__name__ = step.__name__
- #sync_step.dependencies = self.dependencies[sync_step.name]
+ sync_step.dependencies = []
+ try:
+ mlist = sync_step.provides
+
+ for m in mlist:
+ sync_step.dependencies.extend(self.model_dependency_graph[m.__name__])
+ except KeyError:
+ pass
sync_step.debug_mode = debug_mode
should_run = False
@@ -239,6 +246,8 @@
duration=time.time() - start_time
# ********* This is the actual sync step
+ import pdb
+ pdb.set_trace()
failed_objects = sync_step(failed=failed_step_objects)
diff --git a/planetstack/observer/syncstep.py b/planetstack/observer/syncstep.py
index 0772b4c..4116d65 100644
--- a/planetstack/observer/syncstep.py
+++ b/planetstack/observer/syncstep.py
@@ -38,25 +38,27 @@
return
def fetch_pending(self):
- #return Sliver.objects.filter(ip=None)
return []
+ #return Sliver.objects.filter(ip=None)
- def check_dependencies(self, obj):
+ def check_dependencies(self, obj, failed):
for dep in self.dependencies:
peer_object = getattr(obj, dep.lower())
- if (peer_object.pk==dep.pk):
+ if (peer_object.pk==failed.pk):
raise DependencyFailed
def call(self, failed=[]):
pending = self.fetch_pending()
for o in pending:
try:
- self.check_dependencies(o) # Raises exception if failed
+ for f in failed:
+ self.check_dependencies(o,f) # Raises exception if failed
self.sync_record(o)
o.enacted = datetime.now() # Is this the same timezone? XXX
o.save(update_fields=['enacted'])
except:
failed.append(o)
+
return failed
def __call__(self, **args):