-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
18154f6
commit 1a35e5d
Showing
9 changed files
with
182 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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
stages: | ||
- db: | ||
name: db | ||
|
||
- master: | ||
pre: | ||
- sh: make -C tools prep-root | ||
# Slice our kubeconfig up into two different kube configs. Determined should use whatever context is set. | ||
- sh: cp ~/.kube/config /tmp/defaultrm-kubeconf && kubectl config use-context defaultrm --kubeconfig=/tmp/defaultrm-kubeconf | ||
- sh: cp ~/.kube/config /tmp/additionalrm-kubeconf && kubectl config use-context additionalrm --kubeconfig=/tmp/additionalrm-kubeconf | ||
config_file: | ||
db: | ||
host: localhost | ||
port: 5432 | ||
password: postgres | ||
user: postgres | ||
name: determined | ||
checkpoint_storage: | ||
type: shared_fs | ||
host_path: /tmp/determined-cp | ||
cache: | ||
cache_dir: /tmp/determined-cache | ||
log: | ||
level: debug | ||
enable_cors: true | ||
root: tools/build | ||
|
||
resource_manager: | ||
type: kubernetes | ||
name: default | ||
namespace: default | ||
max_slots_per_pod: 1 | ||
slot_type: "cpu" | ||
slot_resource_requests: | ||
cpu: 1 | ||
kubeconfig_path: /tmp/defaultrm-kubeconf | ||
determined_master_ip: $DOCKER_LOCALHOST | ||
determined_master_port: 8080 | ||
additional_resource_managers: | ||
- resource_manager: | ||
type: kubernetes | ||
name: additionalrm | ||
namespace: default | ||
max_slots_per_pod: 1 | ||
slot_type: "cpu" | ||
slot_resource_requests: | ||
cpu: 1 | ||
kubeconfig_path: /tmp/additionalrm-kubeconf | ||
determined_master_ip: $DOCKER_LOCALHOST | ||
determined_master_port: 8080 | ||
resource_pools: | ||
- pool_name: additional_pool |
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
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 |
---|---|---|
@@ -0,0 +1,75 @@ | ||
from typing import Optional | ||
|
||
import pytest | ||
|
||
from determined.common import api | ||
from determined.common.api import bindings | ||
from tests import api_utils | ||
from tests import config as conf | ||
from tests import detproc | ||
from tests import experiment as exp | ||
from tests.cluster import utils | ||
|
||
MAX_WAIT_TIME = 500 # Really long since minikube will need to pull images. | ||
|
||
|
||
@pytest.mark.e2e_multi_k8s | ||
@pytest.mark.parametrize( | ||
"resource_pool, expected_node", [(None, "defaultrm"), ("additional_pool", "additionalrm")] | ||
) | ||
def test_run_experiment_multi_k8s(resource_pool: Optional[str], expected_node: str) -> None: | ||
args = ["--config", "entrypoint=echo RunningOnNode=$DET_AGENT_ID"] | ||
if resource_pool: | ||
args += ["--config", f"resources.resource_pool={resource_pool}"] | ||
|
||
sess = api_utils.user_session() | ||
exp_id = exp.create_experiment( | ||
sess, | ||
conf.fixtures_path("no_op/single-one-short-step.yaml"), | ||
conf.fixtures_path("no_op"), | ||
args, | ||
) | ||
exp.wait_for_experiment_state( | ||
sess, | ||
exp_id, | ||
bindings.experimentv1State.COMPLETED, | ||
max_wait_secs=MAX_WAIT_TIME, | ||
) | ||
exp.assert_patterns_in_trial_logs( | ||
sess, exp.experiment_first_trial(sess, exp_id), [f"RunningOnNode={expected_node}"] | ||
) | ||
|
||
|
||
@pytest.mark.e2e_multi_k8s | ||
@pytest.mark.parametrize( | ||
"resource_pool, expected_node", [(None, "defaultrm"), ("additional_pool", "additionalrm")] | ||
) | ||
def test_run_command_multi_k8s(resource_pool: Optional[str], expected_node: str) -> None: | ||
sess = api_utils.user_session() | ||
args = ( | ||
None if resource_pool is None else ["--config", f"resources.resource_pool={resource_pool}"] | ||
) | ||
command_id = utils.run_command_args(sess, "echo RunningOnNode=$DET_AGENT_ID", args) | ||
utils.wait_for_command_state(sess, command_id, "TERMINATED", MAX_WAIT_TIME) | ||
utils.assert_command_succeeded(sess, command_id) | ||
|
||
logs = api.task_logs(sess, command_id) | ||
str_logs = "".join(log.log for log in logs) | ||
assert f"RunningOnNode={expected_node}" in str_logs, str_logs | ||
|
||
|
||
@pytest.mark.e2e_multi_k8s | ||
def test_not_found_pool_multi_k8s() -> None: | ||
sess = api_utils.user_session() | ||
detproc.check_error( | ||
sess, | ||
["det", "cmd", "run", "--config", "resources.resource_pool=missing", "echo"], | ||
"could not find resource pool missing", | ||
) | ||
|
||
|
||
@pytest.mark.e2e_multi_k8s | ||
def test_get_agents_multi_k8s() -> None: | ||
sess = api_utils.user_session() | ||
resp = bindings.get_GetAgents(sess) | ||
assert {agent.id for agent in resp.agents} == {"defaultrm", "additionalrm"} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ | |
"e2e_cpu_elastic", | ||
"e2e_cpu_rbac", | ||
"e2e_gpu", | ||
"e2e_multi_k8s", | ||
"e2e_k8s", | ||
"e2e_pbs", | ||
"e2e_slurm", | ||
|
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
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