Skip to content

Commit

Permalink
fix: add resource layer in docker compose gpu (#4718)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoanFM committed Apr 28, 2022
1 parent e57f952 commit 0def13d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
18 changes: 10 additions & 8 deletions jina/orchestrate/deployments/config/docker_compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,16 @@ def get_runtime_config(self) -> List[Dict]:
count = cargs.gpus

config['deploy'] = {
'reservations': {
'devices': [
{
'driver': 'nvidia',
'count': count,
'capabilities': ['gpu'],
}
]
'resources': {
'reservations': {
'devices': [
{
'driver': 'nvidia',
'count': count,
'capabilities': ['gpu'],
}
]
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,6 @@ def test_disable_auto_volume(tmpdir):


def test_flow_to_docker_compose_sandbox(tmpdir):

flow = Flow(name='test-flow', port=8080).add(
uses=f'jinahub+sandbox://DummyHubExecutor'
)
Expand Down Expand Up @@ -438,7 +437,11 @@ def test_flow_to_docker_compose_gpus(tmpdir, count):
services = configuration['services']
encoder_service = services['encoder']
assert encoder_service['deploy'] == {
'reservations': {
'devices': [{'driver': 'nvidia', 'count': count, 'capabilities': ['gpu']}]
'resources': {
'reservations': {
'devices': [
{'driver': 'nvidia', 'count': count, 'capabilities': ['gpu']}
]
}
}
}

0 comments on commit 0def13d

Please sign in to comment.