Skip to content

Commit

Permalink
Merge 3579191 into 17aa531
Browse files Browse the repository at this point in the history
  • Loading branch information
Diego committed Sep 5, 2018
2 parents 17aa531 + 3579191 commit d4f9fc2
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 22 deletions.
2 changes: 1 addition & 1 deletion reana_client/__init__.py
Expand Up @@ -21,7 +21,7 @@
# granted to it by virtue of its status as an Intergovernmental Organization or
# submit itself to any jurisdiction.

"""REANA-client."""
"""REANA-Client."""

from __future__ import absolute_import, print_function

Expand Down
8 changes: 4 additions & 4 deletions reana_client/api/client.py
Expand Up @@ -38,7 +38,7 @@ class Client(object):
"""REANA API client code."""

def __init__(self, server_url):
"""Create a OpenAPI client for REANA Server."""
"""Create a OpenAPI client for REANA server."""
json_spec = self._get_spec('reana_server.json')
self._client = SwaggerClient.from_spec(
json_spec,
Expand All @@ -60,7 +60,7 @@ def _get_spec(self, spec_file):
return json_spec

def ping(self):
"""Health check REANA Server."""
"""Health check REANA server."""
try:
response, http_response = self._client.api.get_api_ping().result()
if http_response.status_code == 200:
Expand All @@ -73,7 +73,7 @@ def ping(self):

except HTTPError as e:
logging.debug(
'REANA Server health check failed: '
'REANA server health check failed: '
'\nStatus: {}\nReason: {}\n'
'Message: {}'.format(e.response.status_code,
e.response.reason,
Expand Down Expand Up @@ -312,7 +312,7 @@ def get_files(self, workflow_id, access_token):
raise e

def upload_to_server(self, workflow, paths, access_token):
"""Upload file or directory to REANA-Server.
"""Upload file or directory to REANA server.
Shared e.g. by `code upload` and `inputs upload`.
Expand Down
2 changes: 1 addition & 1 deletion reana_client/cli/__init__.py
Expand Up @@ -53,7 +53,7 @@ def __init__(self):
default='WARNING')
@click.pass_context
def cli(ctx, loglevel):
"""REANA Client for interacting with REANA Server."""
"""REANA client for interacting with REANA server."""
logging.basicConfig(
format=DEBUG_LOG_FORMAT if loglevel == 'DEBUG' else LOG_FORMAT,
stream=sys.stderr,
Expand Down
2 changes: 1 addition & 1 deletion reana_client/cli/cwl_runner.py
Expand Up @@ -52,7 +52,7 @@ def cwl_runner(client, quiet, outdir, processfile, jobfile):
"""Run CWL files in a standard format <workflow.cwl> <job.json>."""
server_url = os.environ.get('REANA_SERVER_URL', 'http://reana.cern.ch')

logging.info('REANA Server URL ($REANA_SERVER_URL) is: {}'
logging.info('REANA server URL ($REANA_SERVER_URL) is: {}'
.format(server_url))

client = Client(server_url)
Expand Down
4 changes: 2 additions & 2 deletions reana_client/cli/ping.py
Expand Up @@ -29,11 +29,11 @@
from reana_client.decorators import with_api_client


@click.command('ping', help='Health check REANA Server.')
@click.command('ping', help='Health check REANA server.')
@click.pass_context
@with_api_client
def ping(ctx):
"""Health check REANA Server."""
"""Health check REANA server."""
try:
logging.info('Connecting to {0}'.format(ctx.obj.client.server_url))
response = ctx.obj.client.ping()
Expand Down
26 changes: 19 additions & 7 deletions reana_client/cli/workflow.py
Expand Up @@ -165,7 +165,7 @@ def workflow_workflows(ctx, _filter, output_format, access_token,
'--skip-validation',
is_flag=True,
help="If set, specifications file is not validated before "
"submitting it's contents to REANA Server.")
"submitting it's contents to REANA server.")
@click.option(
'-at',
'--access-token',
Expand Down Expand Up @@ -212,7 +212,17 @@ def workflow_create(ctx, file, name, skip_validation, access_token):

@click.command(
'start',
help='Start previously created workflow.')
help="""
Start previously created workflow
The workflow execution can be modified by setting operational
parameters using -p or --parameter, for example, for disabling
caching:
$ reana-client start -p CACHING=false
For now this functionality is only supported by serial workflows.
""")
@click.option(
'-w',
'--workflow',
Expand All @@ -225,13 +235,15 @@ def workflow_create(ctx, file, name, skip_validation, access_token):
'--access-token',
default=os.environ.get('REANA_ACCESS_TOKEN', None),
help='Access token of the current user.')
@click.argument(
'parameters',
nargs=-1,
@click.option(
'-p', '--parameter',
multiple=True,
help='Operatinal parameters. For now only CACHING=[true|false] is '
'supported in serial workflows.',
)
@click.pass_context
@with_api_client
def workflow_start(ctx, workflow, access_token, parameters):
def workflow_start(ctx, workflow, access_token, parameter): # noqa: D301
"""Start previously created workflow."""
logging.debug('command: {}'.format(ctx.command_path.replace(" ", ".")))
for p in ctx.params:
Expand All @@ -244,7 +256,7 @@ def workflow_start(ctx, workflow, access_token, parameters):
sys.exit(1)

parsed_parameters = {'parameters':
dict(p.split('=') for p in parameters)}
dict(p.split('=') for p in parameter)}

if workflow:
try:
Expand Down
4 changes: 2 additions & 2 deletions reana_client/decorators.py
Expand Up @@ -31,7 +31,7 @@


def with_api_client(f):
"""Decorator to inject the REANA Server API client to a Click command."""
"""Decorator to inject the REANA server API client to a Click command."""
def wrapper(*args, **kwargs):
"""Initialize config for API client.
Expand All @@ -53,7 +53,7 @@ def wrapper(*args, **kwargs):
'REANA_SERVER_URL=https://reana.cern.ch/')
sys.exit(1)

logging.info('REANA Server URL ($REANA_SERVER_URL) is: {}'
logging.info('REANA server URL ($REANA_SERVER_URL) is: {}'
.format(server_url))
ctx.obj.client = Client(server_url)
else:
Expand Down
10 changes: 8 additions & 2 deletions reana_client/openapi_connections/reana_server.json
Expand Up @@ -223,24 +223,28 @@
"examples": {
"application/json": [
{
"created": "2018-06-13T09:47:35.66097",
"id": "256b25f4-4cfb-4684-b7a8-73872ef455a1",
"name": "mytest-1",
"status": "running",
"user": "00000000-0000-0000-0000-000000000000"
},
{
"created": "2018-06-13T09:47:35.66097",
"id": "3c9b117c-d40a-49e3-a6de-5f89fcada5a3",
"name": "mytest-2",
"status": "finished",
"user": "00000000-0000-0000-0000-000000000000"
},
{
"created": "2018-06-13T09:47:35.66097",
"id": "72e3ee4f-9cd3-4dc7-906c-24511d9f5ee3",
"name": "mytest-3",
"status": "created",
"user": "00000000-0000-0000-0000-000000000000"
},
{
"created": "2018-06-13T09:47:35.66097",
"id": "c4c0a1a6-beef-46c7-be04-bf4b3beca5a1",
"name": "mytest-4",
"status": "created",
Expand All @@ -251,6 +255,9 @@
"schema": {
"items": {
"properties": {
"created": {
"type": "string"
},
"id": {
"type": "string"
},
Expand Down Expand Up @@ -505,7 +512,7 @@
"description": "Request succeeded. Info about a workflow, including the status is returned.",
"examples": {
"application/json": {
"created": "2018-06-13 09:47:35.660977",
"created": "2018-06-13T09:47:35.66097",
"id": "256b25f4-4cfb-4684-b7a8-73872ef455a1",
"name": "mytest-1",
"status": "created",
Expand Down Expand Up @@ -720,7 +727,6 @@
"items": {
"properties": {
"last-modified": {
"format": "date-time",
"type": "string"
},
"name": {
Expand Down
2 changes: 1 addition & 1 deletion reana_client/version.py
Expand Up @@ -20,7 +20,7 @@
# granted to it by virtue of its status as an Intergovernmental Organization or
# submit itself to any jurisdiction.

"""Version information for REANA-client.
"""Version information for REANA-Client.
This file is imported by ``reana_client.__init__`` and parsed by
``setup.py``.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -69,7 +69,7 @@
'click>=6.7',
'cwltool==1.0.20180326152342',
'pyOpenSSL==17.3.0', # FIXME remove once yadage-schemas solves deps.
'reana-commons>=0.3.0',
'reana-commons>=0.3.1',
'rfc3987==1.3.7', # FIXME remove once yadage-schemas solves deps.
'strict-rfc3339==0.7', # FIXME remove once yadage-schemas solves deps.
'tablib>=0.12.1',
Expand Down

0 comments on commit d4f9fc2

Please sign in to comment.