Path: blob/main/scripts/lfunctions/populate_origin_ECQ.py
1128 views
1import sys, os2sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)),"../.."))3from lmfdb.db_backend import db456def upsert_origin(id_row):7Lhash = db.lfunc_lfunctions.lucky({'id':id_row}, projection = 'Lhash')8url = list(db.lfunc_instances.search({'Lhash': Lhash, 'type' : 'ECQ'}, projection = 'url'))9assert len(url) == 110url = url[0]11assert 'EllipticCurve/Q/' in url, "%s" % url12print(url, Lhash)13db.lfunc_lfunctions.upsert({'id': id_row}, {'origin': url})1415import sys16if len(sys.argv) == 3:17mod = int(sys.argv[1])18c = int(sys.argv[2])19for i in db.lfunc_lfunctions.search({'load_key':'Cremona', 'origin':None}, projection='id'):20if (i % mod) == c:21upsert_origin(i)22else:23print(r"""Usage:24You should run this on legendre as: (this will use 40 cores):25# parallel -u -j 40 --halt 2 --progress sage -python %s 40 ::: {0..39}""" % sys.argv[0])26272829