Skip to content

Commit

Permalink
fix: project naming and linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
kafkaphoenix committed Dec 12, 2024
1 parent 404288b commit 50f9d7a
Show file tree
Hide file tree
Showing 68 changed files with 193 additions and 193 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/konstellation-io/kai-sdk/go-sdk/v1
module github.com/konstellation-io/kai-gosdk

go 1.23.4

Expand Down
2 changes: 1 addition & 1 deletion internal/auth/authentication.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"

"github.com/konstellation-io/kai-sdk/go-sdk/v1/internal/common"
"github.com/konstellation-io/kai-gosdk/internal/common"

"github.com/Nerzal/gocloak/v13"
"github.com/go-logr/logr"
Expand Down
4 changes: 2 additions & 2 deletions internal/storage/minio_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"

"github.com/go-logr/logr"
"github.com/konstellation-io/kai-sdk/go-sdk/v1/internal/auth"
"github.com/konstellation-io/kai-sdk/go-sdk/v1/internal/common"
"github.com/konstellation-io/kai-gosdk/internal/auth"
"github.com/konstellation-io/kai-gosdk/internal/common"
"github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/credentials"
"github.com/spf13/viper"
Expand Down
2 changes: 1 addition & 1 deletion mocks/centralized_config_mock.go

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

2 changes: 1 addition & 1 deletion mocks/model_registry_mock.go

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

2 changes: 1 addition & 1 deletion mocks/persistent_storage_mock.go

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

2 changes: 1 addition & 1 deletion mocks/predictions_mock.go

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

2 changes: 1 addition & 1 deletion runner/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/spf13/viper"
"google.golang.org/protobuf/types/known/anypb"

kaisdk "github.com/konstellation-io/kai-sdk/go-sdk/v1/sdk"
kaisdk "github.com/konstellation-io/kai-gosdk/sdk"
)

const (
Expand Down
6 changes: 3 additions & 3 deletions runner/common/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"github.com/spf13/viper"
"github.com/stretchr/testify/suite"

"github.com/konstellation-io/kai-sdk/go-sdk/v1/mocks"
"github.com/konstellation-io/kai-sdk/go-sdk/v1/runner/common"
"github.com/konstellation-io/kai-sdk/go-sdk/v1/sdk"
"github.com/konstellation-io/kai-gosdk/mocks"
"github.com/konstellation-io/kai-gosdk/runner/common"
"github.com/konstellation-io/kai-gosdk/sdk"
)

