Commit b39fbb9d authored by Oleg Borisenko's avatar Oleg Borisenko
Browse files

sync commit, nothing special

parent 539b0e8d
......@@ -31,7 +31,8 @@ def copy_status(request):
total_wgs = request.dbsession.query(func.sum(models.FileToBackup.fsize).cast(BIGINT)).filter(
and_(models.FileToBackup.is_file == True,
models.FileToBackup.kind == models.DataKind.wgs)).scalar()
total_labnums = request.dbsession.query(func.count(distinct(models.FileToBackup.labnum))).scalar()
total_labnums = request.dbsession.query(func.count(distinct(models.FileToBackup.labnum))).\
filter(models.FileToBackup.kind == models.DataKind.wgs).scalar()
copied = request.dbsession.query(func.sum(models.FileToBackup.fsize).cast(BIGINT)).filter(and_(models.FileToBackup.is_file == True,
models.FileToBackup.tape_label != None)).scalar()
copied_files = request.dbsession.query(models.FileToBackup).filter(and_(models.FileToBackup.is_file == True,
......@@ -41,7 +42,8 @@ def copy_status(request):
models.FileToBackup.kind == models.DataKind.wgs,
models.FileToBackup.tape_label != None)).scalar()
copied_labnums = request.dbsession.query(func.count(distinct(models.FileToBackup.labnum))).filter(
models.FileToBackup.tape_label != None).scalar()
models.FileToBackup.tape_label != None).\
filter(models.FileToBackup.kind == models.DataKind.wgs).scalar()
except SQLAlchemyError as e:
return Response(json_body={"error": e._message()}, content_type='application/json', status=500)
......
......@@ -26,8 +26,24 @@ def test_behavior(request):
# log.info("Going to move tape from %d to drive" % tape.last_seen_slot)
# manager.insert_into_drive(tape.last_seen_slot)
# log.info("Moved tape from slot %d to drive" % tape.last_seen_slot)
import os.path
files = request.dbsession.query(models.FileToBackup, models.BackupTarget).\
filter(models.FileToBackup.tape_label == None).filter(models.FileToBackup.is_file == True).\
filter(models.FileToBackup.target_unique_label == models.BackupTarget.unique_label)
missing_list = []
present_count = 0
for i in files:
if os.path.exists(i[1].fullpath + '/' + i[0].relative_path):
present_count += 1
continue
else:
missing_list.append(i[0].id)
print('Present: ', present_count, 'Missing: ', len(missing_list))
shrinked_list = missing_list[:30000]
print("nothing to test here now")
missing_obj = request.dbsession.query(models.FileToBackup).filter(models.FileToBackup.id.in_(shrinked_list))
for i in missing_obj:
request.dbsession.delete(i)
except SQLAlchemyError as e:
return Response(json_body={"error": e._message()}, content_type='application/json', status=500)
......
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