Пример #1
0
def get_compile_msgs (request):
    log = request.REQUEST ['log']
    logger.debug ("getting compilation messages: log=%s", log)
    process_username = ViewUtil.get_os_username ()
    text = GraysonUtil.readFileAsString (log)
    text = unicode (text.replace ('\n', '<br/>')) if text else 'An unknown error occurred compiling the model.'
    return ViewUtil.get_text_response (text)
Пример #2
0
def get_flow_file (request):
    username = ''
    if 'addUser' in request.REQUEST:
        user = ViewUtil.get_user (request)
        username = user.username

    path = os.path.join (settings.GRAYSONWEB_WORKFLOW_ROOT, username, request.REQUEST ['path'])    
    text = GraysonUtil.readFileAsString (path) if os.path.exists (path) else ''
    print ("path: %s", path)
    return ViewUtil.get_text_response (text)
Пример #3
0
def get_job_output (request):
    user = ViewUtil.get_user (request)
    workdir = request.REQUEST ['workdir']
    workflow_id = request.REQUEST ['workflowid']
    job_id = request.REQUEST ['jobid']
    run_id = request.REQUEST ['runid']
    if not run_id:
        run_id = ""
    if not workflow_id:
        workflow_id = ""
    logger.debug ("getting job output: workdir=%s, workflowid: %s, runid: %s, jobid: %s", workdir, workflow_id, run_id, job_id)
    process_username = ViewUtil.get_os_username ()
    workdirPath = GraysonUtil.form_workdir_path (workdir, process_username, workflow_id, run_id)

    workdirPath = ViewUtil.form_workflow_path (user, workdirPath)

    logger.debug ("workdirPath: %s", workdirPath)

    text = ""

    if job_id.startswith ('/'):
        job_id = job_id [1:]
    concrete = os.path.join (workdirPath, job_id)
    logger.debug ('concrete: --- %s', concrete)
    if os.path.exists (concrete):
        logger.debug ("concrete --- : %s", concrete)
        text = GraysonUtil.readFile (concrete)
    else:
        logger.debug ("regex: --- : %s", concrete)
        workflow = GridWorkflow (workdirPath)
        outputs = workflow.getOutputFiles (subworkflows = [ workdirPath ], item = job_id) 
        jobOutput = None
        if outputs and len (outputs) > 0:
            jobOutput = outputs [0]
        logger.debug ("got job output: %s \n for job_id: %s", jobOutput, job_id)
        if jobOutput:
            text = GraysonUtil.readFileAsString (jobOutput)
    return ViewUtil.get_text_response (text)
Пример #4
0
def get_workflow (request):
    workflow = request.REQUEST ['workflow']   
    user = ViewUtil.get_user (request)
    workflowPath = ViewUtil.form_workflow_path (user, workflow)
    text = GraysonUtil.readFileAsString (workflowPath)
    return HttpResponse (text, GraysonWebConst.MIME_XML, 200, GraysonWebConst.MIME_XML)