Skip to content

Commit

Permalink
fix: remove extra quotes around IdentifyTask (#8792)
Browse files Browse the repository at this point in the history
  • Loading branch information
carolinaecalderon committed Feb 7, 2024
1 parent 3805ebd commit 56e7000
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
6 changes: 6 additions & 0 deletions docs/release-notes/identify-task.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
:orphan:

**Bug Fixes**

- TensorBoard: For TensorBoard task types, fix a bug that would allow users to view TensorBoards,
even if they did not have permission to view the all workspaces it included.
4 changes: 1 addition & 3 deletions master/internal/command/postgres_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ func IdentifyTask(ctx context.Context, taskID model.TaskID) (TaskMetadata, error
metadata := TaskMetadata{}
if err := db.Bun().NewSelect().Model(&metadata).
ColumnExpr("generic_command_spec->'Metadata'->'workspace_id' AS workspace_id").
// TODO(DET-10004) TaskType needs
// to have ->> instead of -> so task_type doesn't get surrounded by double quotes.
ColumnExpr("generic_command_spec->'TaskType' as task_type").
ColumnExpr("generic_command_spec->>'TaskType' as task_type").
ColumnExpr("generic_command_spec->'Metadata'->'experiment_ids' as experiment_ids").
ColumnExpr("generic_command_spec->'Metadata'->'trial_ids' as trial_ids").
Where("task_id = ?", taskID).
Expand Down
9 changes: 3 additions & 6 deletions master/internal/command/postgres_command_intg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package command

import (
"context"
"fmt"
"log"
"os"
"testing"
Expand Down Expand Up @@ -67,8 +66,7 @@ func TestIdentifyTask(t *testing.T) {
require.NoError(t, err)
require.Equal(t, TaskMetadata{
WorkspaceID: 1,
// TODO(DET-10004) remove these double quotes.
TaskType: model.TaskType(fmt.Sprintf(`"%s"`, model.TaskTypeCommand)),
TaskType: model.TaskTypeCommand,
}, meta)

// Tensorboard.
Expand All @@ -84,9 +82,8 @@ func TestIdentifyTask(t *testing.T) {
meta, err = IdentifyTask(ctx, tensorboardID)
require.NoError(t, err)
require.Equal(t, TaskMetadata{
WorkspaceID: 1,
// TODO(DET-10004) remove these double quotes.
TaskType: model.TaskType(fmt.Sprintf(`"%s"`, model.TaskTypeTensorboard)),
WorkspaceID: 1,
TaskType: model.TaskTypeTensorboard,
ExperimentIDs: []int32{int32(expIDs[0]), int32(expIDs[1])},
TrialIDs: []int32{int32(trialIDs[0]), int32(trialIDs[1])},
}, meta)
Expand Down

0 comments on commit 56e7000

Please sign in to comment.