Commit 0bd45bac authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Minor improvements.

parent acdbca15
......@@ -3,11 +3,14 @@ import json
from nomad import infrastructure
from nomad import processing
infrastructure.setup_logging()
calcs = infrastructure.setup_mongo().fairdi_nomad_migration.calc
uploads = infrastructure.setup_mongo().fairdi_nomad_migration.upload
packages = infrastructure.setup_mongo().coe_migration.package
def retrieve_remote_data():
infrastructure.setup_logging()
calcs = infrastructure.setup_mongo().fairdi_nomad_migration.calc
def retrieve_remote_data():
count = 0
pid_dict = {}
......@@ -52,6 +55,7 @@ def remove_upload(upload):
def calc_dups():
upload_dict = {}
for _, uploads in pid_dict.items():
uploads = list(set(uploads))
for upload in uploads:
dup, single = upload_dict.get(upload, (0, 0))
if len(uploads) >= 2:
......@@ -67,7 +71,7 @@ more = False
while True:
upload_dict = calc_dups()
for upload, (dup, single) in upload_dict.items():
if singe == 0:
if single == 0:
print('full: ' + upload)
remove_upload(upload)
more = True
......@@ -75,5 +79,8 @@ while True:
if not more:
for upload, (dup, single) in upload_dict.items():
print('partial: %s (%d vs %d)' % (upload, dup, single))
if dup > 0:
package_id = uploads.find_one({'_id': upload})['name']
source_upload_id = packages.find_one({'_id': package_id})['upload_id']
print('%s, %s, %s (%d vs %d)' % (source_upload_id, package_id, upload, dup, single))
break
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment