-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #107 from galaxyproject/fix_resource_clamping
Fix evaluation to support resource clamping
- Loading branch information
Showing
4 changed files
with
57 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,6 +126,13 @@ tools: | |
scheduling: | ||
require: | ||
- test_of_mem_accepted | ||
tool_for_testing_resource_clamping: | ||
cores: 16 | ||
env: | ||
MY_TOOL_ENV: "cores: {cores} mem: {mem} gpus: {gpus}" | ||
scheduling: | ||
require: | ||
- test_of_resource_clamping | ||
|
||
users: | ||
[email protected]: | ||
|
@@ -303,3 +310,15 @@ destinations: | |
scheduling: | ||
accept: | ||
- pulsar-canberra | ||
clamped_destination: | ||
runner: k8s | ||
max_accepted_cores: 32 | ||
max_accepted_mem: 128 | ||
max_accepted_gpus: 2 | ||
cores: 8 | ||
gpus: 1 | ||
env: | ||
MY_DEST_ENV: "cores: {cores} mem: {mem} gpus: {gpus}" | ||
scheduling: | ||
accept: | ||
- test_of_resource_clamping |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -207,3 +207,18 @@ def test_user_map_to_destination_accepting_offline(self): | |
datasets = [mock_galaxy.DatasetAssociation("test", mock_galaxy.Dataset("test.txt", file_size=12 * 1024 ** 3))] | ||
destination = self._map_to_destination(tool, user, datasets, tpv_config_paths=[config]) | ||
self.assertEqual(destination.id, "pulsar-canberra") | ||
|
||
def test_destination_clamping(self): | ||
"""_summary_ Any variables defined in a tool should be evaluated as late as possible, so that destination level | ||
clamping works. | ||
""" | ||
user = mock_galaxy.User('albo', '[email protected]') | ||
|
||
config = os.path.join(os.path.dirname(__file__), 'fixtures/mapping-destinations.yml') | ||
|
||
tool = mock_galaxy.Tool('tool_for_testing_resource_clamping') | ||
datasets = [mock_galaxy.DatasetAssociation("test", mock_galaxy.Dataset("test.txt", file_size=12 * 1024 ** 3))] | ||
destination = self._map_to_destination(tool, user, datasets, tpv_config_paths=[config]) | ||
self.assertEqual(destination.id, "clamped_destination") | ||
self.assertEqual([env['value'] for env in destination.env if env['name'] == 'MY_DEST_ENV'], ['cores: 8 mem: 24 gpus: 1']) | ||
self.assertEqual([env['value'] for env in destination.env if env['name'] == 'MY_TOOL_ENV'], ['cores: 8 mem: 24 gpus: 1']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters