-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add command infra endpoints (#986)
- Loading branch information
Yoni Ben-tzur
authored
Jul 31, 2020
1 parent
b23fa52
commit 913fdc3
Showing
27 changed files
with
858 additions
and
122 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
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,29 @@ | ||
package internal | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/determined-ai/determined/proto/pkg/apiv1" | ||
) | ||
|
||
func (a *apiServer) GetCommands( | ||
_ context.Context, req *apiv1.GetCommandsRequest, | ||
) (resp *apiv1.GetCommandsResponse, err error) { | ||
err = a.actorRequest("/commands", req, &resp) | ||
if err != nil { | ||
return nil, err | ||
} | ||
a.sort(resp.Commands, req.OrderBy, req.SortBy, apiv1.GetCommandsRequest_SORT_BY_ID) | ||
return resp, a.paginate(&resp.Pagination, &resp.Commands, req.Offset, req.Limit) | ||
} | ||
|
||
func (a *apiServer) GetCommand( | ||
_ context.Context, req *apiv1.GetCommandRequest) (resp *apiv1.GetCommandResponse, err error) { | ||
return resp, a.actorRequest(fmt.Sprintf("/commands/%s", req.CommandId), req, &resp) | ||
} | ||
|
||
func (a *apiServer) KillCommand( | ||
_ context.Context, req *apiv1.KillCommandRequest) (resp *apiv1.KillCommandResponse, err error) { | ||
return resp, a.actorRequest(fmt.Sprintf("/commands/%s", req.CommandId), req, &resp) | ||
} |
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,29 @@ | ||
package internal | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/determined-ai/determined/proto/pkg/apiv1" | ||
) | ||
|
||
func (a *apiServer) GetNotebooks( | ||
_ context.Context, req *apiv1.GetNotebooksRequest, | ||
) (resp *apiv1.GetNotebooksResponse, err error) { | ||
err = a.actorRequest("/notebooks", req, &resp) | ||
if err != nil { | ||
return nil, err | ||
} | ||
a.sort(resp.Notebooks, req.OrderBy, req.SortBy, apiv1.GetNotebooksRequest_SORT_BY_ID) | ||
return resp, a.paginate(&resp.Pagination, &resp.Notebooks, req.Offset, req.Limit) | ||
} | ||
|
||
func (a *apiServer) GetNotebook( | ||
_ context.Context, req *apiv1.GetNotebookRequest) (resp *apiv1.GetNotebookResponse, err error) { | ||
return resp, a.actorRequest(fmt.Sprintf("/notebooks/%s", req.NotebookId), req, &resp) | ||
} | ||
|
||
func (a *apiServer) KillNotebook( | ||
_ context.Context, req *apiv1.KillNotebookRequest) (resp *apiv1.KillNotebookResponse, err error) { | ||
return resp, a.actorRequest(fmt.Sprintf("/notebooks/%s", req.NotebookId), req, &resp) | ||
} |
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,29 @@ | ||
package internal | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/determined-ai/determined/proto/pkg/apiv1" | ||
) | ||
|
||
func (a *apiServer) GetShells( | ||
_ context.Context, req *apiv1.GetShellsRequest, | ||
) (resp *apiv1.GetShellsResponse, err error) { | ||
err = a.actorRequest("/shells", req, &resp) | ||
if err != nil { | ||
return nil, err | ||
} | ||
a.sort(resp.Shells, req.OrderBy, req.SortBy, apiv1.GetShellsRequest_SORT_BY_ID) | ||
return resp, a.paginate(&resp.Pagination, &resp.Shells, req.Offset, req.Limit) | ||
} | ||
|
||
func (a *apiServer) GetShell( | ||
_ context.Context, req *apiv1.GetShellRequest) (resp *apiv1.GetShellResponse, err error) { | ||
return resp, a.actorRequest(fmt.Sprintf("/shells/%s", req.ShellId), req, &resp) | ||
} | ||
|
||
func (a *apiServer) KillShell( | ||
_ context.Context, req *apiv1.KillShellRequest) (resp *apiv1.KillShellResponse, err error) { | ||
return resp, a.actorRequest(fmt.Sprintf("/shells/%s", req.ShellId), req, &resp) | ||
} |
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,31 @@ | ||
package internal | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/determined-ai/determined/proto/pkg/apiv1" | ||
) | ||
|
||
func (a *apiServer) GetTensorboards( | ||
_ context.Context, req *apiv1.GetTensorboardsRequest, | ||
) (resp *apiv1.GetTensorboardsResponse, err error) { | ||
err = a.actorRequest("/tensorboards", req, &resp) | ||
if err != nil { | ||
return nil, err | ||
} | ||
a.sort(resp.Tensorboards, req.OrderBy, req.SortBy, apiv1.GetTensorboardsRequest_SORT_BY_ID) | ||
return resp, a.paginate(&resp.Pagination, &resp.Tensorboards, req.Offset, req.Limit) | ||
} | ||
|
||
func (a *apiServer) GetTensorboard( | ||
_ context.Context, req *apiv1.GetTensorboardRequest, | ||
) (resp *apiv1.GetTensorboardResponse, err error) { | ||
return resp, a.actorRequest(fmt.Sprintf("/tensorboards/%s", req.TensorboardId), req, &resp) | ||
} | ||
|
||
func (a *apiServer) KillTensorboard( | ||
_ context.Context, req *apiv1.KillTensorboardRequest, | ||
) (resp *apiv1.KillTensorboardResponse, err error) { | ||
return resp, a.actorRequest(fmt.Sprintf("/tensorboards/%s", req.TensorboardId), req, &resp) | ||
} |
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
Oops, something went wrong.