Skip to content

Commit

Permalink
Merge a22c7bb into 6855e8d
Browse files Browse the repository at this point in the history
  • Loading branch information
mvidalgarcia committed Mar 20, 2020
2 parents 6855e8d + a22c7bb commit d30fd8a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Expand Up @@ -45,9 +45,12 @@ matrix:
before_install:
- travis_retry pip install --upgrade pip setuptools py
- travis_retry pip install twine wheel coveralls requirements-builder
# requirements-builder in python2 only works with click<=7.0
- travis_retry pip install click==7.0
- requirements-builder -e $EXTRAS --level=min setup.py > .travis-lowest-requirements.txt
- requirements-builder -e $EXTRAS --level=pypi setup.py > .travis-release-requirements.txt
- requirements-builder -e $EXTRAS --level=dev --req requirements-dev.txt setup.py > .travis-devel-requirements.txt
- travis_retry pip uninstall click -y

install:
- pip install -r requirements-dev.txt
Expand Down
28 changes: 18 additions & 10 deletions reana_client/cli/workflow.py
Expand Up @@ -943,7 +943,7 @@ def workflow_delete(ctx, workflow, all_runs, workspace,
'-q',
'--brief',
is_flag=True,
help="If not set, differences in the contents of the files in the two"
help="If not set, differences in the contents of the files in the two "
"workspaces are shown.")
@click.option(
'-u',
Expand Down Expand Up @@ -983,25 +983,33 @@ def print_color_diff(lines):
elif line[0] == '+':
line_color = 'green'
click.secho(line, fg=line_color)

leading_mark = '==>'
try:
response = diff_workflows(workflow_a, workflow_b, brief, access_token,
str(context_lines))
if response.get('reana_specification'):
specification_diff = json.loads(response['reana_specification'])
nonempty_sections = {k: v for k, v in specification_diff.items()
if v}
if nonempty_sections:
click.echo('differences in reana specification:'.upper())
else:
click.echo('No differences in reana specifications.')
if not nonempty_sections:
click.secho('{} No differences in REANA specifications.'
.format(leading_mark), bold=True, fg='yellow')
# Rewrite section name workflow -> specification
if 'workflow' in nonempty_sections:
nonempty_sections['specification'] = \
nonempty_sections.pop('workflow')
for section, content in nonempty_sections.items():
click.echo('In {}:'.format(section))
click.secho('{} Differences in workflow {}'
.format(leading_mark, section),
bold=True, fg='yellow')
print_color_diff(content)
click.echo('') # Leave 1 line for separation
if response.get('workspace_listing'):
workspace_diff = json.loads(response.get('workspace_listing')).\
splitlines()
click.echo('differences in workspace listings:'.upper())
workspace_diff = json.loads(response.get('workspace_listing'))
if workspace_diff:
workspace_diff = workspace_diff.splitlines()
click.secho('{} Differences in workflow workspace'
.format(leading_mark), bold=True, fg='yellow')
print_color_diff(workspace_diff)

except Exception as e:
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Expand Up @@ -44,7 +44,8 @@
install_requires = [
'PyYAML>=5.1',
'typing>=3.7.4 ; python_version=="2.7"', # workaround for CWL deps
'click>=7',
'click>=7 ; python_version>="3"',
'click==7.0 ; python_version=="2.7"',
'cryptography>=2.7',
'cwltool==1.0.20191022103248',
'pyOpenSSL>=19.0.0', # FIXME remove once yadage-schemas solves deps.
Expand Down

0 comments on commit d30fd8a

Please sign in to comment.