Skip to content

Commit

Permalink
Remove full context from input.
Browse files Browse the repository at this point in the history
The default behavior should be to send only what an activity requires
to run, instead of sending the full context. This was added in #64, so
handpicking those values will solve the problem.

@someboredkiddo
  • Loading branch information
xethorn committed Apr 20, 2016
1 parent 967db94 commit 7aca12a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 7 additions & 1 deletion garcon/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,16 @@ def create_execution_input(self):
if value:
activity_input.update({requirement: value})

activity_input.update(self.execution_context.items())
activity_input.update({
'execution.domain': self.global_context.get('execution.domain'),
'execution.run_id': self.global_context.get('execution.run_id'),
'execution.workflow_id': self.global_context.get(
'execution.workflow_id')
})

except runner.NoRunnerRequirementsFound:
return self.global_context

return activity_input


Expand Down
6 changes: 4 additions & 2 deletions tests/test_activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,11 @@ def task_a(value):
execution_context=dict(somemore='values'))
resp = instance.create_execution_input()

assert len(resp) == 2
assert len(resp) == 4
assert resp.get('context') == 'yes'
assert resp.get('somemore') == 'values'
assert 'execution.domain' in resp
assert 'execution.run_id' in resp
assert 'execution.workflow_id' in resp


def test_create_activity_instance_input_without_decorate(monkeypatch):
Expand Down

0 comments on commit 7aca12a

Please sign in to comment.