Creates an emergency report run, .state included
546985
def backup_simulation(self):
        
        path = self.new_filename(suffix='_emergency.state')
        self.simulation.saveState(path)
        uses_pbc = self.system.usesPeriodicBoundaryConditions()
        state_kw = dict(getPositions=True, getVelocities=True,
                        getForces=True, enforcePeriodicBox=uses_pbc,
                        getParameters=True, getEnergy=True)
        state = self.simulation.context.getState(**state_kw)
        for reporter in self.simulation.reporters:
            if not isinstance(reporter, app.StateDataReporter):
                reporter.report(self.simulation, state)
230217
def _generate_report(ret, setup):
    '''
    
    '''

    retdata = ret.get('return', {})

    sorted_data = sorted(
        retdata.items(),
        key=lambda s: s[1].get('__run_num__', 0)
    )

    total = 0
    failed = 0
    changed = 0
    duration = 0.0

    # gather stats
    for _, data in sorted_data:
        if not data.get('result', True):
            failed += 1
        total += 1

        try:
            duration += float(data.get('duration', 0.0))
        except ValueError:
            pass

        if data.get('changes', {}):
            changed += 1

    unchanged = total - failed - changed

    log.debug('highstate total: %s', total)
    log.debug('highstate failed: %s', failed)
    log.debug('highstate unchanged: %s', unchanged)
    log.debug('highstate changed: %s', changed)

    # generate report if required
    if setup.get('report_everything', False) or \
       (setup.get('report_changes', True) and changed != 0) or \
       (setup.get('report_failures', True) and failed != 0):

        report = [
            {'stats': [
                {'total': total},
                {'failed': failed, '__style__': 'failed'},
                {'unchanged': unchanged, '__style__': 'unchanged'},
                {'changed': changed, '__style__': 'changed'},
                {'duration': duration}
            ]},
            {'job': [
                {'function': ret.get('fun', '')},
                {'arguments': ret.get('fun_args', '')},
                {'jid': ret.get('jid', '')},
                {'success': ret.get('success', True)},
                {'retcode': ret.get('retcode', 0)}
            ]},
            {'states': _generate_states_report(sorted_data)}
        ]

        if failed:
            function = setup.get('failure_function', None)
        else:
            function = setup.get('success_function', None)

        if function:
            func_result = __salt__[function]()
            report.insert(
                0,
                {'extra': [{function: _dict_to_name_value(func_result)}]}
            )

    else:
        report = []

    return report, failed
1229464
function stored(err, state) {
        if (err) { return self.error(err); }
        if (!state) { return self.error(new Error('Unable to generate required state parameter')); }

        params.state = state;
        var location = config.authorizationURL + '?' + querystring.stringify(params);
        self.redirect(location);
      }
1004209
def __create_and_save_state(cls, job_config, mapreduce_spec):
    
    state = model.MapreduceState.create_new(job_config.job_id)
    state.mapreduce_spec = mapreduce_spec
    state.active = True
    state.active_shards = 0
    state.app_id = job_config._app
    config = datastore_rpc.Configuration(force_writes=job_config._force_writes)
    state.put(config=config)
    return state
278122
function () {
    // index page
    this.events.on('report:assertion', this.outputAssertionResult.bind(this));
    this.events.on('report:test:finished', this.outputTestFinished.bind(this));
    this.events.on('report:runner:finished', this.outputRunnerFinished.bind(this));
    this.events.on('report:run:browser', this.outputRunBrowser.bind(this));

    // detail page
    this.events.on('report:test:started', this.startDetailPage.bind(this));
    this.events.on('report:action', this.addActionToDetailPage.bind(this));
    this.events.on('report:assertion', this.addAssertionToDetailPage.bind(this));
    this.events.on('report:test:finished', this.finishDetailPage.bind(this));

    return this;
  }
1043380
def send_agent_report(self, report, context):
        """"""
        try:
            self.state_rpc.report_state(context, report, self.use_call)
            report.pop('start_flag', None)
            self.use_call = False
            LOG.debug("Send agent report successfully completed")
        except AttributeError:
            # This means the server does not support report_state
            LOG.warning("Neutron server does not support state report. "
                        "State report for this agent will be disabled.")
            self.heartbeat.stop()
            return
        except Exception:
            LOG.warning("Failed sending agent report!")
