Make DynamoDB table configurable for locking and remove unnecessary signal for exec

This commit is contained in:
Mustafa Gezen 2022-07-14 17:22:02 +02:00
parent df5c351b7f
commit d0460edd69
Signed by untrusted user who does not match committer: mustafa
GPG Key ID: DCDF010D946438C1
4 changed files with 3 additions and 11 deletions

View File

@ -38,7 +38,6 @@ import (
"fmt" "fmt"
"github.com/google/uuid" "github.com/google/uuid"
"go.temporal.io/sdk/activity" "go.temporal.io/sdk/activity"
"golang.org/x/sys/unix"
"google.golang.org/protobuf/types/known/wrapperspb" "google.golang.org/protobuf/types/known/wrapperspb"
"io" "io"
"io/fs" "io/fs"
@ -56,7 +55,6 @@ import (
"strconv" "strconv"
"strings" "strings"
"sync" "sync"
"syscall"
"time" "time"
) )
@ -692,9 +690,6 @@ func (c *Controller) BuildArchActivity(ctx context.Context, projectId string, pa
cmd := exec.Command("/bundle/fork-exec.py", args...) cmd := exec.Command("/bundle/fork-exec.py", args...)
cmd.Stdout = os.Stdout cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr cmd.Stderr = os.Stderr
cmd.SysProcAttr = &syscall.SysProcAttr{
Pdeathsig: unix.SIGTERM,
}
err = cmd.Run() err = cmd.Run()
if err != nil { if err != nil {
return fmt.Errorf("could not mock build: %v", err) return fmt.Errorf("could not mock build: %v", err)

View File

@ -46,7 +46,6 @@ import (
"github.com/go-git/go-git/v5/plumbing" "github.com/go-git/go-git/v5/plumbing"
"github.com/rocky-linux/srpmproc/pkg/srpmproc" "github.com/rocky-linux/srpmproc/pkg/srpmproc"
"go.temporal.io/sdk/activity" "go.temporal.io/sdk/activity"
"golang.org/x/sys/unix"
"google.golang.org/protobuf/types/known/anypb" "google.golang.org/protobuf/types/known/anypb"
"google.golang.org/protobuf/types/known/wrapperspb" "google.golang.org/protobuf/types/known/wrapperspb"
"io" "io"
@ -58,7 +57,6 @@ import (
peridotpb "peridot.resf.org/peridot/pb" peridotpb "peridot.resf.org/peridot/pb"
"peridot.resf.org/peridot/rpmbuild" "peridot.resf.org/peridot/rpmbuild"
"strings" "strings"
"syscall"
"time" "time"
) )
@ -448,9 +446,6 @@ func (c *Controller) BuildSRPMActivity(ctx context.Context, upstreamPrefix strin
cmd := exec.Command("/bundle/fork-exec.py", args...) cmd := exec.Command("/bundle/fork-exec.py", args...)
cmd.Stdout = os.Stdout cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr cmd.Stderr = os.Stderr
cmd.SysProcAttr = &syscall.SysProcAttr{
Pdeathsig: unix.SIGTERM,
}
err = cmd.Run() err = cmd.Run()
if err != nil { if err != nil {
return fmt.Errorf("could not mock build: %v", err) return fmt.Errorf("could not mock build: %v", err)

View File

@ -43,6 +43,7 @@ import (
"fmt" "fmt"
"github.com/gobwas/glob" "github.com/gobwas/glob"
"github.com/google/uuid" "github.com/google/uuid"
"github.com/spf13/viper"
"go.temporal.io/sdk/activity" "go.temporal.io/sdk/activity"
"go.temporal.io/sdk/temporal" "go.temporal.io/sdk/temporal"
"go.temporal.io/sdk/workflow" "go.temporal.io/sdk/workflow"
@ -518,7 +519,7 @@ func (c *Controller) UpdateRepoActivity(ctx context.Context, req *UpdateRepoRequ
lock, err := dynamolock.New( lock, err := dynamolock.New(
c.dynamodb, c.dynamodb,
"peridot-repo-revision-lock", viper.GetString("dynamodb-table"),
dynamolock.WithLeaseDuration(10*time.Second), dynamolock.WithLeaseDuration(10*time.Second),
dynamolock.WithHeartbeatPeriod(3*time.Second), dynamolock.WithHeartbeatPeriod(3*time.Second),
) )

View File

@ -66,6 +66,7 @@ func init() {
cnf.Name = "yumrepofsupdater" cnf.Name = "yumrepofsupdater"
peridotcommon.AddFlags(root.PersistentFlags()) peridotcommon.AddFlags(root.PersistentFlags())
root.PersistentFlags().String("dynamodb-table", "peridot-repo-revision-lock", "DynamoDB table name")
utils.AddFlags(root.PersistentFlags(), cnf) utils.AddFlags(root.PersistentFlags(), cnf)
} }