Save graph in crawl converter

new-map
Sebastian Lohff 4 years ago
parent 53c70e8042
commit 7208502bfb

@ -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():
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__':

Loading…
Cancel
Save