Skip to content

Commit

Permalink
Merge pull request #23 from keyko-io/fix/return-compute-job-id
Browse files Browse the repository at this point in the history
Return the compute job id
  • Loading branch information
r-marques committed Sep 21, 2020
2 parents efffe88 + d24a722 commit 6e18be9
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.4.0
current_version = 0.4.1
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
author = 'nevermined-sdk-py contributors'

# The full version, including alpha/beta/rc tags
release = '0.4.0'
release = '0.4.1'
# The short X.Y version
release_parts = release.split('.') # a list
version = release_parts[0] + '.' + release_parts[1]
Expand Down
2 changes: 1 addition & 1 deletion nevermined_sdk_py/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '0.4.0'
__version__ = '0.4.1'
from .config import (
Config
)
Expand Down
6 changes: 4 additions & 2 deletions nevermined_sdk_py/assets/asset_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ def execute(agreement_id, compute_ddo, workflow_ddo, consumer_account, gateway,
:param workflow_ddo:
:param consumer_account:
:param index:
:return:
:return: the id of the compute job
"""
service_endpoint = ServiceAgreement.from_ddo(ServiceTypes.CLOUD_COMPUTE,
compute_ddo).service_endpoint
response = gateway.execute_compute_service(agreement_id, service_endpoint,
consumer_account, workflow_ddo)

gateway.execute_compute_service(agreement_id, service_endpoint, consumer_account, workflow_ddo)
return response.json()["workflowId"]
2 changes: 2 additions & 0 deletions nevermined_sdk_py/gateway/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ def execute_compute_service(service_agreement_id, service_endpoint, account, wor
})
execute_url = Gateway._create_compute_url(service_endpoint, service_agreement_id)
response = Gateway._http_client.post(execute_url, headers= headers)
if response.status_code != 200:
raise ValueError(response.text)
return response


Expand Down
2 changes: 1 addition & 1 deletion nevermined_sdk_py/nevermined/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ def execute(self, agreement_id, did, index, consumer_account, workflow_did):
:param consumer_account: Account instance of the consumer ordering the service
:param workflow_did: the asset did (of `workflow` type) which consist of `did:nv:` and
the assetId hex str (without `0x` prefix), str
:return: local path on the file system where the asset data files are downloaded, str
:return: the id of the compute job, str
"""
workflow_ddo = self.resolve(workflow_did)
compute_ddo = self.resolve(did)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,6 @@
test_suite='tests',
tests_require=test_requirements,
url='https://github.com/keyko-io/nevermined-sdk-py',
version='0.4.0',
version='0.4.1',
zip_safe=False,
)
6 changes: 5 additions & 1 deletion tests/resources/mocks/gateway_mock.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import os

from requests import Response

from nevermined_sdk_py.gateway.gateway import Gateway


Expand Down Expand Up @@ -43,7 +45,9 @@ def execute_service(agreement_id, service_endpoint, consumer_account, workflow_d

@staticmethod
def execute_compute_service(agreement_id, service_endpoint, consumer_account, workflow_ddo):
return True
r = Response()
r._content = b'{"workflowId": "nevermined-compute-h4trr"}'
return r

@staticmethod
def get_gateway_url(config):
Expand Down

0 comments on commit 6e18be9

Please sign in to comment.