

def record_iteration(self, root, metadata, dummy=False):
    ' Gathers variables for non-parallel case recorders and calls\n        record for all recorders.\n\n        Args\n        ----\n        root : `System`\n           System containing variables.\n\n        metadata : dict\n            Metadata for iteration coordinate\n\n        dummy : bool, optional\n            If True, this is a dummy iteration, so no data will be colllected\n            from the model, but collective gather call will still be made.\n        '
    if (not self._recorders):
        return
    metadata['timestamp'] = time.time()
    params = root.params
    unknowns = root.unknowns
    resids = root.resids
    cases = None
    if MPI:
        if (dummy and (self._casecomm is not None)):
            case = (None, None, None, None)
            if trace:
                debug('DUMMY gathering cases')
            cases = self._casecomm.gather(case, root=0)
            if trace:
                debug('DUMMY done gathering cases:')
            return
        pnames = self._vars_to_record['pnames']
        unames = self._vars_to_record['unames']
        rnames = self._vars_to_record['rnames']
        params = {p: params[p] for p in pnames}
        unknowns = {u: unknowns[u] for u in unames}
        resids = {r: resids[r] for r in rnames}
        if self._has_serial_recorders:
            params = (self._gather_vars(root, params) if self._record_p else {
                
            })
            unknowns = (self._gather_vars(root, unknowns) if self._record_u else {
                
            })
            resids = (self._gather_vars(root, resids) if self._record_r else {
                
            })
            if (self._casecomm is not None):
                case = (params, unknowns, resids, metadata)
                if trace:
                    debug('gathering cases')
                cases = self._casecomm.gather(case, root=0)
                if trace:
                    debug('done gathering cases')
                if (cases is None):
                    cases = []
    if (cases is None):
        cases = [(params, unknowns, resids, metadata)]
    for (params, unknowns, resids, meta) in cases:
        if (params is None):
            continue
        for recorder in self._recorders:
            if (recorder._parallel or (MPI is None) or (self.rank == 0)):
                recorder.record_iteration(params, unknowns, resids, meta)

dataset/ETHPy150Open OpenMDAO/OpenMDAO/openmdao/recorders/recording_manager.py RecordingManager.record_iteration/original