diff --git a/tools/dbcheck_files_exist b/tools/dbcheck_files_exist new file mode 100755 index 0000000000..7a0f1cfe8c --- /dev/null +++ b/tools/dbcheck_files_exist @@ -0,0 +1,25 @@ +#!/usr/bin/env python + +import os, re, boinc_path_config +from Boinc import database, db_mid, boinc_db + +def get_file_path(wu): + return re.search('(.*)',wu.xml_doc).group(1) + +database.connect() + +print "Checking for missing input files ...\n" + +for (ss_name,server_state) in [ + ("UNSENT",boinc_db.RESULT_SERVER_STATE_UNSENT), + ("IN_PROGRESS",boinc_db.RESULT_SERVER_STATE_IN_PROGRESS)]: + print "=== %s ===" %ss_name + count_total = 0 + count_errors = 0 + for result in database.Results.iterate(server_state=server_state): + file = get_file_path(result.workunit) + if not os.path.exists(file): + print result, " file %s doesn't exist"%file + count_errors += 1 + count_total += 1 + print "Total: %d/%d errors/results\n" %(count_errors,count_total)