Skip to content

Commit

Permalink
Duplicate kwargs in bash_app call rather than modifying reusable dict (
Browse files Browse the repository at this point in the history
…#1413)

The xfailing test for this needed updating a bit to reflect
recent changes in parsl.

Fixes issue #1058
  • Loading branch information
benclifford authored and yadudoc committed Oct 30, 2019
1 parent 7e2c4af commit 3316aae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
7 changes: 4 additions & 3 deletions parsl/app/bash.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,9 @@ def __call__(self, *args, **kwargs):
App_fut
"""
# Update kwargs in the app definition with ones passed in at calltime
self.kwargs.update(kwargs)
invocation_kwargs = {}
invocation_kwargs.update(self.kwargs)
invocation_kwargs.update(kwargs)

if self.data_flow_kernel is None:
dfk = DataFlowKernelLoader.dfk()
Expand All @@ -158,6 +159,6 @@ def __call__(self, *args, **kwargs):
executors=self.executors,
fn_hash=self.func_hash,
cache=self.cache,
**self.kwargs)
**invocation_kwargs)

return app_fut
12 changes: 5 additions & 7 deletions parsl/tests/test_bash_apps/test_kwarg_storage.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import os
import pytest

from parsl.app.app import App


@App('bash')
def foo(z=2, stdout=None):
return """echo {val} {{z}}
return """echo {val}
""".format(val=z)


@pytest.mark.xfail(reason="This failing test demonstrates issue #1058", strict=True)
def test_command_format_1():
"""Testing command format for BashApps
"""
Expand All @@ -33,7 +31,7 @@ def test_command_format_1():
if os.path.exists('stdout_file'):
os.remove(stdout)

assert contents == '2 2\n', 'Output does not match expected string "2 2", Got: "{0}"'.format(
assert contents == '2\n', 'Output does not match expected string "2", Got: "{0}"'.format(
contents)

# ===========
Expand All @@ -56,7 +54,7 @@ def test_command_format_1():
if os.path.exists('stdout_file'):
os.remove(stdout)

assert contents == '3 3\n', 'Output does not match expected string "3 3", Got: "{0}"'.format(
assert contents == '3\n', 'Output does not match expected string "3", Got: "{0}"'.format(
contents)

# ===========
Expand All @@ -78,7 +76,7 @@ def test_command_format_1():
if os.path.exists('stdout_file'):
os.remove(stdout)

assert contents == '4 4\n', 'Output does not match expected string "4 4", Got: "{0}"'.format(
assert contents == '4\n', 'Output does not match expected string "4", Got: "{0}"'.format(
contents)

# ===========
Expand All @@ -100,6 +98,6 @@ def test_command_format_1():
if os.path.exists('stdout_file'):
os.remove(stdout)

assert contents == '2 2\n', 'Output does not match expected string "2 2", Got: "{0}"'.format(
assert contents == '2\n', 'Output does not match expected string "2", Got: "{0}"'.format(
contents)
return True

0 comments on commit 3316aae

Please sign in to comment.