-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
805 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
machine ftp-private.ebi.ac.uk | ||
login tesk-1 | ||
password Z6fsH6MG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
"""Controller for auxiliary WES-ELIXIR API endpoints.""" | ||
|
||
import logging | ||
|
||
from celery import current_app as celery_app | ||
from connexion import request | ||
from flask import current_app | ||
|
||
from wes_elixir.security.decorators import auth_token_optional | ||
|
||
# Get logger instance | ||
logger = logging.getLogger(__name__) | ||
|
||
|
||
# GET /stdout/<run_id> | ||
@auth_token_optional | ||
def get_stdout(run_id, *args, **kwargs): | ||
"""Returns run STDOUT as plain text.""" | ||
response = "" | ||
log_request(request, response) | ||
return response | ||
|
||
|
||
# POST /stderr/<run_id> | ||
@auth_token_optional | ||
def get_stderr(run_id, *args, **kwargs): | ||
"""Returns run STDERR as plain text.""" | ||
response = "" | ||
log_request(request, response) | ||
return response | ||
|
||
|
||
def log_request(request, response): | ||
"""Writes request and response to log.""" | ||
# TODO: write decorator for request logging | ||
logger.debug( | ||
( | ||
"Response to request \"{method} {path} {protocol}\" from " | ||
"{remote_addr}: {response}" | ||
).format( | ||
method=request.environ['REQUEST_METHOD'], | ||
path=request.environ['PATH_INFO'], | ||
protocol=request.environ['SERVER_PROTOCOL'], | ||
remote_addr=request.environ['REMOTE_ADDR'], | ||
response=response, | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
openapi: 3.0.0 | ||
info: | ||
title: WES-ELIXIR STDOUT & STDERR OpenAPI specification | ||
contact: | ||
name: ELIXIR Cloud & AAI group | ||
email: [email protected] | ||
license: | ||
name: Apache 2.0 | ||
url: https://www.apache.org/licenses/LICENSE-2.0 | ||
version: 0.14.0 | ||
servers: | ||
- url: /wes-elixir/v1 | ||
paths: | ||
/stdout/{run_id}: | ||
get: | ||
summary: |- | ||
Retrieves the content of the indicated run's STDOUT stream and returns | ||
it as plain text. | ||
parameters: | ||
- in: path | ||
name: run_id | ||
schema: | ||
type: string | ||
required: true | ||
description: Run identifier. | ||
operationId: get_stdout | ||
responses: | ||
200: | ||
description: |- | ||
STDOUT stream of indicated run as plain text. | ||
content: | ||
text/plain: | ||
schema: | ||
type: string | ||
example: "This is STDOUT." | ||
400: | ||
description: The request is malformed. | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/ErrorResponse' | ||
401: | ||
description: The request is unauthorized. | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/ErrorResponse' | ||
403: | ||
description: The requester is not authorized to perform this action. | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/ErrorResponse' | ||
404: | ||
description: The requested resource was not found. | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/ErrorResponse' | ||
500: | ||
description: An unexpected error occurred. | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/ErrorResponse' | ||
x-openapi-router-controller: api.controllers | ||
/stderr/{run_id}: | ||
get: | ||
summary: |- | ||
Retrieves the content of the indicated run's STDERR stream and returns | ||
it as plain text. | ||
operationId: get_stderr | ||
parameters: | ||
- in: path | ||
name: run_id | ||
schema: | ||
type: string | ||
required: true | ||
description: Run identifier. | ||
responses: | ||
200: | ||
description: |- | ||
STDERR stream of indicated run as plain text. | ||
content: | ||
text/plain: | ||
schema: | ||
type: string | ||
example: "This is STDERR." | ||
400: | ||
description: The request is malformed. | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/ErrorResponse' | ||
401: | ||
description: The request is unauthorized. | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/ErrorResponse' | ||
403: | ||
description: The requester is not authorized to perform this action. | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/ErrorResponse' | ||
404: | ||
description: The requested resource was not found. | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/ErrorResponse' | ||
500: | ||
description: An unexpected error occurred. | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/ErrorResponse' | ||
x-openapi-router-controller: api.controllers | ||
components: | ||
schemas: | ||
Error: | ||
required: | ||
- message | ||
- reason | ||
type: object | ||
properties: | ||
message: | ||
type: string | ||
description: |- | ||
A human readable message providing more details about the error. | ||
example: | ||
Required parameter 'xyz' is missing. | ||
reason: | ||
type: string | ||
description: |- | ||
Unique identifier for this error, but *not* the HTTP response code | ||
(e.g., name of exception). | ||
example: ValueError | ||
description: An individual error message. | ||
ErrorResponse: | ||
required: | ||
- code | ||
- errors | ||
- message | ||
type: object | ||
properties: | ||
code: | ||
type: integer | ||
description: HTTP status code (e.g., 400, 404). | ||
format: int64 | ||
example: 400 | ||
errors: | ||
type: array | ||
description: List of associated errors and warnings. | ||
items: | ||
$ref: '#/components/schemas/Error' | ||
message: | ||
type: string | ||
description: |- | ||
A human readable message providing more details about the error. | ||
example: The request could not be interpreted. | ||
description: A response object for detailed error messages. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,4 +52,6 @@ def get_run_log( | |
) | ||
raise Forbidden | ||
|
||
# Remove | ||
|
||
return run_log |
Oops, something went wrong.