diff --git a/nomad/admin/upload.py b/nomad/admin/upload.py index 49904c7de2e1370bf9c5d7ddbd60df7793af6d7b..637f7166acf00b2dbd5592a7a829f33d83db0951 100644 --- a/nomad/admin/upload.py +++ b/nomad/admin/upload.py @@ -40,9 +40,10 @@ def upload(ctx, user: str, staging: bool, processing: bool, outdated: bool): query &= Q(process_status=proc.PROCESS_RUNNING) | Q(tasks_status=proc.RUNNING) if outdated: - uploads = proc.Calc.objects( - {'metadata.nomad_version__ne': config.version}).distinct(field='upload_id') - query &= Q(uploads__in=uploads) + uploads = proc.Calc._get_collection().distinct( + 'upload_id', + {'metadata.nomad_version': { '$ne': config.version}}) + query &= Q(upload_id__in=uploads) ctx.obj.query = query ctx.obj.uploads = proc.Upload.objects(query) @@ -155,11 +156,8 @@ def re_process(ctx, uploads): logger = utils.get_logger(__name__) print('%d uploads selected, re-processing ...' % uploads.count()) - def re_process_upload(upload_id: str): - logger.info('re-processing started', upload_id=upload_id) - upload = proc.Upload.objects(upload_id=upload_id).first() - if upload is None: - logger.error('upload for re-processing does not exist', upload_id=upload_id) + def re_process_upload(upload: str): + logger.info('re-processing started', upload_id=upload.upload_id) upload.re_process_upload() upload.block_until_complete(interval=.1) @@ -167,8 +165,8 @@ def re_process(ctx, uploads): logger.info('re-processing complete', upload_id=upload_id) count = 0 - for upload_id in uploads: - re_process_upload(upload_id) + for upload in uploads: + re_process_upload(upload) count += 1 print(' re-processed %s of %s uploads' % (count, len(uploads))) diff --git a/ops/deployments/nomad.migration.direct.env.sh b/ops/deployments/nomad.migration.direct.env.sh index 96304f2adfba3d08b29d35a9b44973a4cdb1cc24..da006760e166435856cfaf70b662f62d2b72ea6f 100644 --- a/ops/deployments/nomad.migration.direct.env.sh +++ b/ops/deployments/nomad.migration.direct.env.sh @@ -7,3 +7,4 @@ export NOMAD_FS_LOCAL_TMP=/nomad/fairdi/migration/fs/tmp export NOMAD_FS_STAGING=/nomad/fairdi/migration/fs/staging export NOMAD_FS_PUBLIC=/nomad/fairdi/migration/fs/public export NOMAD_FS_TMP=/nomad/fairdi/migration/fs/tmp +export NOMAD_CELERY_ROUTING=worker