Commit ea149509 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Removed and mark quick fixes that are unecessary or bad.

parent d8d18623
...@@ -413,12 +413,15 @@ class Upload(Chord): ...@@ -413,12 +413,15 @@ class Upload(Chord):
def all_calcs(self, start, end, order_by='mainfile'): def all_calcs(self, start, end, order_by='mainfile'):
return Calc.objects(upload_id=self.upload_id)[start:end].order_by(order_by) return Calc.objects(upload_id=self.upload_id)[start:end].order_by(order_by)
@staticmethod @staticmethod
def repair_all(): def repair_all():
""" """
Utitlity function that will look for suspiciously looking conditions in Utitlity function that will look for suspiciously looking conditions in
all uncompleted downloads. It ain't a perfect world. all uncompleted downloads. It ain't a perfect world.
""" """
# TODO this was added as a quick fix to #37.
# Even though it might be strictly necessary, there should be a tested backup
# solution for it Chords to not work properly due to failed to fail processings
uploads = Upload.objects(status__in=[PENDING, RUNNING]) uploads = Upload.objects(status__in=[PENDING, RUNNING])
for upload in uploads: for upload in uploads:
completed = upload.processed_calcs completed = upload.processed_calcs
......
from nomad.processing.data import Upload
import time
if __name__ == '__main__':
suspicious = {}
while True:
for upload in Upload.objects(status='RUNNING', current_task='parse_all'):
if upload.total_calcs == upload.processed_calcs:
if upload.upload_id in suspicious:
del(suspicious[upload.upload_id])
upload.status = 'SUCCESS'
upload.save()
print('Fixed suspicious %s' % upload.upload_id)
else:
print('Found suspicious %s' % upload.upload_id)
suspicious[upload.upload_id] = upload.upload_id
time.sleep(1)
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