Public Member Functions | |
def | __init__ (self, metadata_source=None, debug=False, verbose=False, testing=False, server="https://cms-conddb-dev.cern.ch/cmsDbCondUpload/", **kwargs) |
def | check_response_for_error_key (self, response_dict, exit_if_error=True) |
def | close_upload_session (self, upload_session_id) |
def | exit_upload (self, message=None) |
def | filter_iovs_by_fcsr (self, upload_session_id) |
def | get_all_hashes (self) |
def | get_fcsr_from_server (self, upload_session_id) |
def | get_hashes_to_send (self, upload_session_id) |
def | get_tag_dictionary (self) |
def | get_upload_session_id (self) |
def | send_blob (self, payload, upload_session_id) |
def | send_metadata (self, upload_session_id) |
def | send_payloads (self, hashes, upload_session_id) |
def | upload (self) |
def | write_server_side_log (self, log_data) |
Public Attributes | |
data_to_send | |
hashes_with_no_local_payload | |
input_tag | |
metadata_source | |
server_side_log_file | |
sqlite_file_name | |
upload_log_file_name | |
upload_session_id | |
Private Attributes | |
_debug | |
_handle | |
_log_data | |
_outputter | |
_SERVICE_URL | |
_testing | |
_verbose | |
Upload session controller - creates, tracks, and deletes upload sessions on the server.
Definition at line 98 of file uploads.py.
def uploads.uploader.__init__ | ( | self, | |
metadata_source = None , |
|||
debug = False , |
|||
verbose = False , |
|||
testing = False , |
|||
server = "https://cms-conddb-dev.cern.ch/cmsDbCondUpload/" , |
|||
** | kwargs | ||
) |
Upload constructor: Given an SQLite file and a Metadata sources, reads into a dictionary read for it to be encoded and uploaded. Note: kwargs is used to capture stray arguments - arguments that do not match keywords will not be used. Note: default value of service_url should be changed for production.
Definition at line 103 of file uploads.py.
def uploads.uploader.check_response_for_error_key | ( | self, | |
response_dict, | |||
exit_if_error = True |
|||
) |
Checks the decoded response of an HTTP request to the server. If it is a dictionary, and one of its keys is "error", the server returned an error
Definition at line 254 of file uploads.py.
References EcalMatacqAnalyzer._debug, EcalABAnalyzer._debug, uploads.output._debug, EcalLaserAnalyzer2._debug, EcalLaserAnalyzer._debug, uploads.uploader._debug, uploads.uploader._log_data, uploads.uploader._outputter, uploads.uploader._testing, beamvalidation.exit(), writeEcalDQMStatus.write, and uploads.uploader.write_server_side_log().
Referenced by uploads.uploader.exit_upload(), uploads.uploader.send_payloads(), and uploads.uploader.upload().
def uploads.uploader.close_upload_session | ( | self, | |
upload_session_id | |||
) |
Close an upload session on the server by calling its close_upload_session end-point. This is done if there is an error on the client-side.
Definition at line 541 of file uploads.py.
References uploads.uploader._outputter, uploads.uploader._SERVICE_URL, errors.check_response(), uploads.uploader.data_to_send, and writeEcalDQMStatus.write.
Referenced by uploads.uploader.exit_upload().
def uploads.uploader.exit_upload | ( | self, | |
message = None |
|||
) |
Used to exit the script - which only happens if an error has occurred. If the --testing flag was passed by the user, we should return False for failure, and not exit
Definition at line 330 of file uploads.py.
References uploads.uploader._handle, uploads.uploader._log_data, uploads.uploader._testing, uploads.uploader.check_response_for_error_key(), uploads.uploader.close_upload_session(), beamvalidation.exit(), print(), uploads.uploader.upload_session_id, and uploads.uploader.write_server_side_log().
Referenced by uploads.uploader.filter_iovs_by_fcsr().
def uploads.uploader.filter_iovs_by_fcsr | ( | self, | |
upload_session_id | |||
) |
Ask for the server for the FCSR based on the synchronization type of the source Tag. Then, modify the IOVs (possibly remove some) based on the FCSR we received. This is useful in the case that most IOVs have different payloads, and our FCSR is close to the end of the range the IOVs cover.
Definition at line 570 of file uploads.py.
References uploads.uploader._outputter, uploads.uploader.data_to_send, uploads.uploader.exit_upload(), uploads.friendly_since(), uploads.uploader.get_fcsr_from_server(), createfilelist.int, conddb_time.to_timestamp(), and writeEcalDQMStatus.write.
def uploads.uploader.get_all_hashes | ( | self | ) |
Get all the hashes from the dictionary of IOVs we have from the SQLite file.
Definition at line 633 of file uploads.py.
References uploads.uploader._outputter, errors.check_response(), uploads.uploader.data_to_send, genParticles_cff.map, and writeEcalDQMStatus.write.
Referenced by uploads.uploader.get_hashes_to_send().
def uploads.uploader.get_fcsr_from_server | ( | self, | |
upload_session_id | |||
) |
Execute the HTTPs request to ask the server for the FCSR. Note: we do this in a separate function we so we can do the decoding check for json data with check_response.
Definition at line 553 of file uploads.py.
References uploads.uploader._SERVICE_URL, uploads.uploader.data_to_send, and relativeConstraints.keys.
Referenced by uploads.uploader.filter_iovs_by_fcsr().
def uploads.uploader.get_hashes_to_send | ( | self, | |
upload_session_id | |||
) |
Get the hashes of the payloads we want to send that the server doesn't have yet.
Definition at line 643 of file uploads.py.
References uploads.uploader._outputter, uploads.uploader._SERVICE_URL, uploads.uploader.data_to_send, uploads.uploader.get_all_hashes(), and writeEcalDQMStatus.write.
def uploads.uploader.get_tag_dictionary | ( | self | ) |
Definition at line 248 of file uploads.py.
References uploads.uploader._SERVICE_URL, and uploads.uploader.metadata_source.
def uploads.uploader.get_upload_session_id | ( | self | ) |
Open an upload session on the server, and get a unique token back that we can use to authenticate for all future requests, as long as the upload session is still open.
Definition at line 515 of file uploads.py.
References uploads.uploader._outputter, uploads.uploader._SERVICE_URL, errors.check_response(), uploads.uploader.data_to_send, relativeConstraints.keys, and writeEcalDQMStatus.write.
Referenced by uploads.uploader.upload().
def uploads.uploader.send_blob | ( | self, | |
payload, | |||
upload_session_id | |||
) |
Send the BLOB of a payload over HTTP. The BLOB is put in the request body, so no additional processing has to be done on the server side, apart from decoding from base64.
Definition at line 705 of file uploads.py.
References uploads.uploader._outputter, uploads.uploader._SERVICE_URL, errors.check_response(), uploads.uploader.data_to_send, str, conddb_time.to_timestamp(), and writeEcalDQMStatus.write.
Referenced by uploads.uploader.send_payloads().
def uploads.uploader.send_metadata | ( | self, | |
upload_session_id | |||
) |
Final part of the upload process - send the Conditions metadata (Tag, IOVs - not upload metadata). The server closes the session (and releases the tag lock) after processing has been completed.
Definition at line 739 of file uploads.py.
References uploads.uploader._outputter, uploads.uploader._SERVICE_URL, uploads.uploader.data_to_send, relativeConstraints.keys, data_sources.json_data_node.make(), uploadConditions.parse_arguments(), print(), uploads.uploader.upload_session_id, and writeEcalDQMStatus.write.
def uploads.uploader.send_payloads | ( | self, | |
hashes, | |||
upload_session_id | |||
) |
Send a list of payloads corresponding to hashes we got from the SQLite file and filtered by asking the server.
Definition at line 654 of file uploads.py.
References uploads.uploader._outputter, errors.check_response(), uploads.uploader.check_response_for_error_key(), querying.connect(), data_sources.json_data_node.make(), uploads.uploader.send_blob(), uploads.uploader.sqlite_file_name, and writeEcalDQMStatus.write.
def uploads.uploader.upload | ( | self | ) |
Calls methods that send HTTP requests to the upload server.
Open an upload session on the server - this also gives us a tag lock on the tag being uploaded, if it is available.
Definition at line 352 of file uploads.py.
References uploads.uploader._outputter, uploads.uploader._testing, uploads.uploader.check_response_for_error_key(), uploads.uploader.get_upload_session_id(), uploads.uploader.upload_session_id, and writeEcalDQMStatus.write.
def uploads.uploader.write_server_side_log | ( | self, | |
log_data | |||
) |
Given the log data from the server, write it to a client-side log file.
Definition at line 290 of file uploads.py.
References uploads.uploader._SERVICE_URL, print(), str, uploads.uploader.upload_log_file_name, and uploads.uploader.upload_session_id.
Referenced by uploads.uploader.check_response_for_error_key(), and uploads.uploader.exit_upload().
|
private |
Definition at line 113 of file uploads.py.
Referenced by FrontierCondition_GT_autoExpress_cfi.Tier0Handler._queryTier0DataSvc(), tier0.Tier0Handler._queryTier0DataSvc(), uploads.uploader.check_response_for_error_key(), FrontierCondition_GT_autoExpress_cfi.Tier0Handler.setDebug(), tier0.Tier0Handler.setDebug(), FrontierCondition_GT_autoExpress_cfi.Tier0Handler.unsetDebug(), and tier0.Tier0Handler.unsetDebug().
|
private |
Definition at line 123 of file uploads.py.
Referenced by uploads.uploader.exit_upload().
|
private |
Definition at line 117 of file uploads.py.
Referenced by uploads.uploader.check_response_for_error_key(), and uploads.uploader.exit_upload().
|
private |
Definition at line 126 of file uploads.py.
Referenced by uploads.uploader.check_response_for_error_key(), uploads.uploader.close_upload_session(), uploads.uploader.filter_iovs_by_fcsr(), uploads.uploader.get_all_hashes(), uploads.uploader.get_hashes_to_send(), uploads.uploader.get_upload_session_id(), uploads.uploader.send_blob(), uploads.uploader.send_metadata(), uploads.uploader.send_payloads(), and uploads.uploader.upload().
|
private |
Definition at line 118 of file uploads.py.
Referenced by uploads.uploader.close_upload_session(), uploads.uploader.get_fcsr_from_server(), uploads.uploader.get_hashes_to_send(), uploads.uploader.get_tag_dictionary(), uploads.uploader.get_upload_session_id(), uploads.uploader.send_blob(), uploads.uploader.send_metadata(), and uploads.uploader.write_server_side_log().
|
private |
Definition at line 115 of file uploads.py.
Referenced by uploads.uploader.check_response_for_error_key(), uploads.uploader.exit_upload(), and uploads.uploader.upload().
|
private |
Definition at line 114 of file uploads.py.
Referenced by MassReplace.MassSearchReplaceAnyInputTagVisitor.doIt(), MassReplace.MassSearchReplaceParamVisitor.doIt(), and ConfigBuilder.ConfigBuilder.MassSearchReplaceProcessNameVisitor.doIt().
uploads.uploader.data_to_send |
Definition at line 238 of file uploads.py.
Referenced by uploads.uploader.close_upload_session(), uploads.uploader.filter_iovs_by_fcsr(), uploads.uploader.get_all_hashes(), uploads.uploader.get_fcsr_from_server(), uploads.uploader.get_hashes_to_send(), uploads.uploader.get_upload_session_id(), uploads.uploader.send_blob(), and uploads.uploader.send_metadata().
uploads.uploader.hashes_with_no_local_payload |
Definition at line 199 of file uploads.py.
uploads.uploader.input_tag |
Definition at line 163 of file uploads.py.
uploads.uploader.metadata_source |
Definition at line 135 of file uploads.py.
Referenced by uploads.uploader.get_tag_dictionary().
uploads.uploader.server_side_log_file |
Definition at line 372 of file uploads.py.
uploads.uploader.sqlite_file_name |
Definition at line 169 of file uploads.py.
Referenced by uploads.uploader.send_payloads().
uploads.uploader.upload_log_file_name |
Definition at line 122 of file uploads.py.
Referenced by uploads.uploader.write_server_side_log().
uploads.uploader.upload_session_id |
Definition at line 119 of file uploads.py.
Referenced by uploads.uploader.exit_upload(), uploads.uploader.send_metadata(), uploads.uploader.upload(), and uploads.uploader.write_server_side_log().