diff --git a/go.mod b/go.mod index 7cea3921..2d733bf1 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,8 @@ module github.com/temporalio/cli -go 1.22.3 +go 1.22.6 + +toolchain go1.23.2 require ( github.com/alitto/pond v1.9.1 @@ -15,10 +17,10 @@ require ( github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.9.0 github.com/temporalio/ui-server/v2 v2.30.3 - go.temporal.io/api v1.38.0 - go.temporal.io/sdk v1.29.0 - go.temporal.io/server v1.25.0 - google.golang.org/grpc v1.65.0 + go.temporal.io/api v1.39.1-0.20241015190548-07c3704f5f12 + go.temporal.io/sdk v1.29.2-0.20241008230001-c82a8ac11cc6 + go.temporal.io/server v1.26.2-122.0.0.20241017144430-3615581c0cef + google.golang.org/grpc v1.66.0 google.golang.org/protobuf v1.34.2 gopkg.in/yaml.v3 v3.0.1 ) @@ -40,7 +42,7 @@ require ( github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/coreos/go-oidc/v3 v3.1.0 // indirect - github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect + github.com/dgryski/go-farm v0.0.0-20240924180020-3414d57e47da // indirect github.com/emirpasic/gods v1.18.1 // indirect github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a // indirect github.com/felixge/httpsnoop v1.0.4 // indirect @@ -81,7 +83,6 @@ require ( github.com/mattn/go-runewidth v0.0.15 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/ncruces/go-strftime v0.1.9 // indirect - github.com/nexus-rpc/sdk-go v0.0.10 // indirect github.com/olivere/elastic/v7 v7.0.32 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/pborman/uuid v1.2.1 // indirect @@ -124,6 +125,7 @@ require ( go.uber.org/atomic v1.11.0 // indirect go.uber.org/dig v1.17.1 // indirect go.uber.org/fx v1.22.0 // indirect + go.uber.org/mock v0.4.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect golang.org/x/crypto v0.26.0 // indirect @@ -136,8 +138,8 @@ require ( golang.org/x/time v0.5.0 // indirect google.golang.org/api v0.182.0 // indirect google.golang.org/genproto v0.0.0-20240528184218-531527333157 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect gopkg.in/go-jose/go-jose.v2 v2.6.3 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/square/go-jose.v2 v2.6.0 // indirect diff --git a/go.sum b/go.sum index 9d26c831..1836b7ca 100644 --- a/go.sum +++ b/go.sum @@ -61,8 +61,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgryski/go-farm v0.0.0-20140601200337-fc41e106ee0e/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= -github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dgryski/go-farm v0.0.0-20240924180020-3414d57e47da h1:aIftn67I1fkbMa512G+w+Pxci9hJPB8oMnkcP3iZF38= +github.com/dgryski/go-farm v0.0.0-20240924180020-3414d57e47da/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= @@ -348,12 +348,12 @@ go.opentelemetry.io/otel/trace v1.27.0 h1:IqYb813p7cmbHk0a5y6pD5JPakbVfftRXABGt5 go.opentelemetry.io/otel/trace v1.27.0/go.mod h1:6RiD1hkAprV4/q+yd2ln1HG9GoPx39SuvvstaLBl+l4= go.opentelemetry.io/proto/otlp v1.2.0 h1:pVeZGk7nXDC9O2hncA6nHldxEjm6LByfA2aN8IOkz94= go.opentelemetry.io/proto/otlp v1.2.0/go.mod h1:gGpR8txAl5M03pDhMC79G6SdqNV26naRm/KDsgaHD8A= -go.temporal.io/api v1.38.0 h1:L5i+Ai7UoBa2Gq/goVHLY32064AgawxPDLkKm4I7fu4= -go.temporal.io/api v1.38.0/go.mod h1:fmh06EjstyrPp6SHbjJo7yYHBfHamPE4SytM+2NRejc= -go.temporal.io/sdk v1.29.0 h1:AHObeNFFxVlnaj7jql3Bjd4B0bMBaXkywJU0uVIPgJo= -go.temporal.io/sdk v1.29.0/go.mod h1:kp//DRvn3CqQVBCtjL51Oicp9wrZYB2s6row1UgzcKQ= -go.temporal.io/server v1.25.0 h1:HwP7musDblTbobv8727t5riWB5T1UKqUZBLmIrWFwF8= -go.temporal.io/server v1.25.0/go.mod h1:+8eYt3bSdHzPDMyEW3RgtsbAJRblhUEH0PVRSPiMyUs= +go.temporal.io/api v1.39.1-0.20241015190548-07c3704f5f12 h1:/NVYBOJEDAShJ0cJFgESDy9w1XjhJyrg3+L91SOXwAc= +go.temporal.io/api v1.39.1-0.20241015190548-07c3704f5f12/go.mod h1:1WwYUMo6lao8yl0371xWUm13paHExN5ATYT/B7QtFis= +go.temporal.io/sdk v1.29.2-0.20241008230001-c82a8ac11cc6 h1:SlZapy1jTeSDEL/0WxKyp2Jw7i/GxdFtqVm1YeQ2tzY= +go.temporal.io/sdk v1.29.2-0.20241008230001-c82a8ac11cc6/go.mod h1:R52PRhHZMkHJqrWRPBom0UAqcexPUvDpcf0qbAGwLos= +go.temporal.io/server v1.26.2-122.0.0.20241017144430-3615581c0cef h1:vIbwm1Op+dHIe1zHFV/RtSSCcrN23ZIiTnRZKcMFQGI= +go.temporal.io/server v1.26.2-122.0.0.20241017144430-3615581c0cef/go.mod h1:30kg/Vf1w5iDWCPzapzUYU/5LkEuOneE4Rg/r6a+qMA= go.temporal.io/version v0.3.0 h1:dMrei9l9NyHt8nG6EB8vAwDLLTwx2SvRyucCSumAiig= go.temporal.io/version v0.3.0/go.mod h1:UA9S8/1LaKYae6TyD9NaPMJTZb911JcbqghI2CBSP78= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= @@ -367,6 +367,8 @@ go.uber.org/fx v1.22.0/go.mod h1:HT2M7d7RHo+ebKGh9NRcrsrHHfpZ60nW3QRubMRfv48= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= @@ -527,18 +529,18 @@ google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20240528184218-531527333157 h1:u7WMYrIrVvs0TF5yaKwKNbcJyySYf+HAIFXxWltJOXE= google.golang.org/genproto v0.0.0-20240528184218-531527333157/go.mod h1:ubQlAQnzejB8uZzszhrTCU2Fyp6Vi7ZE5nn0c3W8+qQ= -google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd h1:BBOTEWLuuEGQy9n1y9MhVJ9Qt0BDu21X8qZs71/uPZo= -google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:fO8wJzT2zbQbAjbIoos1285VfEIYKDDY+Dt+WpTkh6g= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 h1:hjSy6tcFQZ171igDaN5QHOw2n6vx40juYbC/x67CEhc= +google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:qpvKtACPCQhAdu3PyQgV4l3LMXZEtft7y8QcarRsp9I= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/temporalcli/commands.activity.go b/temporalcli/commands.activity.go index 6750d0b8..c61cfcc6 100644 --- a/temporalcli/commands.activity.go +++ b/temporalcli/commands.activity.go @@ -3,9 +3,13 @@ package temporalcli import ( "fmt" + activitypb "go.temporal.io/api/activity/v1" "go.temporal.io/api/common/v1" "go.temporal.io/api/failure/v1" + taskqueuepn "go.temporal.io/api/taskqueue/v1" "go.temporal.io/api/workflowservice/v1" + "google.golang.org/protobuf/types/known/durationpb" + "google.golang.org/protobuf/types/known/fieldmaskpb" ) func (c *TemporalActivityCompleteCommand) run(cctx *CommandContext, args []string) error { @@ -70,3 +74,83 @@ func (c *TemporalActivityFailCommand) run(cctx *CommandContext, args []string) e } return nil } + +func (c *TemporalActivityUpdateOptionsCommand) run(cctx *CommandContext, args []string) error { + cl, err := c.Parent.ClientOptions.dialClient(cctx) + if err != nil { + return err + } + defer cl.Close() + + updatePath := []string{} + activityOptions := &activitypb.ActivityOptions{} + + if c.Command.Flags().Changed(ActivityOptionsTaskQueueNameCommand) { + activityOptions.TaskQueue = &taskqueuepn.TaskQueue{Name: c.TaskQueueName} + updatePath = append(updatePath, "task_queue_name") + } + + if c.Command.Flags().Changed(ActivityOptionsScheduleToCloseTimeout) { + activityOptions.ScheduleToCloseTimeout = durationpb.New(c.ScheduleToCloseTimeout.Duration()) + updatePath = append(updatePath, "schedule_to_close_timeout") + } + + if c.Command.Flags().Changed(ActivityOptionsStartToCloseTimeout) { + activityOptions.ScheduleToStartTimeout = durationpb.New(c.ScheduleToStartTimeout.Duration()) + updatePath = append(updatePath, "schedule_to_start_timeout") + } + + if c.Command.Flags().Changed(ActivityOptionsStartToCloseTimeout) { + activityOptions.StartToCloseTimeout = durationpb.New(c.StartToCloseTimeout.Duration()) + updatePath = append(updatePath, "start_to_close_timeout") + } + + if c.Command.Flags().Changed(ActivityOptionsHeartbeatTimeout) { + activityOptions.HeartbeatTimeout = durationpb.New(c.HeartbeatTimeout.Duration()) + updatePath = append(updatePath, "heartbeat_timeout") + } + + if c.Command.Flags().Changed(ActivityOptionsRetryInitialInterval) || + c.Command.Flags().Changed(ActivityOptionsRetryMaximumInterval) || + c.Command.Flags().Changed(ActivityOptionsRetryBackoffCoefficient) || + c.Command.Flags().Changed(ActivityOptionsRetryMaximumAttempts) { + activityOptions.RetryPolicy = &common.RetryPolicy{} + } + + if c.Command.Flags().Changed(ActivityOptionsRetryInitialInterval) { + activityOptions.RetryPolicy.InitialInterval = durationpb.New(c.RetryInitialInterval.Duration()) + updatePath = append(updatePath, "retry_policy.initial_interval") + } + + if c.Command.Flags().Changed(ActivityOptionsRetryMaximumInterval) { + activityOptions.RetryPolicy.MaximumInterval = durationpb.New(c.RetryMaximumInterval.Duration()) + updatePath = append(updatePath, "retry_policy.maximum_interval") + } + + if c.Command.Flags().Changed(ActivityOptionsRetryBackoffCoefficient) { + activityOptions.RetryPolicy.BackoffCoefficient = c.RetryBackoffCoefficient + updatePath = append(updatePath, "retry_policy.backoff_coefficient") + } + + if c.Command.Flags().Changed(ActivityOptionsRetryMaximumAttempts) { + activityOptions.RetryPolicy.MaximumAttempts = c.RetryMaximumAttempts + updatePath = append(updatePath, "retry_policy.maximum_attempts") + } + + _, err = cl.WorkflowService().UpdateActivityOptionsById(cctx, &workflowservice.UpdateActivityOptionsByIdRequest{ + Namespace: c.Parent.Namespace, + WorkflowId: c.WorkflowId, + RunId: c.RunId, + ActivityId: c.ActivityId, + ActivityOptions: activityOptions, + UpdateMask: &fieldmaskpb.FieldMask{ + Paths: updatePath, + }, + + Identity: c.Identity, + }) + if err != nil { + return fmt.Errorf("unable to update Activity options: %w", err) + } + return nil +} diff --git a/temporalcli/commands.activity_test.go b/temporalcli/commands.activity_test.go index c5c11da6..9e06d379 100644 --- a/temporalcli/commands.activity_test.go +++ b/temporalcli/commands.activity_test.go @@ -106,6 +106,43 @@ func (s *SharedServerSuite) TestActivity_Fail_InvalidDetail() { s.Nil(failed) } +func (s *SharedServerSuite) TestActivityOptionsUpdate_Accept() { + run := s.waitActivityStarted() + wid := run.GetID() + aid := "dev-activity-id" + identity := "MyIdentity" + //ActivityOptionsTaskQueueNameCommand = "task-queue" + //ActivityOptionsScheduleToCloseTimeout = "schedule-to-close-timeout" + //ActivityOptionsScheduleToStartTimeout = "schedule-to-start-timeout" + //ActivityOptionsStartToCloseTimeout = "start-to-close-timeout" + //ActivityOptionsHeartbeatTimeout = "heartbeat-timeout" + // + //ActivityOptionsRetryInitialInterval = "retry-initial-interval" + //ActivityOptionsRetryMaximumInterval = "retry-maximum-interval" + //ActivityOptionsRetryBackoffCoefficient = "retry-backoff-coefficient" + //ActivityOptionsRetryMaximumAttempts = "retry-maximum-attempts" + // + + res := s.Execute( + "activity", "update", + "--activity-id", aid, + "--workflow-id", wid, + "--run-id", run.GetRunID(), + "--identity", identity, + "--task-queue", "new-task-queue", + "--schedule-to-close-timeout", "60", + "--schedule-to-start-timeout", "5", + "--start-to-close-timeout", "10", + "--heartbeat-timeout", "20", + "--retry-initial-interval", "5", + "--retry-maximum-interval", "60", + "--retry-backoff-coefficient", "2", + "--retry-maximum-attempts", "5", + ) + // atm, the command is not implemented + s.Error(res.Err) +} + // Test helpers func (s *SharedServerSuite) waitActivityStarted() client.WorkflowRun { diff --git a/temporalcli/commands.gen.go b/temporalcli/commands.gen.go index a56d6d3c..732abf8a 100644 --- a/temporalcli/commands.gen.go +++ b/temporalcli/commands.gen.go @@ -3,15 +3,14 @@ package temporalcli import ( + "os" + "time" + "github.com/mattn/go-isatty" "github.com/spf13/cobra" "github.com/spf13/pflag" - - "os" - - "time" ) var hasHighlighting = isatty.IsTerminal(os.Stdout.Fd()) @@ -290,6 +289,7 @@ func NewTemporalCommand(cctx *CommandContext) *TemporalCommand { } s.Command.Args = cobra.NoArgs s.Command.AddCommand(&NewTemporalActivityCommand(cctx, &s).Command) + s.Command.AddCommand(&NewTemporalActivityApiCommand(cctx, &s).Command) s.Command.AddCommand(&NewTemporalBatchCommand(cctx, &s).Command) s.Command.AddCommand(&NewTemporalEnvCommand(cctx, &s).Command) s.Command.AddCommand(&NewTemporalOperatorCommand(cctx, &s).Command) @@ -322,6 +322,22 @@ type TemporalActivityCommand struct { ClientOptions } +func NewTemporalActivityApiCommand(cctx *CommandContext, parent *TemporalCommand) *TemporalActivityCommand { + var s TemporalActivityCommand + s.Parent = parent + s.Command.Use = "activity" + s.Command.Short = "Activity API" + if hasHighlighting { + s.Command.Long = "Activity API commands. " + } else { + s.Command.Long = "Activity API commands." + } + s.Command.Args = cobra.NoArgs + s.Command.AddCommand(&NewTemporalActivityUpdateOptionsCommand(cctx, &s).Command) + s.ClientOptions.buildFlags(cctx, s.Command.PersistentFlags()) + return &s +} + func NewTemporalActivityCommand(cctx *CommandContext, parent *TemporalCommand) *TemporalActivityCommand { var s TemporalActivityCommand s.Parent = parent @@ -410,6 +426,86 @@ func NewTemporalActivityFailCommand(cctx *CommandContext, parent *TemporalActivi return &s } +type ActivityOptions struct { + TaskQueueName string + ScheduleToCloseTimeout Duration + ScheduleToStartTimeout Duration + StartToCloseTimeout Duration + HeartbeatTimeout Duration + + RetryInitialInterval Duration + RetryMaximumInterval Duration + RetryBackoffCoefficient float64 + RetryMaximumAttempts int32 +} + +const ( + ActivityOptionsTaskQueueNameCommand = "task-queue" + ActivityOptionsScheduleToCloseTimeout = "schedule-to-close-timeout" + ActivityOptionsScheduleToStartTimeout = "schedule-to-start-timeout" + ActivityOptionsStartToCloseTimeout = "start-to-close-timeout" + ActivityOptionsHeartbeatTimeout = "heartbeat-timeout" + + ActivityOptionsRetryInitialInterval = "retry-initial-interval" + ActivityOptionsRetryMaximumInterval = "retry-maximum-interval" + ActivityOptionsRetryBackoffCoefficient = "retry-backoff-coefficient" + ActivityOptionsRetryMaximumAttempts = "retry-maximum-attempts" +) + +func (v *ActivityOptions) buildFlags(cctx *CommandContext, f *pflag.FlagSet) { + f.StringVarP(&v.TaskQueueName, ActivityOptionsTaskQueueNameCommand, "t", "", "Workflow Task queue name. ") + + f.Var(&v.ScheduleToCloseTimeout, ActivityOptionsScheduleToCloseTimeout, "Indicates how long the caller is willing to wait for an activity completion. Limits how long retries will be attempted.") + f.Var(&v.ScheduleToStartTimeout, ActivityOptionsScheduleToStartTimeout, "Limits time an activity task can stay in a task queue before a worker picks it up. This timeout is always non retryable.") + f.Var(&v.StartToCloseTimeout, ActivityOptionsStartToCloseTimeout, ".") + f.Var(&v.HeartbeatTimeout, ActivityOptionsHeartbeatTimeout, ".") + + f.Var(&v.RetryInitialInterval, ActivityOptionsRetryInitialInterval, ".") + f.Var(&v.RetryMaximumInterval, ActivityOptionsRetryMaximumInterval, ".") + + f.Float64Var(&v.RetryBackoffCoefficient, ActivityOptionsRetryBackoffCoefficient, 1.0, ".") + f.Int32Var(&v.RetryMaximumAttempts, ActivityOptionsRetryMaximumAttempts, 1, ".") +} + +type TemporalActivityUpdateOptionsCommand struct { + Parent *TemporalActivityCommand + Command cobra.Command + WorkflowReferenceOptions + + ActivityId string + Identity string + + ActivityOptions +} + +func NewTemporalActivityUpdateOptionsCommand(cctx *CommandContext, parent *TemporalActivityCommand) *TemporalActivityUpdateOptionsCommand { + var s TemporalActivityUpdateOptionsCommand + s.Parent = parent + s.Command.DisableFlagsInUseLine = true + s.Command.Use = "fail [flags]" + s.Command.Short = "Update Activity Options" + if hasHighlighting { + s.Command.Long = "Update activity options. Specify the\nActivity and Workflow IDs:\n\n\x1b[1mtemporal activity update \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\x1b[0m" + } else { + s.Command.Long = "Update activity options. Specify the\nActivity and Workflow IDs:\n\n```\ntemporal activity update \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\n```" + } + s.Command.Args = cobra.NoArgs + s.Command.Flags().StringVar(&s.ActivityId, "activity-id", "", "Activity ID to update. Required.") + _ = cobra.MarkFlagRequired(s.Command.Flags(), "activity-id") + + s.Command.Flags().StringVar(&s.Identity, "identity", "", "Identity of the user submitting this request.") + + s.WorkflowReferenceOptions.buildFlags(cctx, s.Command.Flags()) + s.ActivityOptions.buildFlags(cctx, s.Command.Flags()) + + s.Command.Run = func(c *cobra.Command, args []string) { + if err := s.run(cctx, args); err != nil { + cctx.Options.Fail(err) + } + } + return &s +} + type TemporalBatchCommand struct { Parent *TemporalCommand Command cobra.Command @@ -1561,9 +1657,16 @@ func NewTemporalScheduleToggleCommand(cctx *CommandContext, parent *TemporalSche s.Command.Use = "toggle [flags]" s.Command.Short = "Pause or unpause a Schedule" if hasHighlighting { - s.Command.Long = "Pause or unpause a Schedule by passing a flag with your desired state:\n\n\x1b[1mtemporal schedule toggle \\\n --schedule-id \"YourScheduleId\" \\\n --pause \\\n --reason \"YourReason\"\x1b[0m\n\nand\n\n\x1b[1mtemporal schedule toggle\n --schedule-id \"YourScheduleId\" \\\n --unpause \\\n --reason \"YourReason\"\x1b[0m\n\nThe \x1b[1m--reason\x1b[0m text updates the Schedule's \x1b[1mnotes\x1b[0m field for operations\ncommunication. It defaults to \"(no reason provided)\" if omitted. This field is\nalso visible on the Service Web UI." + s.Command.Long = "Pause or unpause a Schedule by passing a flag with your desired state:\n\n\x1b[1mtemporal schedule toggle \\\n " + + "--schedule-id \"YourScheduleId\" \\\n " + + "--pause \\\n " + + "--reason \"YourReason\"\x1b[0m\n\nand\n\n\x1b[1mtemporal schedule toggle\n " + + "--schedule-id \"YourScheduleId\" \\\n --unpause \\\n --reason \"YourReason\"\x1b[0m\n\nThe \x1b[1m--reason\x1b[0m text updates the Schedule's \x1b[1mnotes\x1b[0m field for operations\ncommunication. It defaults to \"(no reason provided)\" if omitted. This field is\nalso visible on the Service Web UI." } else { - s.Command.Long = "Pause or unpause a Schedule by passing a flag with your desired state:\n\n```\ntemporal schedule toggle \\\n --schedule-id \"YourScheduleId\" \\\n --pause \\\n --reason \"YourReason\"\n```\n\nand\n\n```\ntemporal schedule toggle\n --schedule-id \"YourScheduleId\" \\\n --unpause \\\n --reason \"YourReason\"\n```\n\nThe `--reason` text updates the Schedule's `notes` field for operations\ncommunication. It defaults to \"(no reason provided)\" if omitted. This field is\nalso visible on the Service Web UI." + s.Command.Long = "Pause or unpause a Schedule by passing a flag with your desired state:\n\n```\ntemporal schedule toggle \\\n " + + " --schedule-id \"YourScheduleId\" \\\n " + + "--pause \\\n --reason \"YourReason\"\n```\n\nand\n\n```\ntemporal schedule toggle\n " + + "--schedule-id \"YourScheduleId\" \\\n --unpause \\\n --reason \"YourReason\"\n```\n\nThe `--reason` text updates the Schedule's `notes` field for operations\ncommunication. It defaults to \"(no reason provided)\" if omitted. This field is\nalso visible on the Service Web UI." } s.Command.Args = cobra.NoArgs s.Command.Flags().BoolVar(&s.Pause, "pause", false, "Pause the Schedule.") diff --git a/temporalcli/devserver/server.go b/temporalcli/devserver/server.go index 60effbb4..90bb138d 100644 --- a/temporalcli/devserver/server.go +++ b/temporalcli/devserver/server.go @@ -340,7 +340,11 @@ func (s *StartOptions) buildSQLConfig() (*config.SQL, error) { // Create namespaces namespaces := make([]*sqliteschema.NamespaceConfig, len(s.Namespaces)) for i, ns := range s.Namespaces { - namespaces[i] = sqlite.NewNamespaceConfig(s.CurrentClusterName, ns, false) + namespaceConfig, err := sqlite.NewNamespaceConfig(s.CurrentClusterName, ns, false, nil) + if err != nil { + return nil, fmt.Errorf("failed getting namespace config: %w", err) + } + namespaces[i] = namespaceConfig } if err := sqliteschema.CreateNamespaces(&conf, namespaces...); err != nil { return nil, fmt.Errorf("failed creating namespaces: %w", err)