Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion JobRunner/provenance.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ def __init__(self, params):
"input_ws_objects": params.get(
"source_ws_objects", params.get("input_ws_objects", [])
),
"subactions": params.get("subactions", []),
"subactions": [],
"description": params.get("description", desc),
}
for s in params.get("subactions", []):
self.add_subaction(s)

def add_subaction(self, data):
if data["name"] not in self.actions:
Expand Down
65 changes: 52 additions & 13 deletions test/test_callback_server_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,25 +279,46 @@ def test_submit_job_sync_and_provenance(callback_ports):
resp = _post(port, {"method": "CallbackServer.get_provenance"})
j = resp.json()
del j["result"][0][0]["time"] # changes from run to run
assert j == {'result': [[{
'description': 'KBase SDK method run via the KBase Execution Engine',
'input_ws_objects': [],
'method': 'bar',
'method_params': [],
'service': 'foo',
'service_ver': 'beta',
'subactions': [{
'code_url': 'https://github.com/kbasetest/njs_sdk_test_1',
'commit': '366eb8cead445aa3e842cbc619082a075b0da322',
'name': 'njs_sdk_test_1',
'ver': '0.0.3-dev'
assert j == {"result": [[{
"description": "KBase SDK method run via the KBase Execution Engine",
"input_ws_objects": [],
"method": "bar",
"method_params": [],
"service": "foo",
"service_ver": "beta",
"subactions": [{
"code_url": "https://github.com/kbasetest/njs_sdk_test_1",
"commit": "366eb8cead445aa3e842cbc619082a075b0da322",
"name": "njs_sdk_test_1",
"ver": "0.0.3-dev"
}],
}]]}


def test_submit_job_async(callback_ports):
def test_submit_job_async_and_provenance(callback_ports):
# ensures that if initial provenance includes a subaction that is run via the callback
# server it's not duplicated in the actions list.
port = callback_ports[0]

resp = _post(
port,
{
"method": "CallbackServer.set_provenance",
"params": [{
"method": "foo.bar2",
"service_ver": "release",
"subactions": [{
"name": "njs_sdk_test_2",
"code_url": "https://fake.com",
"commit": "fake commit",
"ver": "100.100.100-dev",
}],
}]
}
)
j = resp.json()
assert j.keys() == {"result"}

resp = _post(port, {
"method": "njs_sdk_test_2._run_submit",
"params": [{"id": "godiloveasynchrony"}],
Expand All @@ -324,6 +345,24 @@ def test_submit_job_async(callback_ports):
"version": "1.1"
}]}

resp = _post(port, {"method": "CallbackServer.get_provenance"})
j = resp.json()
del j["result"][0][0]["time"] # changes from run to run
assert j == {"result": [[{
"description": "KBase SDK method run via the KBase Execution Engine",
"input_ws_objects": [],
"method": "bar2",
"method_params": [],
"service": "foo",
"service_ver": "release",
"subactions": [{
"name": "njs_sdk_test_2",
"code_url": "https://fake.com",
"commit": "fake commit",
"ver": "100.100.100-dev",
}],
}]]}


def test_submit_job_default_service_ver(callback_ports):
port = callback_ports[0]
Expand Down
Loading