You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by GitBox <gi...@apache.org> on 2022/12/15 07:27:53 UTC
[GitHub] [incubator-devlake] klesh opened a new pull request, #3943: refactor: use basicRes everywhere except the `service` module
klesh opened a new pull request, #3943:
URL: https://github.com/apache/incubator-devlake/pull/3943
### Summary
This is a long overdue task. When working on issue #3709 I found it is a prerequiste for the problem to be solved in a more compact and reliable manner
### Does this close any open issues?
Prerequiste of #3709
### Screenshots
I did my best to test it out, but there are too many other bugs causing the pipeline to finish successfully.
But it seems working fine.



--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] likyh commented on a diff in pull request #3943: refactor: use basicRes everywhere except the `service` module
Posted by GitBox <gi...@apache.org>.
likyh commented on code in PR #3943:
URL: https://github.com/apache/incubator-devlake/pull/3943#discussion_r1049397714
##########
runner/run_pipeline.go:
##########
@@ -23,23 +23,21 @@ import (
"github.com/apache/incubator-devlake/errors"
"github.com/apache/incubator-devlake/models"
"github.com/apache/incubator-devlake/plugins/core"
- "github.com/spf13/viper"
- "gorm.io/gorm"
+ "github.com/apache/incubator-devlake/plugins/core/dal"
)
// RunPipeline FIXME ...
func RunPipeline(
- _ *viper.Viper,
- log core.Logger,
- db *gorm.DB,
+ basicRes core.BasicRes,
pipelineId uint64,
runTasks func([]uint64) errors.Error,
) errors.Error {
// load tasks for pipeline
+ db := basicRes.GetDal()
var tasks []models.Task
- err := db.Where("pipeline_id = ? AND status = ?", pipelineId, models.TASK_CREATED).Order("pipeline_row, pipeline_col").Find(&tasks).Error
+ err := db.All(&tasks, dal.Where("pipeline_id = ? AND status = ?", pipelineId, models.TASK_CREATED))
Review Comment:
why delete the order? I think it's necessary.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] klesh merged pull request #3943: refactor: use basicRes everywhere except the `service` module
Posted by GitBox <gi...@apache.org>.
klesh merged PR #3943:
URL: https://github.com/apache/incubator-devlake/pull/3943
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] likyh commented on a diff in pull request #3943: refactor: use basicRes everywhere except the `service` module
Posted by GitBox <gi...@apache.org>.
likyh commented on code in PR #3943:
URL: https://github.com/apache/incubator-devlake/pull/3943#discussion_r1049391763
##########
services/init.go:
##########
@@ -50,28 +49,23 @@ const failToCreateCronJob = "created cron job failed"
// Init the services module
func Init() {
var err error
- // basic resources initialization
cfg = config.GetConfig()
log = logger.Global
- db, err = runner.NewGormDb(cfg, logger.Global.Nested("db"))
- if err != nil {
- panic(err)
- }
- // gorm doesn't support creating a PrepareStmt=false session from a PrepareStmt=true
- // but the lockDatabase needs PrepareStmt=false for table locking, we have to deal with it here
- lockingDb, err := runner.NewGormDbEx(cfg, logger.Global.Nested("migrator db"), &dal.SessionConfig{
- PrepareStmt: false,
- SkipDefaultTransaction: true,
- })
- if err != nil {
- panic(err)
- }
- err = lockDatabase(dalgorm.NewDalgorm(lockingDb))
+ db, err = runner.NewGormDb(cfg, log)
+ print("init db", db)
Review Comment:
use logger?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org