Exemplo n.º 1
0
def build_config(path, request):
    "Tries to build the config dictionary for the given path"
    try:
        config = parsing.initial(getabspath(path))
    except:
        logger.exception(
            "Error parsing gbk: %r", getabspath(path, raise_on_missing=False))
        raise

    parsing.detect_format(config)
    for k in VALID_KEYS:
        v = request.GET.get(k)
        if v:
            nv = parsing.number(v)
            config[k] = v if nv is None else nv
    parsing.endBase(config)

    # fixup nucleotides list
    if 'nucleotides' in request.GET:
        logger.info("nucleotides: %r", request.GET.getlist('nucleotides'))
        config['nucleotides'] = request.GET.getlist('nucleotides')

    for key in MAGIC_PARAMS:
        if key in request.GET:
            config[key] = request.GET[key]

    return config
Exemplo n.º 2
0
def run_status(request, jobid):
    "This checks on the status of jobid"
    result = {'tid': jobid}
    status = 200
    try:
        abspath = getabspath(jobid, raise_on_missing=False)
        # Task IDs == filenames on disk, if the file exists don't even
        # bother to check with the server
        if os.path.exists(abspath):
            result['ready'] = True
        elif client.ready(abspath):
            result['ready'] = True
            # Ensure the task finished correctly
            client.result(abspath)
        else:
            result['ready'] = False

    except NoSuchTaskError:
        result['message'] = 'Unknown task identifier.'
        status = 404
    except Exception as e:
        result['message'] = 'Fatal error.'
        result['exception'] = str(e)
        status = 500
        logger.exception("Error getting job status. %r", jobid)

    return HttpResponse(json.dumps(result),
                        status=status, content_type="application/json")
Exemplo n.º 3
0
def acgt_gamma_file_list(request, acgt_gamma_output):
    acgt_gamma_output = getabspath(acgt_gamma_output)
    files = map(getrelpath, acgt_gamma_output.listdir())
    return HttpResponse(json.dumps(files),
                        status=200, content_type="application/json")