예제 #1
0
 def trace(self):
     if self.available and self.queried_at and self.queried_at > datetime.datetime.now() - datetime.timedelta(0,900):
         if os.path.exists(self.data_path):
             return
     root = tracegraph.root()
     root.trace(self.name, self.qtype)
     with open(self.data_path, 'w') as fd:
         root.dump('yaml', fd)
     self.available = True
     self.queried_at = datetime.datetime.now()
     self.save()
예제 #2
0
 def trace(self):
     if self.available and self.queried_at and self.queried_at > datetime.datetime.now(
     ) - datetime.timedelta(0, 900):
         if os.path.exists(self.data_path):
             return
     root = tracegraph.root()
     root.trace(self.name, self.qtype)
     with open(self.data_path, 'w') as fd:
         root.dump('yaml', fd)
     self.available = True
     self.queried_at = datetime.datetime.now()
     self.save()
예제 #3
0
 def handle(self, *args, **options):
     bs = beanstalkc.Connection(**settings.BEANSTALK_SERVER)
     bs.watch('dns-graph')
     while True:
         job = bs.reserve()
         name, qtype = job.body.split()
         print "Processing %s (%s)" % (name, qtype)
         root = tracegraph.root()
         root.trace(name,qtype)
         dn = DnsName.objects.get(name=name, qtype=qtype)
         with open(dn.data_path, 'w') as fd:
             root.dump('yaml', fd)
         dn.available = True
         dn.queried_at = datetime.datetime.now()
         dn.save()
         job.delete()
예제 #4
0
 def handle(self, *args, **options):
     bs = beanstalkc.Connection(**settings.BEANSTALK_SERVER)
     bs.watch('dns-graph')
     while True:
         job = bs.reserve()
         name, qtype = job.body.split()
         print "Processing %s (%s)" % (name, qtype)
         root = tracegraph.root()
         root.trace(name, qtype)
         dn = DnsName.objects.get(name=name, qtype=qtype)
         with open(dn.data_path, 'w') as fd:
             root.dump('yaml', fd)
         dn.available = True
         dn.queried_at = datetime.datetime.now()
         dn.save()
         job.delete()