Skip to content

Commit

Permalink
Merge ee16378 into 6855e8d
Browse files Browse the repository at this point in the history
  • Loading branch information
mvidalgarcia committed Mar 19, 2020
2 parents 6855e8d + ee16378 commit b6736e9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
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.0; python_version=="2.7"',
'click>=7; python_version>"3"',
'cryptography>=2.7',
'cwltool==1.0.20191022103248',
'pyOpenSSL>=19.0.0', # FIXME remove once yadage-schemas solves deps.
Expand Down

0 comments on commit b6736e9

Please sign in to comment.