129544
def report(self, request: 'Request'=None, state: Text=None):
        
        self._make_context(request, state)
        self.client.captureException()
        self._clear_context()
1200489
def generate_report(self):
        """"""
        logs_path = self.out_dir / 'logs'

        boilerplate = []
        boiler_idx = 0

        if (logs_path / 'CITATION.html').exists():
            text = (logs_path / 'CITATION.html').read_text(encoding='UTF-8')
            text = '<div class="boiler-html">%s</div>' % re.compile(
                '<body>(.*?)</body>',
                re.DOTALL | re.IGNORECASE).findall(text)[0].strip()
            boilerplate.append((boiler_idx, 'HTML', text))
            boiler_idx += 1

        if (logs_path / 'CITATION.md').exists():
            text = '<pre>%s</pre>\n' % (logs_path / 'CITATION.md').read_text(encoding='UTF-8')
            boilerplate.append((boiler_idx, 'Markdown', text))
            boiler_idx += 1

        if (logs_path / 'CITATION.tex').exists():
            text = (logs_path / 'CITATION.tex').read_text(encoding='UTF-8')
            text = re.compile(
                r'\\begin{document}(.*?)\\end{document}',
                re.DOTALL | re.IGNORECASE).findall(text)[0].strip()
            text = '<pre>%s</pre>\n' % text
            text += '<h3>Bibliography</h3>\n'
            text += '<pre>%s</pre>\n' % Path(
                pkgrf(self.packagename, 'data/boilerplate.bib')).read_text(encoding='UTF-8')
            boilerplate.append((boiler_idx, 'LaTeX', text))
            boiler_idx += 1

        env = jinja2.Environment(
            loader=jinja2.FileSystemLoader(searchpath=str(self.template_path.parent)),
            trim_blocks=True, lstrip_blocks=True
        )
        report_tpl = env.get_template(self.template_path.name)
        report_render = report_tpl.render(sections=self.sections, errors=self.errors,
                                          boilerplate=boilerplate)

        # Write out report
        (self.out_dir / self.out_filename).write_text(report_render, encoding='UTF-8')
        return len(self.errors)
207206
function createReport(coverage, opts) {
  const collector = new istanbul.Collector();
  const reporter = new istanbul.Reporter(null, opts.coverage);
  const sync = true;

  sh.echo('Creating reports...');

  collector.add(coverage);
  reporter.addAll(opts.reports);
  reporter.write(collector, sync, () => sh.echo('Reports created.'));
}
1363101
def run(self):
        """"""
        document = self.state.document
        env = document.settings.env
        buildpath = env.app.outdir
        link = self.arguments[0]

        try:
            r = requests.get(link)
            r.raise_for_status()
            downloadpath = os.path.join(buildpath, '_downloads')
            if not os.path.isdir(downloadpath):
                os.makedirs(downloadpath)
            rstfile = os.path.join(downloadpath, os.path.basename(link))
            with open(rstfile, 'w') as f:
                f.write(r.text)
            rstfile = os.path.relpath(rstfile, os.path.dirname(env.doc2path
                                                               (env.docname)))
            self.arguments = [rstfile]
            return super(RemoteInclude, self).run()
        except Exception:
            err = 'Unable to resolve ' + link
            return [document.reporter.warning(str(err), line=self.lineno)]
339963
private void createReport() {
        CampaignReportManager.getInstance().startReport(campaignStartTimeStamp, currentCampaign.getName());
        for (CampaignRun run : currentCampaign.getRuns()) {
            CampaignResult result = new CampaignResult(run.getTestbed());
            result.setStatus(Status.NOT_EXECUTED);
            CampaignReportManager.getInstance().putEntry(result);
        }

        CampaignReportManager.getInstance().refresh();
    }
