def _check_fields(self): ''' Add extra checks to those made in every record. ''' # First, call the parent's version. Record._check_fields(self) # Extract the relevant information from the user fqan. # Keep the fqan itself as other methods in the class use it. role, group, vo = parse_fqan(self._record_content['FQAN']) # We can't / don't put NULL in the database, so we use 'None' if role is None: role = 'None' if group is None: group = 'None' if vo is None: vo = 'None' if self._record_content['Benchmark'] is None: # If Benchmark is not present in the original record the # parent Record class level type checking will set it to # None. We can't pass None as a Benchmark as the field is # NOT NULL in the database, so we set it to something # meaningful. In this case the float 0.0. self._record_content['Benchmark'] = 0.0 self._record_content['VORole'] = role self._record_content['VOGroup'] = group self._record_content['VO'] = vo # If the message was missing a CpuCount, assume it used # zero Cpus, to prevent a NULL being written into the column # in the CloudRecords tables. # Doing so would be a problem despite the CloudRecords # table allowing it because the CloudSummaries table # doesn't allow it, creating a problem at summariser time. if self._record_content['CpuCount'] is None: self._record_content['CpuCount'] = 0
def _check_fields(self): Record._check_fields(self)