コード例 #1
0
ファイル: tools.py プロジェクト: thejohnhoffer/TissueMAPS
def get_tool_job_log(experiment_id, job_id):
    """
    .. http:get:: /api/experiments/(string:experiment_id)/tools/jobs/(string:job_id)/log

        Get the log output of a :class:`ToolJob <tmlib.tools.jobs.ToolJob>`
        for a given :class:`ToolResult <tmlib.models.result.ToolResult>`.

        **Example response**:

        .. sourcecode:: http

            HTTP/1.1 200 OK
            Content-Type: application/json

            {
                "data": {
                    "stdout": "bla bla bla",
                    "stderr": ""
                }
            }

        :statuscode 400: malformed request
        :statuscode 200: no error

    """
    logger.info('get log of tool job %d for experiment %d', job_id,
                experiment_id)
    job = gc3pie.retrieve_task(job_id)
    stdout_file = os.path.join(job.output_dir, job.stdout)
    with open(stdout_file, 'r') as f:
        out = f.read()
    stderr_file = os.path.join(job.output_dir, job.stderr)
    with open(stderr_file, 'r') as f:
        err = f.read()
    return jsonify(data={'stdout': out, 'stderr': err})
コード例 #2
0
ファイル: workflow.py プロジェクト: dvischi/TissueMAPS
def get_job_log(experiment_id, job_id):
    """
    .. http:get:: /api/experiments/(string:experiment_id)/workflow/jobs/(string:job_id)/log

        Get the log output of a
        :class:`WorkflowStepJob <tmlib.workflow.jobs.WorkflowStepJob>`.

        **Example response**:

        .. sourcecode:: http

            HTTP/1.1 200 OK
            Content-Type: application/json

            {
                "data": {
                    "stdout": string,
                    "stderr": string
                }
            }

        :reqheader Authorization: JWT token issued by the server
        :statuscode 200: no error

    """
    logger.info(
        'get job log output for experiment %d and job %d',
        experiment_id, job_id
    )
    # NOTE: This is the persistent task ID of the job
    job = gc3pie.retrieve_task(job_id)
    stdout_file = os.path.join(job.output_dir, job.stdout)
    with open(stdout_file, 'r') as f:
        out = f.read()
    stderr_file = os.path.join(job.output_dir, job.stderr)
    with open(stderr_file, 'r') as f:
        err = f.read()
    return jsonify(data={'stdout': out, 'stderr': err})
コード例 #3
0
ファイル: tools.py プロジェクト: dvischi/TissueMAPS
def get_tool_job_log(experiment_id, job_id):
    """
    .. http:get:: /api/experiments/(string:experiment_id)/tools/jobs/(string:job_id)/log

        Get the log output of a :class:`ToolJob <tmlib.tools.jobs.ToolJob>`
        for a given :class:`ToolResult <tmlib.models.result.ToolResult>`.

        **Example response**:

        .. sourcecode:: http

            HTTP/1.1 200 OK
            Content-Type: application/json

            {
                "data": {
                    "stdout": "bla bla bla",
                    "stderr": ""
                }
            }

        :statuscode 400: malformed request
        :statuscode 200: no error

    """
    logger.info(
        'get log of tool job %d for experiment %d',
        job_id, experiment_id
    )
    job = gc3pie.retrieve_task(job_id)
    stdout_file = os.path.join(job.output_dir, job.stdout)
    with open(stdout_file, 'r') as f:
        out = f.read()
    stderr_file = os.path.join(job.output_dir, job.stderr)
    with open(stderr_file, 'r') as f:
        err = f.read()
    return jsonify(data={'stdout': out, 'stderr': err})
コード例 #4
0
ファイル: workflow.py プロジェクト: thejohnhoffer/TissueMAPS
def get_job_log(experiment_id, job_id):
    """
    .. http:get:: /api/experiments/(string:experiment_id)/workflow/jobs/(string:job_id)/log

        Get the log output of a
        :class:`WorkflowStepJob <tmlib.workflow.jobs.WorkflowStepJob>`.

        **Example response**:

        .. sourcecode:: http

            HTTP/1.1 200 OK
            Content-Type: application/json

            {
                "data": {
                    "stdout": string,
                    "stderr": string
                }
            }

        :reqheader Authorization: JWT token issued by the server
        :statuscode 200: no error

    """
    logger.info('get job log output for experiment %d and job %d',
                experiment_id, job_id)
    # NOTE: This is the persistent task ID of the job
    job = gc3pie.retrieve_task(job_id)
    stdout_file = os.path.join(job.output_dir, job.stdout)
    with open(stdout_file, 'r') as f:
        out = f.read()
    stderr_file = os.path.join(job.output_dir, job.stderr)
    with open(stderr_file, 'r') as f:
        err = f.read()
    return jsonify(data={'stdout': out, 'stderr': err})
コード例 #5
0
def kill_jobs(experiment_id):
    '''Kills submitted jobs.'''
    # TODO
    task = gc3pie.retrieve_task(task_id)
    gc3pie.kill_task(task)
コード例 #6
0
ファイル: api.py プロジェクト: dvischi/TissueMAPS
def kill_jobs(experiment_id):
    '''Kills submitted jobs.'''
    # TODO
    task = gc3pie.retrieve_task(task_id)
    gc3pie.kill_task(task)