def attr_eq(lhs, lhs_attr, lhs_value, rhs, rhs_attr, checked_value): lhs_name = lhs.name.lower() rhs_name = rhs.name.lower() raise IncompatibleRecordError( "%s = %s in %s is incompatible with %s = %s in %s" % (lhs_attr, lhs_value, lhs_name, rhs_attr, checked_value, rhs_name))
def _merged_profile_compat(lhs, lhs_attr, lhs_value, rhs): if isinstance(rhs, Application): if not (rhs['mpi'] or rhs['shmem']): lhs_name = lhs.name.lower() rhs_name = rhs.name.lower() raise IncompatibleRecordError( "%s = %s in %s requires either mpi = True or shmem = True in %s" % (lhs_attr, lhs_value, lhs_name, rhs_name))
def attr_ne(lhs, lhs_attr, lhs_value, rhs, rhs_attr, checked_value): lhs_name = lhs.name.lower() rhs_name = rhs.name.lower() rhs_value = rhs[rhs_attr] raise IncompatibleRecordError( "%s = %s in %s requires %s = %s in %s but it is %s" % (lhs_attr, lhs_value, lhs_name, rhs_attr, checked_value, rhs_name, rhs_value))
def _ensure_instrumented(lhs, lhs_attr, lhs_value, rhs): if isinstance(rhs, Measurement): if rhs.get('source_inst') == 'never' and rhs.get( 'compiler_inst') == 'never': lhs_name = lhs.name.lower() rhs_name = rhs.name.lower() raise IncompatibleRecordError( "%s = %s in %s requires source_inst and compiler_inst are not both 'never' in %s" % (lhs_attr, lhs_value, lhs_name, rhs_name))
def verify(self): """Checks all components of the experiment for mutual compatibility.""" populated = self.populate() proj = populated['project'] targ = populated['target'] app = populated['application'] meas = populated['measurement'] for model in targ, app, meas: if proj.eid not in model['projects']: raise IncompatibleRecordError("%s '%s' is not a member of project configuration '%s'." % (model.name, model['name'], proj['name'])) for lhs in [targ, app, meas]: for rhs in [targ, app, meas]: lhs.check_compatibility(rhs)
def attr_defined(lhs, lhs_attr, lhs_value, rhs, rhs_attr): lhs_name = lhs.name.lower() rhs_name = rhs.name.lower() raise IncompatibleRecordError( "%s = %s in %s requires %s be undefined in %s" % (lhs_attr, lhs_value, lhs_name, rhs_attr, rhs_name))