Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch missing information from dsmc (tape uploader) #138

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 64 additions & 3 deletions cax/tasks/data_mover.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,37 @@ def copy_tsm(self, datum, destination, method, option_type):
logging.info("Copy & rename: [succcessful] -> Checksums agree")

tsm_upload_result = self.tsm.upload(raw_data_tsm + raw_data_filename)

#Evaluate the upload dictionary with the keys which are
#put into the log file:
tsm_upload_result_evaluation = True
tsm_upload_keys = ['tno_backedup', 'tno_inspected', 'tno_failed', 'tno_bytes_transferred', 'tno_bytes_inspected', 'tno_data_transfer_time', 'tno_network_transfer_rate']
for i_key in tsm_upload_keys:
value = tsm_upload_result[ i_key ]
if value == -1:
tsm_upload_result_evaluation = False
if tsm_upload_result_evaluation == False:
#exit the upload procedure and mark the upload
#with error in the runDB:
if config.DATABASE_LOG:
self.collection.update({'_id': self.run_doc['_id'],
'data': {
'$elemMatch': datum_new
}
}, {'$set':{'data.$.status': "error",
'data.$.location': "n/a",
'data.$.checksum': "n/a",
}
})
logging.info("The TSM upload information is not correct:")
for i_key in tsm_upload_keys:
value = tsm_upload_result[ i_key ]
logging.info("Key: {k} contains {info}".format(k=i_key, info=value))
logging.info("--> Stop upload here!")
return 0
else:
logging.info("TSM upload information is correct")

logging.info("Number of uploaded files: %s",
tsm_upload_result["tno_backedup"])
logging.info("Number of inspected files: %s",
Expand All @@ -775,16 +806,46 @@ def copy_tsm(self, datum, destination, method, option_type):
logging.info("Start the re-download to %s", test_download)
tsm_download_result = self.tsm.download(
raw_data_tsm + raw_data_filename, test_download, raw_data_filename)
logging.info("Finished the re-download")

#Evaluate the download dictionary with the keys which are
#put into the log file:
tsm_download_result_evaluation = True
tsm_download_keys = ['tno_restored_objects', 'tno_restored_bytes', 'tno_network_transfer_rate', 'tno_data_transfer_time', 'tno_failed_objects']
for i_key in tsm_download_keys:
value = tsm_download_result[ i_key ]
if value == -1:
tsm_download_result_evaluation = False
if tsm_download_result_evaluation == False:
#exit the upload procedure and mark the upload
#with error in the runDB:
if config.DATABASE_LOG:
self.collection.update({'_id': self.run_doc['_id'],
'data': {
'$elemMatch': datum_new
}
}, {'$set':{'data.$.status': "error",
'data.$.location': "n/a",
'data.$.checksum': "n/a",
}
})
logging.info("The TSM download information is not correct:")
for i_key in tsm_download_keys:
value = tsm_download_result[ i_key ]
logging.info("Key: {k} contains {info}".format(k=i_key, info=value))
logging.info("--> Stop tape backup here!")
return 0
else:
logging.info("Finished the re-download")


if os.path.exists(test_download + "/" + raw_data_filename) == False:
logging.info("Download to %s failed. Checksum will not match",
test_download + "/" + raw_data_filename)
else:
logging.info("Download to %s succcessful. Folder exists",
test_download + "/" + raw_data_filename)

checksum_after = self.tsm.get_checksum_folder(
test_download + "/" + raw_data_filename)
checksum_after = self.tsm.get_checksum_folder(test_download + "/" + raw_data_filename)
logging.info("Summary of the download for checksum comparison:")
logging.info("Number of downloaded files: %s",
tsm_download_result["tno_restored_objects"])
Expand Down
1 change: 1 addition & 0 deletions cax/tasks/tsm_mover.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ def upload(self, raw_data_location):

tno_dict = {
"tno_inspected": -1,
"tno_backedup": -1,
"tno_updated": -1,
"tno_rebound": -1,
"tno_deleted": -1,
Expand Down