125917
function createStacks (state) {
  const serviceErrors = state.config.service.errors || {}
  _.each(state.resources, function (resource) {
    const resourceErrors = resource.errors
    _.each(resource.actions, function (action, actionName) {
      action.name = actionName
      const actionErrors = action.errors
      var transform
      const key = [ resource.name, action.name ].join('!')

      if (state.config.middlewareStack) {
        const middleware = getStack(state, state.config.middlewareStack, resource, action)
        state.handlers[ middleware.name ] = middleware
      }
      if (state.config.transformStack) {
        transform = getStack(state, state.config.transformStack, resource, action)
      } else {
        transform = state.snap.stack(key)
      }
      transform.append(unit)
      state.transforms[ transform.name ] = transform
      const errors = Object.assign({}, serviceErrors, resourceErrors, actionErrors)
      state.errors[ key ] = handleError.bind(null, state, errors)
    })
  })
}
1141502
function reporter(offenses, msg) {
        var files,
            summary,
            writeErr;

        if (('string' === typeof offenses) || offenses instanceof Error) {
            cb(offenses);
            return;
        }

        function perFile(pathname) {
            count = 0;
            lines.push(pathname);
            offenses[pathname].forEach(perOffense);
            lines.push(''); // blank line
        }

        if (offenses) {
            // accumulate report in lines array
            files = Object.keys(offenses);
            files.forEach(perFile);
            summary = getSummary(total, files.length);

            if (env.opts.print) {
                lines.unshift('JSLint Report', '');
                print(lines.join(EOL));

            } else {
                writeErr = writeHtmlFile(dir, getHtml(lines, summary));
            }

            // has errors
            cb(writeErr || summary);

        } else {
            // is lint free
            cb(null, msg);
        }
    }
820067
function prepare(reportData, opts) {
  // Stringify the data if needed
  let data = reportData;
  if (typeof data === 'object') {
    data = JSON.stringify(reportData);
  }

  // Get the options
  const reportOptions = getOptions(opts);

  // Stop here if we're not generating an HTML report
  if (!reportOptions.saveHtml) {
    return { reportOptions };
  }

  // Get the assets
  const assets = getAssets(reportOptions);

  // Render basic template to string
  // const { styles, scripts } = assets;

  const renderedHtml = render(React.createElement(MainHTML, {
    data,
    options: reportOptions,
    title: reportOptions.reportPageTitle,
    useInlineAssets: reportOptions.inlineAssets && !reportOptions.cdn,
    ...assets
  }));

  const html = `<!doctype html>\n${renderedHtml}`;
  return { html, reportOptions };
}
562732
function runReports(err) {
    if (err) { console.log(chalk.red('Error running reports: %s'), err); }

    var excludes = filesets.platoExcludes();

    if (excludes) {
        platoOptions.exclude = excludes;
    }

    jsHintOptions.ignore = filesets.jshintExcludes();
    jsHintOptions.reporter = reporter.reporter;

    console.log(chalk.blue('Building plato reports...'));
    console.log(chalk.gray('(Ignore any output about being unable to parse ' +
        'JSON files)'));

    plato.inspect(filesets.platoIncludes(), outputDir, platoOptions,
        function() {
            console.log(chalk.blue('\nPlato reports have been built to: ') +
                chalk.magenta(outputDir));
            console.log(chalk.blue('\nJSHint Report\n=============\n'));
            buildJSHint(filesets.jshintIncludes(), jsHintOptions,
                reporter.callback);
        }
    );
}
417440
def _get_or_create_run(build):
    """"""
    release_name, release_number = _get_release_params()
    run_name = request.form.get('run_name', type=str)
    utils.jsonify_assert(run_name, 'run_name required')

    release = (
        models.Release.query
        .filter_by(build_id=build.id, name=release_name, number=release_number)
        .first())
    utils.jsonify_assert(release, 'release does not exist')

    run = (
        models.Run.query
        .filter_by(release_id=release.id, name=run_name)
        .first())
    if not run:
        # Ignore re-reports of the same run name for this release.
        logging.info('Created run: build_id=%r, release_name=%r, '
                     'release_number=%d, run_name=%r',
                     build.id, release.name, release.number, run_name)
        run = models.Run(
            release_id=release.id,
            name=run_name,
            status=models.Run.DATA_PENDING)
        db.session.add(run)
        db.session.flush()

    return release, run
693585
def run(self):
        
        unread = 0
        current_unread = 0
        for id, backend in enumerate(self.backends):
            temp = backend.unread or 0
            unread = unread + temp
            if id == self.current_backend:
                current_unread = temp

        if not unread:
            color = self.color
            urgent = "false"
            if self.hide_if_null:
                self.output = None
                return
        else:
            color = self.color_unread
            urgent = "true"

        format = self.format
        if unread > 1:
            format = self.format_plural

        account_name = getattr(self.backends[self.current_backend], "account", "No name")

        self.output = {
            "full_text": format.format(unread=unread, current_unread=current_unread, account=account_name),
            "urgent": urgent,
            "color": color,
        }