Save graph in crawl converter
This commit is contained in:
parent
53c70e8042
commit
7208502bfb
10
bin/conv.py
10
bin/conv.py
|
@ -7,7 +7,7 @@ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dnmapper.settings")
|
||||||
import django
|
import django
|
||||||
django.setup()
|
django.setup()
|
||||||
|
|
||||||
from backend.crawler import convert_crawl
|
from backend.crawler import convert_crawl, net_to_json
|
||||||
from bgpdata.models import CrawlRun
|
from bgpdata.models import CrawlRun
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,7 +21,13 @@ def main():
|
||||||
except CrawlRun.DoesNotExist:
|
except CrawlRun.DoesNotExist:
|
||||||
parser.error("CrawlRun with id {} does not exist".format(args.crawl_id))
|
parser.error("CrawlRun with id {} does not exist".format(args.crawl_id))
|
||||||
|
|
||||||
convert_crawl(crawl)
|
net = convert_crawl(crawl)
|
||||||
|
if net.nodes and net.edges:
|
||||||
|
crawl.graph = net_to_json(net)
|
||||||
|
crawl.save()
|
||||||
|
print("Crawl updated")
|
||||||
|
else:
|
||||||
|
print("Crawl had no nodes or edges, abort")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in New Issue