Skip to content

Commit

Permalink
small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
amandavialva01 committed Jun 25, 2024
1 parent 92c1bfd commit 6e3c5d4
Show file tree
Hide file tree
Showing 9 changed files with 259 additions and 189 deletions.
4 changes: 2 additions & 2 deletions e2e_tests/tests/cluster/test_workspace_org.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ def test_set_workspace_namespace_bindings(
"--namespace",
namespace,
],
"no resource manager with the given cluster name",
"no resource manager with cluster name",
)

detproc.check_error(
Expand All @@ -633,7 +633,7 @@ def test_set_workspace_namespace_bindings(
"--namespace",
namespace,
],
"no resource manager with the given cluster name",
"no resource manager with cluster name",
)

# Valid namespace name, no cluster name. (Should fail for multirm but work for single
Expand Down
12 changes: 5 additions & 7 deletions harness/determined/cli/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def list_workspace_namespace_bindings(args: argparse.Namespace) -> None:
cluster_namespaces = []
namespace_bindings = resp.namespaceBindings
for cluster in namespace_bindings:
cluster_namespaces.append([cluster, namespace_bindings[cluster]])
cluster_namespaces.append([cluster, namespace_bindings[cluster].namespace])
render.tabulate_or_csv(
headers=["Cluster", "Namespace"],
values=cluster_namespaces,
Expand All @@ -181,9 +181,8 @@ def set_workspace_namespace_binding(args: argparse.Namespace) -> None:
w = api.workspace_by_name(sess, args.workspace_name)
content = bindings.v1SetWorkspaceNamespaceBindingsRequest(workspaceId=w.id)
cluster_name = args.cluster_name or ""
requested_namespace = args.namespace or ""
namespace_meta = bindings.v1WorkspaceNamespaceMeta(
namespace=requested_namespace,
namespace=args.namespace,
autoCreateNamespace=args.auto_create_namespace,
autoCreateNamespaceAllClusters=args.auto_create_namespace_all_clusters,
)
Expand Down Expand Up @@ -265,10 +264,9 @@ def create_workspace(args: argparse.Namespace) -> None:
# value in the clusterNamespacePairs dictionary. To avoid that, we substitute the argument's
# value with the empty string if it's null.
cluster_name = args.cluster_name or ""
requested_namespace = args.namespace or ""
if args.namespace or args.auto_create_namespace:
if args.namespace or args.auto_create_namespace or args.auto_create_namespace_all_clusters:
namespace_meta = bindings.v1WorkspaceNamespaceMeta(
namespace=requested_namespace,
namespace=args.namespace,
autoCreateNamespace=args.auto_create_namespace,
autoCreateNamespaceAllClusters=args.auto_create_namespace_all_clusters,
)
Expand All @@ -281,7 +279,7 @@ def create_workspace(args: argparse.Namespace) -> None:
else:
render_workspaces([w])

if resp.namespaceBindings:
for cluster_name in resp.namespaceBindings:
namespace_binding = resp.namespaceBindings[cluster_name]
print(f"Workspace {w.name} is bound to namespace {namespace_binding.namespace}")

Expand Down
6 changes: 3 additions & 3 deletions harness/determined/common/api/bindings.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6e3c5d4

Please sign in to comment.