associate crawled hosts with crawlrun entry
This commit is contained in:
parent
96f11dcd26
commit
0ce6a266ae
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('bgpdata', '0011_auto_20150327_1636'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='crawlrun',
|
||||
name='hostsCrawled',
|
||||
field=models.ManyToManyField(to='bgpdata.ConfigHost', null=True, blank=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
]
|
|
@ -23,6 +23,8 @@ class CrawlRun(models.Model):
|
|||
startTime = models.DateTimeField()
|
||||
endTime = models.DateTimeField(null=True, blank=True)
|
||||
|
||||
hostsCrawled = models.ManyToManyField(ConfigHost, null=True, blank=True)
|
||||
|
||||
def __unicode__(self):
|
||||
return u"Run %d - %s to %s" % (self.pk, self.startTime, self.endTime if self.endTime else "?")
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ def main():
|
|||
|
||||
# 2. get data from all hosts, put it in the database
|
||||
for host in ConfigHost.objects.all():
|
||||
crawl.hostsCrawled.add(host)
|
||||
data = None
|
||||
print(" -- Getting data for host %s" % host)
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue