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()
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()
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()
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()