Bladeren bron

Save graph in crawl converter

new-map
Sebastian Lohff 2 jaren geleden
bovenliggende
commit
7208502bfb
  1. 10
      bin/conv.py

10
bin/conv.py

@ -7,7 +7,7 @@ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dnmapper.settings") @@ -7,7 +7,7 @@ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dnmapper.settings")
import django
django.setup()
from backend.crawler import convert_crawl
from backend.crawler import convert_crawl, net_to_json
from bgpdata.models import CrawlRun
@ -21,7 +21,13 @@ def main(): @@ -21,7 +21,13 @@ def main():
except CrawlRun.DoesNotExist:
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__':

Laden…
Annuleren
Opslaan