Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wasm executor to follow the new error pattern #4402

Closed
wants to merge 1 commit into from
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
2 changes: 1 addition & 1 deletion cmd/cli/wasm/wasm_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/bacalhau-project/bacalhau/cmd/util/parse"
"github.com/bacalhau-project/bacalhau/cmd/util/printer"
"github.com/bacalhau-project/bacalhau/pkg/executor/wasm"
engine_wasm "github.com/bacalhau-project/bacalhau/pkg/executor/wasm/models"
engine_wasm "github.com/bacalhau-project/bacalhau/pkg/executor/wasm"
"github.com/bacalhau-project/bacalhau/pkg/models"
"github.com/bacalhau-project/bacalhau/pkg/publicapi/apimodels"
clientv2 "github.com/bacalhau-project/bacalhau/pkg/publicapi/client/v2"
Expand Down
2 changes: 1 addition & 1 deletion pkg/bidstrategy/semantic/storage_installed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/stretchr/testify/require"

wasmmodels "github.com/bacalhau-project/bacalhau/pkg/executor/wasm/models"
wasmmodels "github.com/bacalhau-project/bacalhau/pkg/executor/wasm"
"github.com/bacalhau-project/bacalhau/pkg/lib/provider"
"github.com/bacalhau-project/bacalhau/pkg/models"
"github.com/bacalhau-project/bacalhau/pkg/test/mock"
Expand Down
6 changes: 3 additions & 3 deletions pkg/compute/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

"github.com/bacalhau-project/bacalhau/pkg/compute/store"
"github.com/bacalhau-project/bacalhau/pkg/executor"
wasmmodels "github.com/bacalhau-project/bacalhau/pkg/executor/wasm/models"
"github.com/bacalhau-project/bacalhau/pkg/executor/wasm"
"github.com/bacalhau-project/bacalhau/pkg/publisher"
"github.com/bacalhau-project/bacalhau/pkg/storage"
"github.com/bacalhau-project/bacalhau/pkg/system"
Expand Down Expand Up @@ -80,7 +80,7 @@ func prepareInputVolumes(
func prepareWasmVolumes(
ctx context.Context,
strgprovider storage.StorageProvider,
storageDirectory string, wasmEngine wasmmodels.EngineSpec) (
storageDirectory string, wasmEngine wasm.EngineSpec) (
map[string][]storage.PreparedStorage, func(context.Context) error, error,
) {
importModuleVolumes, err := storage.ParallelPrepareStorage(ctx, strgprovider, storageDirectory, wasmEngine.ImportModules...)
Expand Down Expand Up @@ -156,7 +156,7 @@ func PrepareRunArguments(
*/
var engineArgs *models.SpecConfig
if execution.Job.Task().Engine.IsType(models.EngineWasm) {
wasmEngine, err := wasmmodels.DecodeSpec(execution.Job.Task().Engine)
wasmEngine, err := wasm.DecodeSpec(execution.Job.Task().Engine)
if err != nil {
return nil, nil, err
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/executor/wasm/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (

"github.com/bacalhau-project/bacalhau/pkg/bidstrategy"
"github.com/bacalhau-project/bacalhau/pkg/executor"
wasmmodels "github.com/bacalhau-project/bacalhau/pkg/executor/wasm/models"
wasmlogs "github.com/bacalhau-project/bacalhau/pkg/logger/wasm"
"github.com/bacalhau-project/bacalhau/pkg/storage"
"github.com/bacalhau-project/bacalhau/pkg/storage/util"
Expand Down Expand Up @@ -91,7 +90,7 @@ func (e *Executor) Start(ctx context.Context, request *executor.RunCommandReques
engineConfig = engineConfig.WithMemoryLimitPages(uint32(requestedPages))
}

engineParams, err := wasmmodels.DecodeArguments(request.EngineParams)
engineParams, err := DecodeArguments(request.EngineParams)
if err != nil {
return fmt.Errorf("decoding wasm arguments: %w", err)
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/executor/wasm/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"golang.org/x/exp/maps"

"github.com/bacalhau-project/bacalhau/pkg/executor"
wasmmodels "github.com/bacalhau-project/bacalhau/pkg/executor/wasm/models"
wasmlogs "github.com/bacalhau-project/bacalhau/pkg/logger/wasm"
"github.com/bacalhau-project/bacalhau/pkg/models"
"github.com/bacalhau-project/bacalhau/pkg/storage"
Expand All @@ -29,7 +28,7 @@ type executionHandler struct {
// runtime configured with resource-limits
runtime wazero.Runtime
// arguments used to instantiate and run the wasm module
arguments *wasmmodels.EngineArguments
arguments *EngineArguments
// virtual filesystem exposed to wasm module
fs fs.FS
// wasm modules imported by main wasm module
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package models
package wasm

import (
"encoding/json"
Expand Down
2 changes: 1 addition & 1 deletion pkg/models/utils/job.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package utils

import (
wasm "github.com/bacalhau-project/bacalhau/pkg/executor/wasm/models"
"github.com/bacalhau-project/bacalhau/pkg/executor/wasm"
"github.com/bacalhau-project/bacalhau/pkg/models"
"github.com/rs/zerolog/log"
"github.com/samber/lo"
Expand Down
2 changes: 1 addition & 1 deletion pkg/test/devstack/default_publisher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"os"
"testing"

wasmmodels "github.com/bacalhau-project/bacalhau/pkg/executor/wasm/models"
wasmmodels "github.com/bacalhau-project/bacalhau/pkg/executor/wasm"
_ "github.com/bacalhau-project/bacalhau/pkg/logger"
"github.com/bacalhau-project/bacalhau/pkg/models"
"github.com/bacalhau-project/bacalhau/pkg/publisher/local"
Expand Down
2 changes: 1 addition & 1 deletion pkg/test/devstack/multiple_input_files_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"github.com/bacalhau-project/bacalhau/pkg/devstack"
"github.com/bacalhau-project/bacalhau/pkg/downloader"
wasmmodels "github.com/bacalhau-project/bacalhau/pkg/executor/wasm/models"
wasmmodels "github.com/bacalhau-project/bacalhau/pkg/executor/wasm"
"github.com/bacalhau-project/bacalhau/pkg/models"
publisher_local "github.com/bacalhau-project/bacalhau/pkg/publisher/local"

Expand Down
2 changes: 1 addition & 1 deletion pkg/test/devstack/publish_on_error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/bacalhau-project/bacalhau/pkg/devstack"
"github.com/bacalhau-project/bacalhau/pkg/downloader"
wasmmodels "github.com/bacalhau-project/bacalhau/pkg/executor/wasm/models"
wasmmodels "github.com/bacalhau-project/bacalhau/pkg/executor/wasm"
_ "github.com/bacalhau-project/bacalhau/pkg/logger"
"github.com/bacalhau-project/bacalhau/pkg/models"
publisher_local "github.com/bacalhau-project/bacalhau/pkg/publisher/local"
Expand Down
2 changes: 1 addition & 1 deletion pkg/test/devstack/url_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/bacalhau-project/bacalhau/pkg/config/types"
"github.com/bacalhau-project/bacalhau/pkg/devstack"
"github.com/bacalhau-project/bacalhau/pkg/downloader"
wasmmodels "github.com/bacalhau-project/bacalhau/pkg/executor/wasm/models"
wasmmodels "github.com/bacalhau-project/bacalhau/pkg/executor/wasm"
"github.com/bacalhau-project/bacalhau/pkg/models"
"github.com/bacalhau-project/bacalhau/pkg/node"
publisher_local "github.com/bacalhau-project/bacalhau/pkg/publisher/local"
Expand Down
2 changes: 1 addition & 1 deletion pkg/test/logstream/stream_wasm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/bacalhau-project/bacalhau/pkg/test/mock"
"github.com/bacalhau-project/bacalhau/testdata/wasm/cat"

wasmmodels "github.com/bacalhau-project/bacalhau/pkg/executor/wasm/models"
wasmmodels "github.com/bacalhau-project/bacalhau/pkg/executor/wasm"
)

func (s *LogStreamTestSuite) TestWasmOutputStream() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/test/scenario/test_scenarios.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/bacalhau-project/bacalhau/pkg/devstack"
"github.com/bacalhau-project/bacalhau/pkg/downloader"
dockmodels "github.com/bacalhau-project/bacalhau/pkg/executor/docker/models"
wasmmodels "github.com/bacalhau-project/bacalhau/pkg/executor/wasm/models"
wasmmodels "github.com/bacalhau-project/bacalhau/pkg/executor/wasm"
"github.com/bacalhau-project/bacalhau/pkg/models"
publisher_local "github.com/bacalhau-project/bacalhau/pkg/publisher/local"
"github.com/bacalhau-project/bacalhau/testdata/wasm/cat"
Expand Down
Loading