Skip to content

Commit

Permalink
Merge branch 'main' of github.com:g-research/fasttrackml
Browse files Browse the repository at this point in the history
  • Loading branch information
suprjinx committed Jul 25, 2024
2 parents 7c0e35d + 0c99869 commit 2726743
Show file tree
Hide file tree
Showing 31 changed files with 45 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ packages:
TagRepositoryProvider:
LogRepositoryProvider:
ArtifactRepositoryProvider:
github.com/G-Research/fasttrackml/pkg/api/mlflow/services/artifact/storage:
github.com/G-Research/fasttrackml/pkg/common/services/artifact/storage:
interfaces:
ArtifactStorageFactoryProvider:
ArtifactStorageProvider:
2 changes: 1 addition & 1 deletion pkg/api/aim/api/response/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
"github.com/G-Research/fasttrackml/pkg/api/aim/dao/repositories"
"github.com/G-Research/fasttrackml/pkg/api/aim/encoding"
mlflowCommon "github.com/G-Research/fasttrackml/pkg/api/mlflow/common"
"github.com/G-Research/fasttrackml/pkg/api/mlflow/services/artifact/storage"
"github.com/G-Research/fasttrackml/pkg/common"
"github.com/G-Research/fasttrackml/pkg/common/services/artifact/storage"
"github.com/G-Research/fasttrackml/pkg/database"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/api/aim/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/G-Research/fasttrackml/pkg/api/aim/services/project"
"github.com/G-Research/fasttrackml/pkg/api/aim/services/run"
"github.com/G-Research/fasttrackml/pkg/api/aim/services/tag"
"github.com/G-Research/fasttrackml/pkg/api/mlflow/services/artifact"
"github.com/G-Research/fasttrackml/pkg/common/services/artifact"
)

// Controller handles all the input HTTP requests.
Expand Down
4 changes: 2 additions & 2 deletions pkg/api/aim/controller/runs.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"github.com/G-Research/fasttrackml/pkg/api/aim/api/request"
"github.com/G-Research/fasttrackml/pkg/api/aim/api/response"
"github.com/G-Research/fasttrackml/pkg/api/aim/services/run"
mlflowRequest "github.com/G-Research/fasttrackml/pkg/api/mlflow/api/request"
"github.com/G-Research/fasttrackml/pkg/common/api"
commonRequest "github.com/G-Research/fasttrackml/pkg/common/api/request"
"github.com/G-Research/fasttrackml/pkg/common/middleware"
)

Expand All @@ -35,7 +35,7 @@ func (c Controller) GetRunInfo(ctx *fiber.Ctx) error {
return err
}

