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

Log ouput Issues #767

Open
cd-home opened this issue May 25, 2022 · 1 comment
Open

Log ouput Issues #767

cd-home opened this issue May 25, 2022 · 1 comment

Comments

@cd-home
Copy link

cd-home commented May 25, 2022

INFO: 2022/05/25 17:52:39 worker.go:58 Launching a worker with the following settings:
INFO: 2022/05/25 17:52:39 worker.go:59 - Broker: ://
INFO: 2022/05/25 17:52:39 worker.go:61 - DefaultQueue: machinery_tasks
INFO: 2022/05/25 17:52:39 worker.go:65 - ResultBackend: ://
INFO: 2022/05/25 17:52:39 goredis.go:110 [*] Waiting for messages. To exit press CTRL+C

TIPS: if use iface mode
cnf := &config.Config{
DefaultQueue: "machinery_tasks",
ResultsExpireIn: 3600,
Redis: &config.RedisConfig{
MaxIdle: 3,
IdleTimeout: 240,
ReadTimeout: 15,
WriteTimeout: 15,
ConnectTimeout: 15,
NormalTasksPollPeriod: 1000,
DelayedTasksPollPeriod: 500,
},
}
broker := redisbroker.NewGR(cnf, []string{"127.0.0.1:6379"}, 0)
backend := redisbackend.NewGR(cnf, []string{"127.0.0.1:6379"}, 0)
lock := eagerlock.New()
server := machinery.NewServer(cnf, broker, backend, lock)
server.RegisterTask("sun", Sum)

worker := server.NewWorker("worker", 0)
worker.Launch()

------ LOG -----------
// LaunchAsync is a non blocking version of Launch
func (worker *Worker) LaunchAsync(errorsChan chan<- error) {
cnf := worker.server.GetConfig()
broker := worker.server.GetBroker()

// Log some useful information about worker configuration
log.INFO.Printf("Launching a worker with the following settings:")
log.INFO.Printf("- Broker: %s", RedactURL(cnf.Broker))
if worker.Queue == "" {
	log.INFO.Printf("- DefaultQueue: %s", cnf.DefaultQueue)
} else {
	log.INFO.Printf("- CustomQueue: %s", worker.Queue)
}
log.INFO.Printf("- ResultBackend: %s", RedactURL(cnf.ResultBackend))

......
}

in fact, backedn and broker read from conf

@cd-home
Copy link
Author

cd-home commented May 30, 2022

func NewGR(cnf *config.Config, addrs []string, db int) iface.Broker {
.......
cnf.Broker = strings.Join(ropt.Addrs, ", ")
....
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant