Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vtctld] Add v0 GetWorkflows rpc and workflow/vexec packages #7575

Merged
merged 20 commits into from
Mar 4, 2021
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
59b1a2c
Organize vtctldata.proto and regenerate
ajm188 Feb 23, 2021
d0fdcca
wip - add `GetWorkflows` rpc, with some TODOs for later, and generate…
ajm188 Feb 23, 2021
0680c19
wip - first stab at a workflow/vexec API outside of wrangler
ajm188 Feb 27, 2021
bf9a306
wip - move some files around, trying to get closer to good boundaries
ajm188 Feb 27, 2021
40b8fef
wip - add workflow.Manager to VtctldServer, add CLI entrypoint
ajm188 Feb 27, 2021
2ccf392
[vtctl/workflow] wip - touch up error handling, add more designy comm…
ajm188 Feb 27, 2021
62f825b
[vtctl/workflow] - wip, allow threading a workflow through VExec
ajm188 Feb 27, 2021
52d4a09
[vtctl/vexec] wip - set timeouts on topo calls
ajm188 Feb 27, 2021
3381daf
[vexec] wip - thread workflow name through to QueryPlan, update error…
ajm188 Feb 27, 2021
5153020
[vexec] wip - add support for planning updates/deletes in vrep
ajm188 Feb 28, 2021
77868fc
[vexec] wip - move error definitions to files that use them most, gro…
ajm188 Feb 28, 2021
6c9dfd0
[wrangler] wip - rewrite ListAllWorkflows in wrangler to use new vexec
ajm188 Feb 28, 2021
630c037
[vexec] refactors and all the docs
ajm188 Feb 28, 2021
ed6136b
[vexec] Move QueryPlan and methods to its own file
ajm188 Feb 28, 2021
e2fda5c
[vexec] Add VReplicationQueryPlanner tests
ajm188 Mar 1, 2021
105160f
[vexec] Add tests for QueryPlans
ajm188 Mar 1, 2021
8b49191
[workflow] Document Manager, sort of
ajm188 Mar 1, 2021
358cfa3
[workflow] Rename, I decided I dislike "Server" slightly less as a ge…
ajm188 Mar 1, 2021
098ac4f
[workflow] Rename `(Shard)ReplicationStatus` => `(Shard)Stream`
ajm188 Mar 2, 2021
30f4750
fix typo
ajm188 Mar 4, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions go/cmd/vtctldclient/internal/command/workflows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
Copyright 2021 The Vitess Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package command

import (
"fmt"

"github.com/spf13/cobra"

"vitess.io/vitess/go/cmd/vtctldclient/cli"

vtctldatapb "vitess.io/vitess/go/vt/proto/vtctldata"
)

var (
// GetWorkflows makes a GetWorkflows gRPC call to a vtctld.
GetWorkflows = &cobra.Command{
Use: "GetWorkflows <keyspace>",
Args: cobra.ExactArgs(1),
RunE: commandGetWorkflows,
}
)

var getWorkflowsOptions = struct {
ShowAll bool
}{}

func commandGetWorkflows(cmd *cobra.Command, args []string) error {
cli.FinishedParsing(cmd)

ks := cmd.Flags().Arg(0)

resp, err := client.GetWorkflows(commandCtx, &vtctldatapb.GetWorkflowsRequest{
Keyspace: ks,
ActiveOnly: !getWorkflowsOptions.ShowAll,
})

if err != nil {
return err
}

data, err := cli.MarshalJSON(resp)
if err != nil {
return err
}

fmt.Printf("%s\n", data)

return nil
}

func init() {
GetWorkflows.Flags().BoolVarP(&getWorkflowsOptions.ShowAll, "show-all", "a", false, "Show all workflows instead of just active workflows")
Root.AddCommand(GetWorkflows)
}
2 changes: 1 addition & 1 deletion go/vt/proto/topodata/topodata.pb.go

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

Loading