artifactReq := mlflowRequest.ListArtifactsRequest{
artifactReq := commonRequest.ListArtifactsRequest{
RunUUID: req.ID,
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/api/aim/services/run/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import (
"github.com/G-Research/fasttrackml/pkg/api/aim/common"
"github.com/G-Research/fasttrackml/pkg/api/aim/dao/models"
"github.com/G-Research/fasttrackml/pkg/api/aim/dao/repositories"
"github.com/G-Research/fasttrackml/pkg/api/mlflow/services/artifact/storage"
"github.com/G-Research/fasttrackml/pkg/common/api"
"github.com/G-Research/fasttrackml/pkg/common/dao/types"
"github.com/G-Research/fasttrackml/pkg/common/services/artifact/storage"
)

// allowed batch actions.
Expand Down
4 changes: 2 additions & 2 deletions pkg/api/mlflow/controller/artifacts.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import (
"github.com/rotisserie/eris"
log "github.com/sirupsen/logrus"

"github.com/G-Research/fasttrackml/pkg/api/mlflow/api/request"
"github.com/G-Research/fasttrackml/pkg/api/mlflow/api/response"
"github.com/G-Research/fasttrackml/pkg/api/mlflow/common"
"github.com/G-Research/fasttrackml/pkg/common/api"
"github.com/G-Research/fasttrackml/pkg/common/api/request"
"github.com/G-Research/fasttrackml/pkg/common/api/response"
"github.com/G-Research/fasttrackml/pkg/common/middleware"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/api/mlflow/controller/controller.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package controller

import (
"github.com/G-Research/fasttrackml/pkg/api/mlflow/services/artifact"
"github.com/G-Research/fasttrackml/pkg/api/mlflow/services/experiment"
"github.com/G-Research/fasttrackml/pkg/api/mlflow/services/metric"
"github.com/G-Research/fasttrackml/pkg/api/mlflow/services/model"
"github.com/G-Research/fasttrackml/pkg/api/mlflow/services/run"
"github.com/G-Research/fasttrackml/pkg/common/services/artifact"
)

// Controller handles all the input HTTP requests.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package response

import "github.com/G-Research/fasttrackml/pkg/api/mlflow/services/artifact/storage"
import "github.com/G-Research/fasttrackml/pkg/common/services/artifact/storage"

// FilePartialResponse is a partial response object for different responses.
type FilePartialResponse struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/stretchr/testify/assert"

"github.com/G-Research/fasttrackml/pkg/api/mlflow/services/artifact/storage"
"github.com/G-Research/fasttrackml/pkg/common/services/artifact/storage"
)

func TestNewListArtifactsResponse_Ok(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import (
"path/filepath"
"slices"

"github.com/G-Research/fasttrackml/pkg/api/mlflow/api/request"
"github.com/G-Research/fasttrackml/pkg/api/mlflow/dao/models"
"github.com/G-Research/fasttrackml/pkg/api/mlflow/dao/repositories"
"github.com/G-Research/fasttrackml/pkg/api/mlflow/services/artifact/storage"
"github.com/G-Research/fasttrackml/pkg/common/api"
"github.com/G-Research/fasttrackml/pkg/common/api/request"
"github.com/G-Research/fasttrackml/pkg/common/services/artifact/storage"
)

// Service provides service layer to work with `artifact` business logic.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/G-Research/fasttrackml/pkg/api/mlflow/api/request"
"github.com/G-Research/fasttrackml/pkg/api/mlflow/dao/models"
"github.com/G-Research/fasttrackml/pkg/api/mlflow/dao/repositories"
"github.com/G-Research/fasttrackml/pkg/api/mlflow/services/artifact/storage"
"github.com/G-Research/fasttrackml/pkg/common/api"
"github.com/G-Research/fasttrackml/pkg/common/api/request"
"github.com/G-Research/fasttrackml/pkg/common/services/artifact/storage"
)

func TestService_ListArtifacts_Ok(t *testing.T) {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"slices"
"strings"

"github.com/G-Research/fasttrackml/pkg/api/mlflow/api/request"
"github.com/G-Research/fasttrackml/pkg/common/api"
"github.com/G-Research/fasttrackml/pkg/common/api/request"
)

// ValidateListArtifactsRequest validates `GET /mlflow/artifacts/list` request.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/G-Research/fasttrackml/pkg/api/mlflow/api/request"
"github.com/G-Research/fasttrackml/pkg/common/api"
"github.com/G-Research/fasttrackml/pkg/common/api/request"
)

func TestValidateListArtifactsRequest_Ok(t *testing.T) {
Expand Down
8 changes: 4 additions & 4 deletions pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ import (
mlflowController "github.com/G-Research/fasttrackml/pkg/api/mlflow/controller"
mlflowRepositories "github.com/G-Research/fasttrackml/pkg/api/mlflow/dao/repositories"
mlflowService "github.com/G-Research/fasttrackml/pkg/api/mlflow/services"
mlflowArtifactService "github.com/G-Research/fasttrackml/pkg/api/mlflow/services/artifact"
"github.com/G-Research/fasttrackml/pkg/api/mlflow/services/artifact/storage"
mlflowExperimentService "github.com/G-Research/fasttrackml/pkg/api/mlflow/services/experiment"
mlflowMetricService "github.com/G-Research/fasttrackml/pkg/api/mlflow/services/metric"
mlflowModelService "github.com/G-Research/fasttrackml/pkg/api/mlflow/services/model"
Expand All @@ -40,6 +38,8 @@ import (
"github.com/G-Research/fasttrackml/pkg/common/dao"
"github.com/G-Research/fasttrackml/pkg/common/dao/repositories"
"github.com/G-Research/fasttrackml/pkg/common/middleware"
artifactService "github.com/G-Research/fasttrackml/pkg/common/services/artifact"
"github.com/G-Research/fasttrackml/pkg/common/services/artifact/storage"
"github.com/G-Research/fasttrackml/pkg/database"
adminUI "github.com/G-Research/fasttrackml/pkg/ui/admin"
adminUIController "github.com/G-Research/fasttrackml/pkg/ui/admin/controller"
Expand Down Expand Up @@ -285,7 +285,7 @@ func createApp(
artifactStorageFactory,
aimRepositories.NewArtifactRepository(db.GormDB()),
),
mlflowArtifactService.NewService(
artifactService.NewService(
mlflowRepositories.NewRunRepository(db.GormDB()),
artifactStorageFactory,
),
Expand Down Expand Up @@ -326,7 +326,7 @@ func createApp(
mlflowRepositories.NewRunRepository(db.GormDB()),
mlflowRepositories.NewMetricRepository(db.GormDB()),
),
mlflowArtifactService.NewService(
artifactService.NewService(
mlflowRepositories.NewRunRepository(db.GormDB()),
artifactStorageFactory,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
"github.com/stretchr/testify/suite"

"github.com/G-Research/fasttrackml/pkg/api/mlflow"
"github.com/G-Research/fasttrackml/pkg/api/mlflow/api/request"
"github.com/G-Research/fasttrackml/pkg/api/mlflow/dao/models"
"github.com/G-Research/fasttrackml/pkg/common/api"
"github.com/G-Research/fasttrackml/pkg/common/api/request"
"github.com/G-Research/fasttrackml/tests/integration/golang/helpers"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import (
"github.com/stretchr/testify/suite"

"github.com/G-Research/fasttrackml/pkg/api/mlflow"
"github.com/G-Research/fasttrackml/pkg/api/mlflow/api/request"
"github.com/G-Research/fasttrackml/pkg/api/mlflow/dao/models"
"github.com/G-Research/fasttrackml/pkg/common/api"
"github.com/G-Research/fasttrackml/pkg/common/api/request"
"github.com/G-Research/fasttrackml/tests/integration/golang/helpers"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import (
"github.com/stretchr/testify/suite"

"github.com/G-Research/fasttrackml/pkg/api/mlflow"
"github.com/G-Research/fasttrackml/pkg/api/mlflow/api/request"
"github.com/G-Research/fasttrackml/pkg/api/mlflow/dao/models"
"github.com/G-Research/fasttrackml/pkg/common/api"
"github.com/G-Research/fasttrackml/pkg/common/api/request"
"github.com/G-Research/fasttrackml/tests/integration/golang/helpers"
)

Expand Down
4 changes: 2 additions & 2 deletions tests/integration/golang/mlflow/artifact/list_gs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
"github.com/stretchr/testify/suite"

"github.com/G-Research/fasttrackml/pkg/api/mlflow"
"github.com/G-Research/fasttrackml/pkg/api/mlflow/api/request"
"github.com/G-Research/fasttrackml/pkg/api/mlflow/api/response"
"github.com/G-Research/fasttrackml/pkg/api/mlflow/dao/models"
"github.com/G-Research/fasttrackml/pkg/common/api"
"github.com/G-Research/fasttrackml/pkg/common/api/request"
"github.com/G-Research/fasttrackml/pkg/common/api/response"
"github.com/G-Research/fasttrackml/tests/integration/golang/helpers"
)

Expand Down
4 changes: 2 additions & 2 deletions tests/integration/golang/mlflow/artifact/list_local_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import (
"github.com/stretchr/testify/suite"

"github.com/G-Research/fasttrackml/pkg/api/mlflow"
"github.com/G-Research/fasttrackml/pkg/api/mlflow/api/request"
"github.com/G-Research/fasttrackml/pkg/api/mlflow/api/response"
"github.com/G-Research/fasttrackml/pkg/api/mlflow/dao/models"
"github.com/G-Research/fasttrackml/pkg/common/api"
"github.com/G-Research/fasttrackml/pkg/common/api/request"
"github.com/G-Research/fasttrackml/pkg/common/api/response"
"github.com/G-Research/fasttrackml/tests/integration/golang/helpers"
)

Expand Down
4 changes: 2 additions & 2 deletions tests/integration/golang/mlflow/artifact/list_s3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import (
"github.com/stretchr/testify/suite"

"github.com/G-Research/fasttrackml/pkg/api/mlflow"
"github.com/G-Research/fasttrackml/pkg/api/mlflow/api/request"
"github.com/G-Research/fasttrackml/pkg/api/mlflow/api/response"
"github.com/G-Research/fasttrackml/pkg/api/mlflow/dao/models"
"github.com/G-Research/fasttrackml/pkg/common/api"
"github.com/G-Research/fasttrackml/pkg/common/api/request"
"github.com/G-Research/fasttrackml/pkg/common/api/response"
"github.com/G-Research/fasttrackml/tests/integration/golang/helpers"
)

Expand Down
28 changes: 15 additions & 13 deletions tests/integration/golang/mlflow/namespace/flows/artifact_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (
"github.com/G-Research/fasttrackml/pkg/api/mlflow/common"
"github.com/G-Research/fasttrackml/pkg/api/mlflow/dao/models"
"github.com/G-Research/fasttrackml/pkg/common/api"
commonRequest "github.com/G-Research/fasttrackml/pkg/common/api/request"
commonResponse "github.com/G-Research/fasttrackml/pkg/common/api/response"
"github.com/G-Research/fasttrackml/tests/integration/golang/helpers"
)

Expand Down Expand Up @@ -149,19 +151,19 @@ func (s *ArtifactFlowTestSuite) testRunArtifactFlow(
s.Require().Nil(err)

// test `GET /artifacts/list` endpoint.
s.listRunArtifactsAndCompare(namespace1Code, request.ListArtifactsRequest{
s.listRunArtifactsAndCompare(namespace1Code, commonRequest.ListArtifactsRequest{
RunID: run1ID,
}, []response.FilePartialResponse{
}, []commonResponse.FilePartialResponse{
{
Path: "artifact1.file",
IsDir: false,
FileSize: 8,
},
})

s.listRunArtifactsAndCompare(namespace2Code, request.ListArtifactsRequest{
s.listRunArtifactsAndCompare(namespace2Code, commonRequest.ListArtifactsRequest{
RunID: run2ID,
}, []response.FilePartialResponse{
}, []commonResponse.FilePartialResponse{
{
Path: "artifact2.file",
IsDir: false,
Expand All @@ -177,7 +179,7 @@ func (s *ArtifactFlowTestSuite) testRunArtifactFlow(
s.MlflowClient().WithNamespace(
namespace2Code,
).WithQuery(
request.ListArtifactsRequest{
commonRequest.ListArtifactsRequest{
RunID: run1ID,
},
).WithResponse(
Expand All @@ -194,7 +196,7 @@ func (s *ArtifactFlowTestSuite) testRunArtifactFlow(
s.MlflowClient().WithNamespace(
namespace1Code,
).WithQuery(
request.ListArtifactsRequest{
commonRequest.ListArtifactsRequest{
RunID: run2ID,
},
).WithResponse(
Expand All @@ -207,12 +209,12 @@ func (s *ArtifactFlowTestSuite) testRunArtifactFlow(
s.Equal(api.ErrorCodeResourceDoesNotExist, string(resp.ErrorCode))

// test `GET /artifacts/get` endpoint.
s.getRunArtifactAndCompare(namespace1Code, request.GetArtifactRequest{
s.getRunArtifactAndCompare(namespace1Code, commonRequest.GetArtifactRequest{
RunID: run1ID,
Path: "artifact1.file",
}, "content1")

s.getRunArtifactAndCompare(namespace2Code, request.GetArtifactRequest{
s.getRunArtifactAndCompare(namespace2Code, commonRequest.GetArtifactRequest{
RunID: run2ID,
Path: "artifact2.file",
}, "content2")
Expand All @@ -225,7 +227,7 @@ func (s *ArtifactFlowTestSuite) testRunArtifactFlow(
s.MlflowClient().WithNamespace(
namespace2Code,
).WithQuery(
request.GetArtifactRequest{
commonRequest.GetArtifactRequest{
RunID: run1ID,
},
).WithResponse(
Expand All @@ -242,7 +244,7 @@ func (s *ArtifactFlowTestSuite) testRunArtifactFlow(
s.MlflowClient().WithNamespace(
namespace1Code,
).WithQuery(
request.ListArtifactsRequest{
commonRequest.ListArtifactsRequest{
RunID: run2ID,
},
).WithResponse(
Expand Down Expand Up @@ -274,9 +276,9 @@ func (s *ArtifactFlowTestSuite) createRun(namespace string, req *request.CreateR
}

func (s *ArtifactFlowTestSuite) listRunArtifactsAndCompare(
namespace string, req request.ListArtifactsRequest, expectedResponse []response.FilePartialResponse,
namespace string, req commonRequest.ListArtifactsRequest, expectedResponse []commonResponse.FilePartialResponse,
) {
actualResponse := response.ListArtifactsResponse{}
actualResponse := commonResponse.ListArtifactsResponse{}
s.Require().Nil(
s.MlflowClient().WithNamespace(
namespace,
Expand All @@ -292,7 +294,7 @@ func (s *ArtifactFlowTestSuite) listRunArtifactsAndCompare(
}

func (s *ArtifactFlowTestSuite) getRunArtifactAndCompare(
namespace string, req request.GetArtifactRequest, expectedResponse string,
namespace string, req commonRequest.GetArtifactRequest, expectedResponse string,
) {
actualResponse := new(bytes.Buffer)
s.Require().Nil(s.MlflowClient().WithNamespace(
Expand Down

0 comments on commit 2726743

Please sign in to comment.