- sync_step()
-
- # Enforce 5 minutes between wakeups
- tSleep = 300 - (time.time() - tBeforeWait)
- if tSleep > 0:
- logger.info('Sleeping for %d seconds' % tSleep)
- time.sleep(tSleep)
-
- logger.info('Observer woke up')
- except:
- logger.log_exc("Exception in observer run loop")
- traceback.print_exc()
+ sync_step.dependencies = self.dependencies[sync_step.name]
+ sync_step.debug_mode = debug_mode
+
+ should_run = False
+ try:
+ # Various checks that decide whether
+ # this step runs or not
+ self.check_class_dependency(sync_step, failed_steps) # dont run Slices if Sites failed
+ self.check_schedule(sync_step) # dont run sync_network_routes if time since last run < 1 hour
+ should_run = True
+ except StepNotReady:
+ logging.info('Step not ready: %s'%sync_step.name)
+ failed_steps.add(sync_step)
+ except:
+ failed_steps.add(sync_step)
+
+ if (should_run):
+ try:
+ duration=time.time() - start_time
+
+ # ********* This is the actual sync step
+ failed_objects = sync_step(failed=failed_step_objects)
+
+
+ check_deadline(sync_step, duration)
+ failed_step_objects.extend(failed_objects)
+ self.update_run_time(sync_step)
+ except:
+ failed_steps.add(S)
+ except:
+ logger.log_exc("Exception in observer run loop")
+ traceback.print_exc()