type RunnerCommonTestSuite struct {
Expand Down
4 changes: 2 additions & 2 deletions runner/exit/exit_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package exit
import (
"strings"

"github.com/konstellation-io/kai-sdk/go-sdk/v1/runner/common"
"github.com/konstellation-io/kai-sdk/go-sdk/v1/sdk"
"github.com/konstellation-io/kai-gosdk/runner/common"
"github.com/konstellation-io/kai-gosdk/sdk"
"go.opentelemetry.io/otel/metric"

"github.com/go-logr/logr"
Expand Down
4 changes: 2 additions & 2 deletions runner/exit/helpers.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package exit

import (
"github.com/konstellation-io/kai-sdk/go-sdk/v1/runner/common"
"github.com/konstellation-io/kai-sdk/go-sdk/v1/sdk"
"github.com/konstellation-io/kai-gosdk/runner/common"
"github.com/konstellation-io/kai-gosdk/sdk"
"google.golang.org/protobuf/types/known/anypb"
)

Expand Down
38 changes: 19 additions & 19 deletions runner/exit/subscriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import (
"github.com/spf13/viper"
"google.golang.org/protobuf/proto"

"github.com/konstellation-io/kai-sdk/go-sdk/v1/internal/common"
"github.com/konstellation-io/kai-sdk/go-sdk/v1/internal/errors"
kai "github.com/konstellation-io/kai-sdk/go-sdk/v1/protos"
"github.com/konstellation-io/kai-sdk/go-sdk/v1/sdk"
"github.com/konstellation-io/kai-gosdk/internal/common"
"github.com/konstellation-io/kai-gosdk/internal/errors"
kai "github.com/konstellation-io/kai-gosdk/protos"
"github.com/konstellation-io/kai-gosdk/sdk"
)

const _subscriberLoggerName = "[SUBSCRIBER]"
Expand Down Expand Up @@ -106,7 +106,7 @@ func (er *Runner) processMessage(msg *nats.Msg) {
if err != nil {
errMsg := fmt.Sprintf("Error parsing msg.data coming from subject %s because is not a valid protobuf: %s",
msg.Subject, err)
er.processRunnerError(msg, errMsg, requestMsg.RequestId)
er.processRunnerError(msg, errMsg, requestMsg.GetRequestId())

return
}
Expand All @@ -117,17 +117,17 @@ func (er *Runner) processMessage(msg *nats.Msg) {
er.sdk.Logger.V(1).Info(fmt.Sprintf("%s execution time: %d ms", er.sdk.Metadata.GetProcess(), executionTime))

er.messagesMetric.Record(context.Background(), executionTime,
metric.WithAttributeSet(er.getMetricAttributes(requestMsg.RequestId)),
metric.WithAttributeSet(er.getMetricAttributes(requestMsg.GetRequestId())),
)
}()

er.getLoggerWithName().Info(fmt.Sprintf("New message received with subject %s",
msg.Subject))

handler := er.getResponseHandler(strings.ToLower(requestMsg.FromNode))
handler := er.getResponseHandler(strings.ToLower(requestMsg.GetFromNode()))
if handler == nil {
errMsg := fmt.Sprintf("Error missing handler for node %q", requestMsg.FromNode)
er.processRunnerError(msg, errMsg, requestMsg.RequestId)
errMsg := fmt.Sprintf("Error missing handler for node %q", requestMsg.GetFromNode())
er.processRunnerError(msg, errMsg, requestMsg.GetRequestId())

return
}
Expand All @@ -136,31 +136,31 @@ func (er *Runner) processMessage(msg *nats.Msg) {
hSdk := sdk.ShallowCopyWithRequest(&er.sdk, requestMsg)

if er.preprocessor != nil {
err := er.preprocessor(hSdk, requestMsg.Payload)
err := er.preprocessor(hSdk, requestMsg.GetPayload())
if err != nil {
errMsg := fmt.Sprintf("Error in node %q executing handler preprocessor for node %q: %s",
er.sdk.Metadata.GetProcess(), requestMsg.FromNode, err)
er.processRunnerError(msg, errMsg, requestMsg.RequestId)
er.sdk.Metadata.GetProcess(), requestMsg.GetFromNode(), err)
er.processRunnerError(msg, errMsg, requestMsg.GetRequestId())

return
}
}

err = handler(hSdk, requestMsg.Payload)
err = handler(hSdk, requestMsg.GetPayload())
if err != nil {
errMsg := fmt.Sprintf("Error in node %q executing handler for node %q: %s",
er.sdk.Metadata.GetProcess(), requestMsg.FromNode, err)
er.processRunnerError(msg, errMsg, requestMsg.RequestId)
er.sdk.Metadata.GetProcess(), requestMsg.GetFromNode(), err)
er.processRunnerError(msg, errMsg, requestMsg.GetRequestId())

return
}

if er.postprocessor != nil {
err := er.postprocessor(hSdk, requestMsg.Payload)
err := er.postprocessor(hSdk, requestMsg.GetPayload())
if err != nil {
errMsg := fmt.Sprintf("Error in node %q executing handler postprocessor for node %q: %s",
er.sdk.Metadata.GetProcess(), requestMsg.FromNode, err)
er.processRunnerError(msg, errMsg, requestMsg.RequestId)
er.sdk.Metadata.GetProcess(), requestMsg.GetFromNode(), err)
er.processRunnerError(msg, errMsg, requestMsg.GetRequestId())

return
}
Expand Down Expand Up @@ -248,7 +248,7 @@ func (er *Runner) getOutputSubject(channel string) string {
func (er *Runner) prepareOutputMessage(msg []byte) ([]byte, error) {
maxSize, err := er.getMaxMessageSize()
if err != nil {
return nil, fmt.Errorf("error getting max message size: %s", err) //nolint:goerr113 // error is wrapped
return nil, fmt.Errorf("error getting max message size: %w", err)
}

lenMsg := int64(len(msg))
Expand Down
8 changes: 4 additions & 4 deletions runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import (
"fmt"
"time"

"github.com/konstellation-io/kai-sdk/go-sdk/v1/internal/common"
"github.com/konstellation-io/kai-gosdk/internal/common"

"github.com/go-logr/logr"
"github.com/go-logr/zapr"
"github.com/konstellation-io/kai-sdk/go-sdk/v1/runner/exit"
"github.com/konstellation-io/kai-sdk/go-sdk/v1/runner/task"
"github.com/konstellation-io/kai-sdk/go-sdk/v1/runner/trigger"
"github.com/konstellation-io/kai-gosdk/runner/exit"
"github.com/konstellation-io/kai-gosdk/runner/task"
"github.com/konstellation-io/kai-gosdk/runner/trigger"
"github.com/nats-io/nats.go"
"github.com/spf13/viper"
"go.uber.org/zap"
Expand Down
6 changes: 3 additions & 3 deletions runner/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/suite"

"github.com/konstellation-io/kai-sdk/go-sdk/v1/internal/common"
"github.com/konstellation-io/kai-sdk/go-sdk/v1/mocks"
"github.com/konstellation-io/kai-sdk/go-sdk/v1/runner"
"github.com/konstellation-io/kai-gosdk/internal/common"
"github.com/konstellation-io/kai-gosdk/mocks"
"github.com/konstellation-io/kai-gosdk/runner"
)

type SdkRunnerTestSuite struct {
Expand Down
4 changes: 2 additions & 2 deletions runner/task/helpers.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package task

import (
"github.com/konstellation-io/kai-sdk/go-sdk/v1/runner/common"
"github.com/konstellation-io/kai-sdk/go-sdk/v1/sdk"
"github.com/konstellation-io/kai-gosdk/runner/common"
"github.com/konstellation-io/kai-gosdk/sdk"
"google.golang.org/protobuf/types/known/anypb"
)

Expand Down
38 changes: 19 additions & 19 deletions runner/task/subscriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import (
"go.opentelemetry.io/otel/metric"
"google.golang.org/protobuf/proto"

"github.com/konstellation-io/kai-sdk/go-sdk/v1/internal/common"
"github.com/konstellation-io/kai-sdk/go-sdk/v1/internal/errors"
kai "github.com/konstellation-io/kai-sdk/go-sdk/v1/protos"
"github.com/konstellation-io/kai-sdk/go-sdk/v1/sdk"
"github.com/konstellation-io/kai-gosdk/internal/common"
"github.com/konstellation-io/kai-gosdk/internal/errors"
kai "github.com/konstellation-io/kai-gosdk/protos"
"github.com/konstellation-io/kai-gosdk/sdk"
)

const _subscriberLoggerName = "[SUBSCRIBER]"
Expand Down Expand Up @@ -104,7 +104,7 @@ func (tr *Runner) processMessage(msg *nats.Msg) {
requestMsg, err := tr.newRequestMessage(msg.Data)
if err != nil {
errMsg := fmt.Sprintf("Error parsing msg.data coming from subject %s because is not a valid protobuf: %s", msg.Subject, err)
tr.processRunnerError(msg, errMsg, requestMsg.RequestId)
tr.processRunnerError(msg, errMsg, requestMsg.GetRequestId())

return
}
Expand All @@ -115,17 +115,17 @@ func (tr *Runner) processMessage(msg *nats.Msg) {
tr.sdk.Logger.V(1).Info(fmt.Sprintf("%s execution time: %d ms", tr.sdk.Metadata.GetProcess(), executionTime))

tr.messagesMetric.Record(context.Background(), executionTime,
metric.WithAttributeSet(tr.getMetricAttributes(requestMsg.RequestId)),
metric.WithAttributeSet(tr.getMetricAttributes(requestMsg.GetRequestId())),
)
}()

tr.getLoggerWithName().Info(fmt.Sprintf("New message received with subject %s",
msg.Subject))

handler := tr.getResponseHandler(strings.ToLower(requestMsg.FromNode))
handler := tr.getResponseHandler(strings.ToLower(requestMsg.GetFromNode()))
if handler == nil {
errMsg := fmt.Sprintf("Error missing handler for node %q", requestMsg.FromNode)
tr.processRunnerError(msg, errMsg, requestMsg.RequestId)
errMsg := fmt.Sprintf("Error missing handler for node %q", requestMsg.GetFromNode())
tr.processRunnerError(msg, errMsg, requestMsg.GetRequestId())

return
}
Expand All @@ -134,31 +134,31 @@ func (tr *Runner) processMessage(msg *nats.Msg) {
hSdk := sdk.ShallowCopyWithRequest(&tr.sdk, requestMsg)

if tr.preprocessor != nil {
err := tr.preprocessor(hSdk, requestMsg.Payload)
err := tr.preprocessor(hSdk, requestMsg.GetPayload())
if err != nil {
errMsg := fmt.Sprintf("Error in node %q executing handler preprocessor for node %q: %s",
tr.sdk.Metadata.GetProcess(), requestMsg.FromNode, err)
tr.processRunnerError(msg, errMsg, requestMsg.RequestId)
tr.sdk.Metadata.GetProcess(), requestMsg.GetFromNode(), err)
tr.processRunnerError(msg, errMsg, requestMsg.GetRequestId())

return
}
}

err = handler(hSdk, requestMsg.Payload)
err = handler(hSdk, requestMsg.GetPayload())
if err != nil {
errMsg := fmt.Sprintf("Error in node %q executing handler for node %q: %s",
tr.sdk.Metadata.GetProcess(), requestMsg.FromNode, err)
tr.processRunnerError(msg, errMsg, requestMsg.RequestId)
tr.sdk.Metadata.GetProcess(), requestMsg.GetFromNode(), err)
tr.processRunnerError(msg, errMsg, requestMsg.GetRequestId())

return
}

if tr.postprocessor != nil {
err := tr.postprocessor(hSdk, requestMsg.Payload)
err := tr.postprocessor(hSdk, requestMsg.GetPayload())
if err != nil {
errMsg := fmt.Sprintf("Error in node %q executing handler postprocessor for node %q: %s",
tr.sdk.Metadata.GetProcess(), requestMsg.FromNode, err)
tr.processRunnerError(msg, errMsg, requestMsg.RequestId)
tr.sdk.Metadata.GetProcess(), requestMsg.GetFromNode(), err)
tr.processRunnerError(msg, errMsg, requestMsg.GetRequestId())

return
}
Expand Down Expand Up @@ -246,7 +246,7 @@ func (tr *Runner) getOutputSubject(channel string) string {
func (tr *Runner) prepareOutputMessage(msg []byte) ([]byte, error) {
maxSize, err := tr.getMaxMessageSize()
if err != nil {
return nil, fmt.Errorf("error getting max message size: %s", err) //nolint:goerr113 // error is wrapped
return nil, fmt.Errorf("error getting max message size: %w", err)
}

lenMsg := int64(len(msg))
Expand Down
4 changes: 2 additions & 2 deletions runner/task/task_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"github.com/nats-io/nats.go"
"go.opentelemetry.io/otel/metric"

"github.com/konstellation-io/kai-sdk/go-sdk/v1/runner/common"
"github.com/konstellation-io/kai-sdk/go-sdk/v1/sdk"
"github.com/konstellation-io/kai-gosdk/runner/common"
"github.com/konstellation-io/kai-gosdk/sdk"
)

const _taskLoggerName = "[TASK]"
Expand Down
4 changes: 2 additions & 2 deletions runner/trigger/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (

"google.golang.org/protobuf/types/known/anypb"

"github.com/konstellation-io/kai-sdk/go-sdk/v1/runner/common"
"github.com/konstellation-io/kai-sdk/go-sdk/v1/sdk"
"github.com/konstellation-io/kai-gosdk/runner/common"
"github.com/konstellation-io/kai-gosdk/sdk"
)

const (
Expand Down
Loading

0 comments on commit 50f9d7a

Please sign in to comment.