コード例 #1
0
def acgt_gamma(path):
    config = build_config(path)
    config = main.process('extract_json', config, executor=gexec)
    config = main.process('extract', config, executor=gexec)
    config = main.process('acgt_gamma', config, executor=gexec)
    tid_output_directory = config['acgt_gamma_output']
    gexec.result(tid_output_directory, timeout=None)
    files = map(getrelpath, Path(tid_output_directory).listdir())
    trackPaths = map(getrelpath, [
        config.get('InputCDSFileJson'),
        config['ModifiedOrfsFile'], config['NewOrfsFile'], config['HitsFile']])
    return jsonify(trackPaths=trackPaths, files=files)
コード例 #2
0
def default_tracks(path):
    try:
        config = build_config(path)
        config = main.process('extract_json', config, executor=gexec)
        config = main.process('extract', config, executor=gexec)
        config = main.process('acgt_gamma', config, executor=gexec)
        lst = [config.get('InputCDSFileJson'), config.get('ModifiedOrfsFile'),
               config.get('NewOrfsFile'), config.get('HitsFile')]
        return jsonify(filenames=map(getrelpath, lst))
    except Exception as e:
        logger.exception('Error While finding default tracks')
        return flask.make_response(repr(e), 500)
コード例 #3
0
ファイル: run.py プロジェクト: victor-lin/npact
def kickstart(request, path):
    config = build_config(path, request)
    verb = request.GET['verb']
    verb = verb.split(',')

    email = request.GET.get('email')
    client.ensure_daemon()
    executor = client.get_server()
    for v in verb:
        if email:
            config = main.process('allplots', config, executor=executor)
            build_email(request, path, config)
        elif v == 'parse':
            # we've already parsed in `build_config` above.
            pass
        else:
            # main.process handles the rest of the verbs, or errors
            config = main.process(v, config, executor=executor)

    return HttpResponse(
        json.dumps(sanitize_config_for_client(config)),
        content_type="application/json")
コード例 #4
0
def schedule_email(to, path, config):
    config = main.process('allplots', config, executor=gexec)
    try:
        target_file = config.get('allplots_result')
        assert target_file, \
            "Configured for email but didn't get emailable file."
        # The direct download link for the PS or PDF file.
        result_link = url_for('raw',
                              path=getrelpath(target_file), _external=True)
        # build path back to run screen.
        run_link = url_for('run_frame', path=path, _external=True,
                           **dictforurl(config, exclude=['email']))
        task = util.Task(send_email, to, path, config, result_link, run_link)
        eid = gexec.enqueue(task, after=[target_file])
        logger.info("Scheduled email to %r with jobid: %s", to, eid)
    except:
        logger.exception("Error scheduling email to send")
コード例 #5
0
def kickstart(path):
    config = build_config(path)
    verb = request.args['verb']
    verb = verb.split(',')
    email = request.args.get('email')
    for v in verb:
        if email:
            schedule_email(email, path, config)

        elif v == 'parse':
            # we've already parsed in `build_config` above.
            pass
        else:
            # main.process handles the rest of the verbs, or errors
            config = main.process(v, config, executor=gexec)

    return flask.make_response(
        json.dumps(sanitize_config_for_client(config)))
コード例 #6
0
def getpdf(path):
    config = build_config(path)
    config = main.process('allplots', config, executor=gexec)
    pdf = config['allplots_result']
    gexec.result(pdf, timeout=None)
    return send_file(pdf, as_attachment=True)
コード例 #7
0
def test_process(mocker, gbkfile, executor, tmpdir):
    mock = mocker.patch('pynpact.main.resolve_verb')
    assert main.process(
        'extract', gbkfile, executor=executor, outputdir=str(tmpdir))
    assert mock.called