Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions cmd/omes/prepare_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/temporalio/omes/clioptions"
"github.com/temporalio/omes/workers"
"github.com/temporalio/omes/internal/workerctl"
)

func prepareWorkerCmd() *cobra.Command {
Expand All @@ -22,7 +22,7 @@ func prepareWorkerCmd() *cobra.Command {
if err != nil {
b.Logger.Fatal(fmt.Errorf("failed to get root directory: %w", err))
}
baseDir := workers.BaseDir(repoDir, b.SdkOptions.Language)
baseDir := workerctl.BaseDir(repoDir, b.SdkOptions.Language)
if _, err := b.Build(cmd.Context(), baseDir); err != nil {
b.Logger.Fatal(err)
}
Expand All @@ -35,7 +35,7 @@ func prepareWorkerCmd() *cobra.Command {
}

type workerBuilder struct {
workers.Builder
workerctl.Builder
loggingOptions clioptions.LoggingOptions
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/omes/run_scenario_with_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/temporalio/omes/clioptions"
"github.com/temporalio/omes/workers"
"github.com/temporalio/omes/internal/workerctl"
)

func runScenarioWithWorkerCmd() *cobra.Command {
Expand Down Expand Up @@ -61,7 +61,7 @@ func (r *workerWithScenarioRunner) run(ctx context.Context) error {
workerErrCh <- fmt.Errorf("failed to get root directory: %w", err)
return
}
workerErrCh <- r.Run(ctx, workers.BaseDir(repoDir, r.SdkOptions.Language))
workerErrCh <- r.Run(ctx, workerctl.BaseDir(repoDir, r.SdkOptions.Language))
}()
select {
case err := <-workerErrCh:
Expand Down
6 changes: 3 additions & 3 deletions cmd/omes/run_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (

"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/temporalio/omes/internal/workerctl"
"github.com/temporalio/omes/loadgen"
"github.com/temporalio/omes/workers"
)

func runWorkerCmd() *cobra.Command {
Expand Down Expand Up @@ -41,7 +41,7 @@ func runWorkerCmd() *cobra.Command {
}

type workerRunner struct {
workers.Runner
workerctl.Runner
builder workerBuilder
}

Expand Down Expand Up @@ -73,7 +73,7 @@ func (r *workerRunner) run(ctx context.Context) error {
if err != nil {
return fmt.Errorf("failed to get root directory: %w", err)
}
return r.Run(ctx, workers.BaseDir(repoDir, r.SdkOptions.Language))
return r.Run(ctx, workerctl.BaseDir(repoDir, r.SdkOptions.Language))
}

func withCancelOnInterrupt(ctx context.Context) (context.Context, context.CancelFunc) {
Expand Down
1 change: 1 addition & 0 deletions dockerfiles/cli.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ COPY clioptions ./clioptions
COPY loadgen ./loadgen
COPY metrics ./metrics
COPY scenarios ./scenarios
COPY internal ./internal
COPY devserver ./devserver
COPY versions ./versions
COPY workers ./workers/
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/dotnet.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ COPY scenarios ./scenarios
COPY metrics ./metrics
COPY devserver ./devserver
COPY versions ./versions
COPY workers/*.go ./workers/
COPY internal ./internal
COPY workers/go/harness/api ./workers/go/harness/api
COPY workers/proto/harness ./workers/proto/harness
COPY go.mod go.sum ./
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/go.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ COPY scenarios ./scenarios
COPY metrics ./metrics
COPY devserver ./devserver
COPY versions ./versions
COPY workers/*.go ./workers/
COPY internal ./internal
COPY workers/go/harness/api ./workers/go/harness/api
COPY go.mod go.sum ./

Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/java.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ COPY metrics ./metrics
COPY scenarios ./scenarios
COPY devserver ./devserver
COPY versions ./versions
COPY workers/*.go ./workers/
COPY internal ./internal
COPY workers/go/harness/api ./workers/go/harness/api
COPY go.mod go.sum ./

Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/python.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ COPY scenarios ./scenarios
COPY metrics ./metrics
COPY devserver ./devserver
COPY versions ./versions
COPY workers/*.go ./workers/
COPY internal ./internal
COPY workers/go/harness/api ./workers/go/harness/api
COPY go.mod go.sum ./

Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/ruby.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ COPY scenarios ./scenarios
COPY metrics ./metrics
COPY devserver ./devserver
COPY versions ./versions
COPY workers/*.go ./workers/
COPY internal ./internal
COPY workers/go/harness/api ./workers/go/harness/api
COPY go.mod go.sum ./

Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/typescript.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ COPY scenarios ./scenarios
COPY metrics ./metrics
COPY devserver ./devserver
COPY versions ./versions
COPY workers/*.go ./workers/
COPY internal ./internal
COPY workers/go/harness/api ./workers/go/harness/api
COPY go.mod go.sum versions.env ./

Expand Down
2 changes: 1 addition & 1 deletion workers/build.go → internal/workerctl/build.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package workers
package workerctl

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion workers/log.go → internal/workerctl/log.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package workers
package workerctl

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion workers/run.go → internal/workerctl/run.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package workers
package workerctl

import (
"context"
Expand Down
4 changes: 2 additions & 2 deletions internal/workertest/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import (
"github.com/stretchr/testify/require"
"github.com/temporalio/omes/clioptions"
"github.com/temporalio/omes/devserver"
"github.com/temporalio/omes/internal/workerctl"
"github.com/temporalio/omes/loadgen"
"github.com/temporalio/omes/versions"
"github.com/temporalio/omes/workers"
"go.temporal.io/api/nexus/v1"
"go.temporal.io/api/operatorservice/v1"
"go.temporal.io/sdk/client"
Expand Down Expand Up @@ -108,7 +108,7 @@ func SetupTestEnvironment(t *testing.T, opts ...TestEnvOption) *TestEnvironment
Ref: serverRef,
Namespace: testNamespace,
DynamicConfigValues: cfg.dynamicConfig,
Output: workers.NewLogWriter(serverLogger),
Output: workerctl.NewLogWriter(serverLogger),
Logger: serverLogger,
})
require.NoError(t, err, "Failed to start dev server")
Expand Down
12 changes: 6 additions & 6 deletions internal/workertest/workerpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"testing"

"github.com/temporalio/omes/clioptions"
"github.com/temporalio/omes/internal/workerctl"
"github.com/temporalio/omes/loadgen"
"github.com/temporalio/omes/workers"
"go.uber.org/zap"
)

Expand Down Expand Up @@ -53,7 +53,7 @@ func (w *workerPool) ensureWorkerBuilt(
w.mutex.Unlock()

once.Do(func() {
baseDir := workers.BaseDir(w.env.repoDir, sdk)
baseDir := workerctl.BaseDir(w.env.repoDir, sdk)
buildDir := filepath.Join(baseDir, w.env.buildDirName())

w.mutex.Lock()
Expand All @@ -64,7 +64,7 @@ func (w *workerPool) ensureWorkerBuilt(
})
w.mutex.Unlock()

builder := workers.Builder{
builder := workerctl.Builder{
DirName: w.env.buildDirName(),
SdkOptions: clioptions.SdkOptions{Language: sdk},
Logger: logger.Named(fmt.Sprintf("%s-builder", sdk)),
Expand Down Expand Up @@ -98,9 +98,9 @@ func (w *workerPool) startWorker(

go func() {
defer close(workerDone)
baseDir := workers.BaseDir(w.env.repoDir, sdk)
runner := &workers.Runner{
Builder: workers.Builder{
baseDir := workerctl.BaseDir(w.env.repoDir, sdk)
runner := &workerctl.Runner{
Builder: workerctl.Builder{
DirName: w.env.buildDirName(),
SdkOptions: clioptions.SdkOptions{Language: sdk},
Logger: logger.Named(fmt.Sprintf("%s-worker-builder", sdk)),
Expand Down
6 changes: 3 additions & 3 deletions scenarios/project/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ import (

"github.com/temporalio/features/sdkbuild"
"github.com/temporalio/omes/clioptions"
"github.com/temporalio/omes/workers"
"github.com/temporalio/omes/internal/workerctl"
"go.uber.org/zap"
)

// buildProject builds a project test program for the given language.
func buildProject(ctx context.Context, repoRoot string, p projectScenarioOptions, logger *zap.SugaredLogger) (sdkbuild.Program, error) {
b := workers.Builder{
b := workerctl.Builder{
DirName: fmt.Sprintf("project-build-runner-%s", p.projectName),
SdkOptions: p.sdkOpts,
ProjectName: p.projectName,
Logger: logger,
}

baseDir := workers.BaseDir(repoRoot, p.sdkOpts.Language)
baseDir := workerctl.BaseDir(repoRoot, p.sdkOpts.Language)
switch p.sdkOpts.Language {
case clioptions.LangPython:
return b.Build(ctx, baseDir)
Expand Down
8 changes: 4 additions & 4 deletions scenarios/project/project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
"github.com/temporalio/features/sdkbuild"
"github.com/temporalio/omes/clioptions"
"github.com/temporalio/omes/devserver"
"github.com/temporalio/omes/internal/workerctl"
"github.com/temporalio/omes/loadgen"
"github.com/temporalio/omes/versions"
"github.com/temporalio/omes/workers"
sdkclient "go.temporal.io/sdk/client"
"go.uber.org/zap/zaptest"
)
Expand Down Expand Up @@ -194,7 +194,7 @@ func startProjectWorker(
t.Helper()
require.NotEmpty(t, opts.projectName)

builder := workers.Builder{
builder := workerctl.Builder{
ProjectName: opts.projectName,
SdkOptions: opts.sdkOpts,
Logger: info.Logger.Named(fmt.Sprintf("%s-worker-builder", opts.sdkOpts.Language)),
Expand All @@ -206,7 +206,7 @@ func startProjectWorker(
builder.DirName = filepath.Base(prog.Dir())
}

runner := &workers.Runner{
runner := &workerctl.Runner{
Builder: builder,
TaskQueueName: loadgen.TaskQueueForRun(info.RunID),
GracefulShutdownDuration: 5 * time.Second,
Expand All @@ -224,7 +224,7 @@ func startProjectWorker(
workerErrCh := make(chan error, 1)
go func() {
defer close(workerErrCh)
workerErrCh <- runner.Run(ctx, workers.BaseDir(info.RootPath, opts.sdkOpts.Language))
workerErrCh <- runner.Run(ctx, workerctl.BaseDir(info.RootPath, opts.sdkOpts.Language))
}()
return workerErrCh
}
Loading