From f4edc7a13f1da74c0e361fa5de349ac06044d2a6 Mon Sep 17 00:00:00 2001 From: Yuri Date: Fri, 13 Dec 2024 13:42:24 -0800 Subject: [PATCH 1/4] CLI comamnd for UpdateActivityOptions API --- go.mod | 24 ++--- go.sum | 56 +++++------ temporalcli/commands.activity.go | 128 ++++++++++++++++++++++++++ temporalcli/commands.activity_test.go | 75 +++++++++++++++ temporalcli/commands.gen.go | 63 ++++++++++++- temporalcli/commandsgen/commands.yml | 98 +++++++++++++++++++- 6 files changed, 397 insertions(+), 47 deletions(-) diff --git a/go.mod b/go.mod index 70a7d0a1..f42de923 100644 --- a/go.mod +++ b/go.mod @@ -9,15 +9,15 @@ require ( github.com/fatih/color v1.17.0 github.com/google/uuid v1.6.0 github.com/mattn/go-isatty v0.0.20 - github.com/nexus-rpc/sdk-go v0.0.10 + github.com/nexus-rpc/sdk-go v0.0.12 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.8.1 github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.9.0 github.com/temporalio/ui-server/v2 v2.31.2 - go.temporal.io/api v1.41.1-0.20241106230151-fd920b39031f - go.temporal.io/sdk v1.29.2-0.20241008230001-c82a8ac11cc6 - go.temporal.io/server v1.26.2-124.0 + go.temporal.io/api v1.43.0 + go.temporal.io/sdk v1.30.1 + go.temporal.io/server v1.26.2-125.1 google.golang.org/grpc v1.67.1 google.golang.org/protobuf v1.35.1 gopkg.in/yaml.v3 v3.0.1 @@ -100,7 +100,7 @@ require ( github.com/sirupsen/logrus v1.9.3 // indirect github.com/sony/gobreaker v1.0.0 // indirect github.com/stretchr/objx v0.5.2 // indirect - github.com/temporalio/ringpop-go v0.0.0-20240718232345-e2a435d149b6 // indirect + github.com/temporalio/ringpop-go v0.0.0-20241119001152-e505ebd8f887 // indirect github.com/temporalio/sqlparser v0.0.0-20231115171017-f4060bcfa6cb // indirect github.com/temporalio/tchannel-go v1.22.1-0.20240528171429-1db37fdea938 // indirect github.com/twmb/murmur3 v1.1.8 // indirect @@ -128,13 +128,13 @@ require ( 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.28.0 // indirect + golang.org/x/crypto v0.29.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect - golang.org/x/net v0.30.0 // indirect + golang.org/x/net v0.31.0 // indirect golang.org/x/oauth2 v0.23.0 // indirect - golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.26.0 // indirect - golang.org/x/text v0.19.0 // indirect + golang.org/x/sync v0.9.0 // indirect + golang.org/x/sys v0.27.0 // indirect + golang.org/x/text v0.20.0 // indirect 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 @@ -145,10 +145,10 @@ require ( gopkg.in/square/go-jose.v2 v2.6.0 // indirect gopkg.in/validator.v2 v2.0.1 // indirect modernc.org/gc/v3 v3.0.0-20240304020402-f0dba7c97c2b // indirect - modernc.org/libc v1.50.9 // indirect + modernc.org/libc v1.55.3 // indirect modernc.org/mathutil v1.6.0 // indirect modernc.org/memory v1.8.0 // indirect - modernc.org/sqlite v1.30.0 // indirect + modernc.org/sqlite v1.34.1 // indirect modernc.org/strutil v1.2.0 // indirect modernc.org/token v1.1.0 // indirect ) diff --git a/go.sum b/go.sum index e362487c..f5a71b78 100644 --- a/go.sum +++ b/go.sum @@ -227,8 +227,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4= github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= -github.com/nexus-rpc/sdk-go v0.0.10 h1:7jEPUlsghxoD4OJ2H8YbFJ1t4wbxsUef7yZgBfyY3uA= -github.com/nexus-rpc/sdk-go v0.0.10/go.mod h1:TpfkM2Cw0Rlk9drGkoiSMpFqflKTiQLWUNyKJjF8mKQ= +github.com/nexus-rpc/sdk-go v0.0.12 h1:Bsjo3aKIaApgi/eohhzufwrAeK/sEphcbeZM1Z7S/nI= +github.com/nexus-rpc/sdk-go v0.0.12/go.mod h1:TpfkM2Cw0Rlk9drGkoiSMpFqflKTiQLWUNyKJjF8mKQ= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= @@ -299,8 +299,8 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/temporalio/ringpop-go v0.0.0-20240718232345-e2a435d149b6 h1:LnuIZntMSwZJS0O9b9bA+3iUL+Cwwhk+838PB04XLz4= -github.com/temporalio/ringpop-go v0.0.0-20240718232345-e2a435d149b6/go.mod h1:RE+CHmY+kOZQk47AQaVzwrGmxpflnLgTd6EOK0853j4= +github.com/temporalio/ringpop-go v0.0.0-20241119001152-e505ebd8f887 h1:08Y1jDl4UKVu+TiQHIVKcW6TKQaHl15vBKkcZ094/SA= +github.com/temporalio/ringpop-go v0.0.0-20241119001152-e505ebd8f887/go.mod h1:RE+CHmY+kOZQk47AQaVzwrGmxpflnLgTd6EOK0853j4= github.com/temporalio/sqlparser v0.0.0-20231115171017-f4060bcfa6cb h1:YzHH/U/dN7vMP+glybzcXRTczTrgfdRisNTzAj7La04= github.com/temporalio/sqlparser v0.0.0-20231115171017-f4060bcfa6cb/go.mod h1:143qKdh3G45IgV9p+gbAwp3ikRDI8mxsijFiXDfuxsw= github.com/temporalio/tchannel-go v1.22.1-0.20220818200552-1be8d8cffa5b/go.mod h1:c+V9Z/ZgkzAdyGvHrvC5AsXgN+M9Qwey04cBdKYzV7U= @@ -354,12 +354,12 @@ go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HY go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A= go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= -go.temporal.io/api v1.41.1-0.20241106230151-fd920b39031f h1:dJMVbAKIhAOYNixV9PgnVevYnFyTngW/uG7gY/SZYLA= -go.temporal.io/api v1.41.1-0.20241106230151-fd920b39031f/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-124.0 h1:IRYQKHLcgJUx8bj7XDeZ1OqrzrwcX+PyHwUhKhdCNcQ= -go.temporal.io/server v1.26.2-124.0/go.mod h1:yoVGtVx5B+lK8/+ayM3cRKM2qjGr4JgyWpB+XGAhfiU= +go.temporal.io/api v1.43.0 h1:lBhq+u5qFJqGMXwWsmg/i8qn1UA/3LCwVc88l2xUMHg= +go.temporal.io/api v1.43.0/go.mod h1:1WwYUMo6lao8yl0371xWUm13paHExN5ATYT/B7QtFis= +go.temporal.io/sdk v1.30.1 h1:4wgfSjwuaayQl9Q0mUzpNV6w55TPAESSroR6Z5lE49o= +go.temporal.io/sdk v1.30.1/go.mod h1:hNCZzd6dt7bxD9B4AECQgjHTd2NrzjdmGDbbv4xHuFU= +go.temporal.io/server v1.26.2-125.1 h1:3L1MKNa40TsH8Im/6HRUhM2+OHA0Wiq1nroJAtmTjLs= +go.temporal.io/server v1.26.2-125.1/go.mod h1:O/YgQ5G7zqnY9lwPyAEjxPzzMT8fHT8FAKUf1xn6GBc= 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= @@ -391,8 +391,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= -golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= -golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= +golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ= +golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -435,8 +435,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= -golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= +golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo= +golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= @@ -450,8 +450,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= -golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= +golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -477,8 +477,8 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= -golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= +golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= @@ -491,8 +491,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= -golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= +golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -584,18 +584,18 @@ gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -modernc.org/cc/v4 v4.21.2 h1:dycHFB/jDc3IyacKipCNSDrjIC0Lm1hyoWOZTRR20Lk= -modernc.org/cc/v4 v4.21.2/go.mod h1:HM7VJTZbUCR3rV8EYBi9wxnJ0ZBRiGE5OeGXNA0IsLQ= -modernc.org/ccgo/v4 v4.17.8 h1:yyWBf2ipA0Y9GGz/MmCmi3EFpKgeS7ICrAFes+suEbs= -modernc.org/ccgo/v4 v4.17.8/go.mod h1:buJnJ6Fn0tyAdP/dqePbrrvLyr6qslFfTbFrCuaYvtA= +modernc.org/cc/v4 v4.21.4 h1:3Be/Rdo1fpr8GrQ7IVw9OHtplU4gWbb+wNgeoBMmGLQ= +modernc.org/cc/v4 v4.21.4/go.mod h1:HM7VJTZbUCR3rV8EYBi9wxnJ0ZBRiGE5OeGXNA0IsLQ= +modernc.org/ccgo/v4 v4.19.2 h1:lwQZgvboKD0jBwdaeVCTouxhxAyN6iawF3STraAal8Y= +modernc.org/ccgo/v4 v4.19.2/go.mod h1:ysS3mxiMV38XGRTTcgo0DQTeTmAO4oCmJl1nX9VFI3s= modernc.org/fileutil v1.3.0 h1:gQ5SIzK3H9kdfai/5x41oQiKValumqNTDXMvKo62HvE= modernc.org/fileutil v1.3.0/go.mod h1:XatxS8fZi3pS8/hKG2GH/ArUogfxjpEKs3Ku3aK4JyQ= modernc.org/gc/v2 v2.4.1 h1:9cNzOqPyMJBvrUipmynX0ZohMhcxPtMccYgGOJdOiBw= modernc.org/gc/v2 v2.4.1/go.mod h1:wzN5dK1AzVGoH6XOzc3YZ+ey/jPgYHLuVckd62P0GYU= modernc.org/gc/v3 v3.0.0-20240304020402-f0dba7c97c2b h1:BnN1t+pb1cy61zbvSUV7SeI0PwosMhlAEi/vBY4qxp8= modernc.org/gc/v3 v3.0.0-20240304020402-f0dba7c97c2b/go.mod h1:Qz0X07sNOR1jWYCrJMEnbW/X55x206Q7Vt4mz6/wHp4= -modernc.org/libc v1.50.9 h1:hIWf1uz55lorXQhfoEoezdUHjxzuO6ceshET/yWjSjk= -modernc.org/libc v1.50.9/go.mod h1:15P6ublJ9FJR8YQCGy8DeQ2Uwur7iW9Hserr/T3OFZE= +modernc.org/libc v1.55.3 h1:AzcW1mhlPNrRtjS5sS+eW2ISCgSOLLNyFzRh/V3Qj/U= +modernc.org/libc v1.55.3/go.mod h1:qFXepLhz+JjFThQ4kzwzOjA/y/artDeg+pcYnY+Q83w= modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4= modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo= modernc.org/memory v1.8.0 h1:IqGTL6eFMaDZZhEWwcREgeMXYwmW83LYW8cROZYkg+E= @@ -604,8 +604,8 @@ modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4= modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= modernc.org/sortutil v1.2.0 h1:jQiD3PfS2REGJNzNCMMaLSp/wdMNieTbKX920Cqdgqc= modernc.org/sortutil v1.2.0/go.mod h1:TKU2s7kJMf1AE84OoiGppNHJwvB753OYfNl2WRb++Ss= -modernc.org/sqlite v1.30.0 h1:8YhPUs/HTnlEgErn/jSYQTwHN/ex8CjHHjg+K9iG7LM= -modernc.org/sqlite v1.30.0/go.mod h1:cgkTARJ9ugeXSNaLBPK3CqbOe7Ec7ZhWPoMFGldEYEw= +modernc.org/sqlite v1.34.1 h1:u3Yi6M0N8t9yKRDwhXcyp1eS5/ErhPTBggxWFuR6Hfk= +modernc.org/sqlite v1.34.1/go.mod h1:pXV2xHxhzXZsgT/RtTFAPY6JJDEvOTcTdwADQCCWD4k= modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA= modernc.org/strutil v1.2.0/go.mod h1:/mdcBmfOibveCTBxUl5B5l6W+TTH1FXPLHZE6bTosX0= modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= diff --git a/temporalcli/commands.activity.go b/temporalcli/commands.activity.go index 6750d0b8..bcf092d1 100644 --- a/temporalcli/commands.activity.go +++ b/temporalcli/commands.activity.go @@ -2,10 +2,32 @@ package temporalcli import ( "fmt" + "time" + "github.com/temporalio/cli/temporalcli/internal/printer" + activitypb "go.temporal.io/api/activity/v1" "go.temporal.io/api/common/v1" "go.temporal.io/api/failure/v1" + taskqueuepb "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" +) + +type ( + updateOptionsDescribe struct { + TaskQueue string + + ScheduleToCloseTimeout time.Duration + ScheduleToStartTimeout time.Duration + StartToCloseTimeout time.Duration + HeartbeatTimeout time.Duration + + InitialInterval time.Duration + BackoffCoefficient float64 + MaximumInterval time.Duration + MaximumAttempts int32 + } ) func (c *TemporalActivityCompleteCommand) run(cctx *CommandContext, args []string) error { @@ -70,3 +92,109 @@ 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("task-queue") { + activityOptions.TaskQueue = &taskqueuepb.TaskQueue{Name: c.TaskQueue} + updatePath = append(updatePath, "task_queue_name") + } + + if c.Command.Flags().Changed("schedule-to-close-timeout") { + activityOptions.ScheduleToCloseTimeout = durationpb.New(c.ScheduleToCloseTimeout.Duration()) + updatePath = append(updatePath, "schedule_to_close_timeout") + } + + if c.Command.Flags().Changed("schedule-to-start-timeout") { + activityOptions.ScheduleToStartTimeout = durationpb.New(c.ScheduleToStartTimeout.Duration()) + updatePath = append(updatePath, "schedule_to_start_timeout") + } + + if c.Command.Flags().Changed("start-to-close-timeout") { + activityOptions.StartToCloseTimeout = durationpb.New(c.StartToCloseTimeout.Duration()) + updatePath = append(updatePath, "start_to_close_timeout") + } + + if c.Command.Flags().Changed("heartbeat-timeout") { + activityOptions.HeartbeatTimeout = durationpb.New(c.HeartbeatTimeout.Duration()) + updatePath = append(updatePath, "heartbeat_timeout") + } + + if c.Command.Flags().Changed("retry-initial-interval") || + c.Command.Flags().Changed("retry-maximum-interval") || + c.Command.Flags().Changed("retry-backoff-coefficient") || + c.Command.Flags().Changed("retry-maximum-attempts") { + activityOptions.RetryPolicy = &common.RetryPolicy{} + } + + if c.Command.Flags().Changed("retry-initial-interval") { + activityOptions.RetryPolicy.InitialInterval = durationpb.New(c.RetryInitialInterval.Duration()) + updatePath = append(updatePath, "retry_policy.initial_interval") + } + + if c.Command.Flags().Changed("retry-maximum-interval") { + activityOptions.RetryPolicy.MaximumInterval = durationpb.New(c.RetryMaximumInterval.Duration()) + updatePath = append(updatePath, "retry_policy.maximum_interval") + } + + if c.Command.Flags().Changed("retry-backoff-coefficient") { + activityOptions.RetryPolicy.BackoffCoefficient = float64(c.RetryBackoffCoefficient) + updatePath = append(updatePath, "retry_policy.backoff_coefficient") + } + + if c.Command.Flags().Changed("retry-maximum-attempts") { + activityOptions.RetryPolicy.MaximumAttempts = int32(c.RetryMaximumAttempts) + updatePath = append(updatePath, "retry_policy.maximum_attempts") + } + + result, 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) + } + + updatedOptions := updateOptionsDescribe{ + TaskQueue: result.GetActivityOptions().TaskQueue.GetName(), + + ScheduleToCloseTimeout: toDuration(result.GetActivityOptions().ScheduleToCloseTimeout), + ScheduleToStartTimeout: toDuration(result.GetActivityOptions().ScheduleToStartTimeout), + StartToCloseTimeout: toDuration(result.GetActivityOptions().StartToCloseTimeout), + HeartbeatTimeout: toDuration(result.GetActivityOptions().HeartbeatTimeout), + + InitialInterval: toDuration(result.GetActivityOptions().RetryPolicy.InitialInterval), + BackoffCoefficient: result.GetActivityOptions().RetryPolicy.BackoffCoefficient, + MaximumInterval: toDuration(result.GetActivityOptions().RetryPolicy.MaximumInterval), + MaximumAttempts: result.GetActivityOptions().RetryPolicy.MaximumAttempts, + } + + _ = cctx.Printer.PrintStructured(updatedOptions, printer.StructuredOptions{}) + + return nil +} + +// Converts the duration to Go's native time.Duration. +// Returns the zero time.Duration value for nil duration. +func toDuration(duration *durationpb.Duration) (d time.Duration) { + if duration != nil { + d = duration.AsDuration() + } + return +} diff --git a/temporalcli/commands.activity_test.go b/temporalcli/commands.activity_test.go index c5c11da6..e133e619 100644 --- a/temporalcli/commands.activity_test.go +++ b/temporalcli/commands.activity_test.go @@ -106,6 +106,81 @@ 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" + + res := s.Execute( + "activity", "update-options", + "--activity-id", aid, + "--workflow-id", wid, + "--run-id", run.GetRunID(), + "--identity", identity, + "--task-queue", "new-task-queue", + "--schedule-to-close-timeout", "60s", + "--schedule-to-start-timeout", "5s", + "--start-to-close-timeout", "10s", + "--heartbeat-timeout", "20s", + "--retry-initial-interval", "5s", + "--retry-maximum-interval", "60s", + "--retry-backoff-coefficient", "2", + "--retry-maximum-attempts", "5", + "--address", s.Address(), + ) + + s.NoError(res.Err) + out := res.Stdout.String() + s.ContainsOnSameLine(out, "ScheduleToCloseTimeout", "1m0s") + s.ContainsOnSameLine(out, "ScheduleToStartTimeout", "5s") + s.ContainsOnSameLine(out, "StartToCloseTimeout", "10s") + s.ContainsOnSameLine(out, "HeartbeatTimeout", "10s") + s.ContainsOnSameLine(out, "InitialInterval", "5s") + s.ContainsOnSameLine(out, "MaximumInterval", "1m0s") + s.ContainsOnSameLine(out, "BackoffCoefficient", "2") + s.ContainsOnSameLine(out, "MaximumAttempts", "5") +} + +func (s *SharedServerSuite) TestActivityOptionsUpdate_Partial() { + run := s.waitActivityStarted() + wid := run.GetID() + aid := "dev-activity-id" + identity := "MyIdentity" + + res := s.Execute( + "activity", "update-options", + "--activity-id", aid, + "--workflow-id", wid, + "--run-id", run.GetRunID(), + "--identity", identity, + "--task-queue", "new-task-queue", + "--schedule-to-close-timeout", "41s", + "--schedule-to-start-timeout", "11s", + "--retry-initial-interval", "4s", + "--retry-maximum-attempts", "10", + "--address", s.Address(), + ) + + s.NoError(res.Err) + out := res.Stdout.String() + + // updated + s.ContainsOnSameLine(out, "ScheduleToCloseTimeout", "41s") + s.ContainsOnSameLine(out, "ScheduleToStartTimeout", "11s") + s.ContainsOnSameLine(out, "StartToCloseTimeout", "10s") + s.ContainsOnSameLine(out, "InitialInterval", "4s") + s.ContainsOnSameLine(out, "MaximumAttempts", "10") + + // old value + // note - this is a snapshot of current values + //if this test fails, check the default values of activity options + s.ContainsOnSameLine(out, "StartToCloseTimeout", "10s") + s.ContainsOnSameLine(out, "HeartbeatTimeout", "0s") + s.ContainsOnSameLine(out, "MaximumInterval", "1m40s") + s.ContainsOnSameLine(out, "BackoffCoefficient", "2") +} + // Test helpers func (s *SharedServerSuite) waitActivityStarted() client.WorkflowRun { diff --git a/temporalcli/commands.gen.go b/temporalcli/commands.gen.go index 181cd85c..766d29ef 100644 --- a/temporalcli/commands.gen.go +++ b/temporalcli/commands.gen.go @@ -326,15 +326,16 @@ func NewTemporalActivityCommand(cctx *CommandContext, parent *TemporalCommand) * var s TemporalActivityCommand s.Parent = parent s.Command.Use = "activity" - s.Command.Short = "Complete or fail an Activity" + s.Command.Short = "Complete, update or fail an Activity" if hasHighlighting { - s.Command.Long = "Update an Activity's state to completed or failed. This marks an Activity\nas successfully finished or as having encountered an error:\n\n\x1b[1mtemporal activity complete \\\n --activity-id=YourActivityId \\\n --workflow-id=YourWorkflowId \\\n --result='{\"YourResultKey\": \"YourResultValue\"}'\x1b[0m" + s.Command.Long = "Update an Activity's options or update an Activity's state to completed \nor failed.\nUpdating activity state marks an Activity as successfully finished or as\nhaving encountered an error.\n\n\x1b[1mtemporal activity complete \\\n --activity-id=YourActivityId \\\n --workflow-id=YourWorkflowId \\\n --result='{\"YourResultKey\": \"YourResultValue\"}'\x1b[0m" } else { - s.Command.Long = "Update an Activity's state to completed or failed. This marks an Activity\nas successfully finished or as having encountered an error:\n\n```\ntemporal activity complete \\\n --activity-id=YourActivityId \\\n --workflow-id=YourWorkflowId \\\n --result='{\"YourResultKey\": \"YourResultValue\"}'\n```" + s.Command.Long = "Update an Activity's options or update an Activity's state to completed \nor failed.\nUpdating activity state marks an Activity as successfully finished or as\nhaving encountered an error.\n\n```\ntemporal activity complete \\\n --activity-id=YourActivityId \\\n --workflow-id=YourWorkflowId \\\n --result='{\"YourResultKey\": \"YourResultValue\"}'\n```" } s.Command.Args = cobra.NoArgs s.Command.AddCommand(&NewTemporalActivityCompleteCommand(cctx, &s).Command) s.Command.AddCommand(&NewTemporalActivityFailCommand(cctx, &s).Command) + s.Command.AddCommand(&NewTemporalActivityUpdateOptionsCommand(cctx, &s).Command) s.ClientOptions.buildFlags(cctx, s.Command.PersistentFlags()) return &s } @@ -410,6 +411,62 @@ func NewTemporalActivityFailCommand(cctx *CommandContext, parent *TemporalActivi return &s } +type TemporalActivityUpdateOptionsCommand struct { + Parent *TemporalActivityCommand + Command cobra.Command + WorkflowReferenceOptions + ActivityId string + TaskQueue string + ScheduleToCloseTimeout Duration + ScheduleToStartTimeout Duration + StartToCloseTimeout Duration + HeartbeatTimeout Duration + RetryInitialInterval Duration + RetryMaximumInterval Duration + RetryBackoffCoefficient float32 + RetryMaximumAttempts int + Identity string +} + +func NewTemporalActivityUpdateOptionsCommand(cctx *CommandContext, parent *TemporalActivityCommand) *TemporalActivityUpdateOptionsCommand { + var s TemporalActivityUpdateOptionsCommand + s.Parent = parent + s.Command.DisableFlagsInUseLine = true + s.Command.Use = "update-options [flags]" + s.Command.Short = "Update Activity options" + if hasHighlighting { + s.Command.Long = "Update Activity options. Specify the Activity and Workflow IDs, and \noptions you want to update. \nUpdates are incremental, only changing the specified options. \n\n\x1b[1mtemporal activity update-options \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId \\\n --task-queue NewTaskQueueName \\\n --schedule-to-close-timeout DURATION \\\n --schedule-to-start-timeout DURATION \\\n --start-to-close-timeout DURATION \\\n --heartbeat-timeout DURATION \\\n --retry-initial-interval DURATION \\\n --retry-maximum-interval DURATION \\\n --retry-backoff-coefficient NewBackoffCoefficient \\\n --retry-maximum-attempts NewMaximumAttempts\x1b[0m" + } else { + s.Command.Long = "Update Activity options. Specify the Activity and Workflow IDs, and \noptions you want to update. \nUpdates are incremental, only changing the specified options. \n\n```\ntemporal activity update-options \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId \\\n --task-queue NewTaskQueueName \\\n --schedule-to-close-timeout DURATION \\\n --schedule-to-start-timeout DURATION \\\n --start-to-close-timeout DURATION \\\n --heartbeat-timeout DURATION \\\n --retry-initial-interval DURATION \\\n --retry-maximum-interval DURATION \\\n --retry-backoff-coefficient NewBackoffCoefficient \\\n --retry-maximum-attempts NewMaximumAttempts\n\n```" + } + s.Command.Args = cobra.NoArgs + s.Command.Flags().StringVar(&s.ActivityId, "activity-id", "", "Activity ID. Required.") + _ = cobra.MarkFlagRequired(s.Command.Flags(), "activity-id") + s.Command.Flags().StringVar(&s.TaskQueue, "task-queue", "", "Name of the task queue for the Activity.") + s.ScheduleToCloseTimeout = 0 + s.Command.Flags().Var(&s.ScheduleToCloseTimeout, "schedule-to-close-timeout", "Indicates how long the caller is willing to wait for an activity completion. Limits how long retries will be attempted.") + s.ScheduleToStartTimeout = 0 + s.Command.Flags().Var(&s.ScheduleToStartTimeout, "schedule-to-start-timeout", "Limits time an activity task can stay in a task queue before a worker picks it up. This timeout is always non retryable, as all a retry would achieve is to put it back into the same queue. Defaults to the schedule-to-close timeout or workflow execution timeout if not specified.") + s.StartToCloseTimeout = 0 + s.Command.Flags().Var(&s.StartToCloseTimeout, "start-to-close-timeout", "Maximum time an activity is allowed to execute after being picked up by a worker. This timeout is always retryable.") + s.HeartbeatTimeout = 0 + s.Command.Flags().Var(&s.HeartbeatTimeout, "heartbeat-timeout", "Maximum permitted time between successful worker heartbeats.") + s.RetryInitialInterval = 0 + s.Command.Flags().Var(&s.RetryInitialInterval, "retry-initial-interval", "Interval of the first retry. If retryBackoffCoefficient is 1.0 then it is used for all retries.") + s.RetryMaximumInterval = 0 + s.Command.Flags().Var(&s.RetryMaximumInterval, "retry-maximum-interval", "Maximum interval between retries. Exponential backoff leads to interval increase. This value is the cap of the increase.") + s.Command.Flags().Float32Var(&s.RetryBackoffCoefficient, "retry-backoff-coefficient", 0, "Coefficient used to calculate the next retry interval. The next retry interval is previous interval multiplied by the backoff coefficient. Must be 1 or larger.") + s.Command.Flags().IntVar(&s.RetryMaximumAttempts, "retry-maximum-attempts", 0, "Maximum number of attempts. When exceeded the retries stop even if not expired yet. Setting this value to 1 disables retries. Setting this value to 0 means unlimited attempts(up to the timeouts).") + s.Command.Flags().StringVar(&s.Identity, "identity", "", "Identity of the user submitting this request.") + s.WorkflowReferenceOptions.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 diff --git a/temporalcli/commandsgen/commands.yml b/temporalcli/commandsgen/commands.yml index 516a4e5e..fbd03992 100644 --- a/temporalcli/commandsgen/commands.yml +++ b/temporalcli/commandsgen/commands.yml @@ -201,11 +201,13 @@ commands: The command execution timeout. 0s means no timeout. - name: temporal activity - summary: Complete or fail an Activity + summary: Complete, update or fail an Activity description: | - Update an Activity's state to completed or failed. This marks an Activity - as successfully finished or as having encountered an error: - + Update an Activity's options or update an Activity's state to completed + or failed. + Updating activity state marks an Activity as successfully finished or as + having encountered an error. + ``` temporal activity complete \ --activity-id=YourActivityId \ @@ -222,6 +224,7 @@ commands: keywords: - activity - activity complete + - activity update-options - activity execution - activity fail - cli reference @@ -284,6 +287,93 @@ commands: option-sets: - workflow reference + + + - name: temporal activity update-options + summary: Update Activity options + description: | + Update Activity options. Specify the Activity and Workflow IDs, and + options you want to update. + Updates are incremental, only changing the specified options. + + ``` + temporal activity update-options \ + --activity-id YourActivityId \ + --workflow-id YourWorkflowId \ + --task-queue NewTaskQueueName \ + --schedule-to-close-timeout DURATION \ + --schedule-to-start-timeout DURATION \ + --start-to-close-timeout DURATION \ + --heartbeat-timeout DURATION \ + --retry-initial-interval DURATION \ + --retry-maximum-interval DURATION \ + --retry-backoff-coefficient NewBackoffCoefficient \ + --retry-maximum-attempts NewMaximumAttempts + + ``` + options: + - name: activity-id + type: string + description: Activity ID. + required: true + - name: task-queue + type: string + description: Name of the task queue for the Activity. + - name: schedule-to-close-timeout + type: duration + description: | + Indicates how long the caller is willing to wait for an activity + completion. + Limits how long retries will be attempted. + - name: schedule-to-start-timeout + type: duration + description: | + Limits time an activity task can stay in a task queue before a worker + picks it up. + This timeout is always non retryable, as all a retry would achieve is + to put it back into the same + queue. Defaults to the schedule-to-close timeout or workflow execution + timeout if not specified. + - name: start-to-close-timeout + type: duration + description: | + Maximum time an activity is allowed to execute after being picked up + by a worker. This timeout is always retryable. + - name: heartbeat-timeout + type: duration + description: | + Maximum permitted time between successful worker heartbeats. + - name: retry-initial-interval + type: duration + description: | + Interval of the first retry. If retryBackoffCoefficient is 1.0 then it + is used for all retries. + - name: retry-maximum-interval + type: duration + description: | + Maximum interval between retries. Exponential backoff leads to + interval increase. + This value is the cap of the increase. + - name: retry-backoff-coefficient + type: float + description: | + Coefficient used to calculate the next retry interval. + The next retry interval is previous interval multiplied by the backoff + coefficient. + Must be 1 or larger. + - name: retry-maximum-attempts + type: int + description: | + Maximum number of attempts. When exceeded the retries stop even if not + expired yet. + Setting this value to 1 disables retries. Setting this value to 0 + means unlimited attempts(up to the timeouts). + - name: identity + type: string + description: Identity of the user submitting this request. + option-sets: + - workflow reference + - name: temporal batch summary: Manage running batch jobs description: | From 711b5e7deafbea91e6f0abdfdd05d16dc4d218cb Mon Sep 17 00:00:00 2001 From: Yuri Date: Fri, 13 Dec 2024 13:49:06 -0800 Subject: [PATCH 2/4] add dynamic config value --- temporalcli/commands_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/temporalcli/commands_test.go b/temporalcli/commands_test.go index 38a4169f..7158bc02 100644 --- a/temporalcli/commands_test.go +++ b/temporalcli/commands_test.go @@ -217,7 +217,10 @@ func (s *SharedServerSuite) SetupSuite() { // for the task-queue command tests. "frontend.namespaceRPS.visibility": 10000, // Disable DescribeTaskQueue cache. - "matching.TaskQueueInfoByBuildIdTTL": 0, + "frontend.activityAPIsEnabled": true, + // this is overridden since we don't want caching to be enabled + // while testing DescribeTaskQueue behaviour related to versioning + "matching.TaskQueueInfoByBuildIdTTL": 0 * time.Second, }, }, }) From 82ab4236882bbac8242b3006ba8e38632f8eb12a Mon Sep 17 00:00:00 2001 From: Yuri Date: Fri, 13 Dec 2024 15:01:02 -0800 Subject: [PATCH 3/4] Update temporalcli/commands.activity_test.go Co-authored-by: Chad Retz --- temporalcli/commands.activity_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/temporalcli/commands.activity_test.go b/temporalcli/commands.activity_test.go index e133e619..f976ef01 100644 --- a/temporalcli/commands.activity_test.go +++ b/temporalcli/commands.activity_test.go @@ -174,7 +174,7 @@ func (s *SharedServerSuite) TestActivityOptionsUpdate_Partial() { // old value // note - this is a snapshot of current values - //if this test fails, check the default values of activity options + // if this test fails, check the default values of activity options s.ContainsOnSameLine(out, "StartToCloseTimeout", "10s") s.ContainsOnSameLine(out, "HeartbeatTimeout", "0s") s.ContainsOnSameLine(out, "MaximumInterval", "1m40s") From 2bf4524b5e85b929242ea271fac87eb26269c70c Mon Sep 17 00:00:00 2001 From: Yuri Date: Fri, 13 Dec 2024 15:07:06 -0800 Subject: [PATCH 4/4] remove not needed helper func --- temporalcli/commands.activity.go | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/temporalcli/commands.activity.go b/temporalcli/commands.activity.go index bcf092d1..0f00dd79 100644 --- a/temporalcli/commands.activity.go +++ b/temporalcli/commands.activity.go @@ -174,14 +174,14 @@ func (c *TemporalActivityUpdateOptionsCommand) run(cctx *CommandContext, args [] updatedOptions := updateOptionsDescribe{ TaskQueue: result.GetActivityOptions().TaskQueue.GetName(), - ScheduleToCloseTimeout: toDuration(result.GetActivityOptions().ScheduleToCloseTimeout), - ScheduleToStartTimeout: toDuration(result.GetActivityOptions().ScheduleToStartTimeout), - StartToCloseTimeout: toDuration(result.GetActivityOptions().StartToCloseTimeout), - HeartbeatTimeout: toDuration(result.GetActivityOptions().HeartbeatTimeout), + ScheduleToCloseTimeout: result.GetActivityOptions().ScheduleToCloseTimeout.AsDuration(), + ScheduleToStartTimeout: result.GetActivityOptions().ScheduleToStartTimeout.AsDuration(), + StartToCloseTimeout: result.GetActivityOptions().StartToCloseTimeout.AsDuration(), + HeartbeatTimeout: result.GetActivityOptions().HeartbeatTimeout.AsDuration(), - InitialInterval: toDuration(result.GetActivityOptions().RetryPolicy.InitialInterval), + InitialInterval: result.GetActivityOptions().RetryPolicy.InitialInterval.AsDuration(), BackoffCoefficient: result.GetActivityOptions().RetryPolicy.BackoffCoefficient, - MaximumInterval: toDuration(result.GetActivityOptions().RetryPolicy.MaximumInterval), + MaximumInterval: result.GetActivityOptions().RetryPolicy.MaximumInterval.AsDuration(), MaximumAttempts: result.GetActivityOptions().RetryPolicy.MaximumAttempts, } @@ -189,12 +189,3 @@ func (c *TemporalActivityUpdateOptionsCommand) run(cctx *CommandContext, args [] return nil } - -// Converts the duration to Go's native time.Duration. -// Returns the zero time.Duration value for nil duration. -func toDuration(duration *durationpb.Duration) (d time.Duration) { - if duration != nil { - d = duration.AsDuration() - } - return -}