Commit b55851a3 authored by Joerg-Holger Panzer's avatar Joerg-Holger Panzer
Browse files

Clean up the converter log

simplify the log
parent 90f073a4
Pipeline #303194 failed with stages
in 9 minutes and 25 seconds
......@@ -197,7 +197,7 @@ func SaveIndexerJob(c echo.Context) error {
return c.JSON(http.StatusInternalServerError, job)
}
// put API based indexing jobs to the begin start (queue start is right)
// put API based indexing jobs to the start (queue start is right)
_, err = redisClient.RPush(config.RedisIndexQueue, b).Result()
if err != nil {
makeLogEntry(nil).Infof("Could not push indexing job for %s, due to %s", job.Document, err)
......@@ -300,7 +300,6 @@ func saveConverterJob(c echo.Context) error {
return c.JSON(http.StatusUnprocessableEntity, job)
}
//makeLogEntry(nil).Infof("Conversion job for %s already staged", job.LogID)
job.ResponseMessage = "staged"
return c.JSON(http.StatusOK, job)
......@@ -312,7 +311,6 @@ func saveConverterJob(c echo.Context) error {
// job in the meantime already staged
if !isNew {
//makeLogEntry(nil).Infof("Conversion job for %s already staged", job.LogID)
job.ResponseMessage = "staged"
return c.JSON(http.StatusOK, job)
}
......@@ -393,7 +391,7 @@ func saveManifestJob(c echo.Context) error {
return c.JSON(http.StatusInternalServerError, job)
}
// put API based indexing jobs to the begin start (queue start is right)
// put API based indexing jobs to the start (queue start is right)
_, err = redisClient.RPush(config.RedisIiifManifestQueue, string(jsonData)).Result()
if err != nil {
makeLogEntry(nil).Infof("Could not push manifest creation job for %s, due to %s", job.Document, err)
......@@ -480,20 +478,20 @@ func saveCitationJob(c echo.Context) error {
b, err := json.Marshal(job)
if err != nil {
makeLogEntry(nil).Infof("Could not marshal indexing job %v for %s, due to %s", job, job.LogID, err.Error())
job.ResponseMessage = fmt.Sprintf("Could not marshal indexing job %v for %s, due to %s", job, job.LogID, err.Error())
makeLogEntry(nil).Infof("Could not marshal Citation job %v for %s, due to %s", job, job.LogID, err.Error())
job.ResponseMessage = fmt.Sprintf("Could not marshal Citation job %v for %s, due to %s", job, job.LogID, err.Error())
return c.JSON(http.StatusInternalServerError, job)
}
// put API based indexing jobs to the begin start (queue start is right)
// put API based indexing jobs to the start (queue start is right)
_, err = redisClient.RPush(config.RedisIndexQueue, b).Result()
if err != nil {
makeLogEntry(nil).Infof("Could not push indexing job for %s, due to %s", job.Document, err)
job.ResponseMessage = fmt.Sprintf("Could not push indexing job for %s, due to %s", job.Document, err)
makeLogEntry(nil).Infof("Could not push Citation job for %s, due to %s", job.Document, err)
job.ResponseMessage = fmt.Sprintf("Could not push Citation job for %s, due to %s", job.Document, err)
return c.JSON(http.StatusInternalServerError, job)
}
makeLogEntry(nil).Infof("Indexing job staged for %s", job.Document)
makeLogEntry(nil).Infof("Citation job staged for %s", job.Document)
job.ResponseMessage = "staged"
return c.JSON(http.StatusOK, job)
}
......@@ -572,20 +570,20 @@ func saveInfojsonJob(c echo.Context) error {
b, err := json.Marshal(job)
if err != nil {
makeLogEntry(nil).Infof("Could not marshal indexing job %v for %s, due to %s", job, job.LogID, err.Error())
job.ResponseMessage = fmt.Sprintf("Could not marshal indexing job %v for %s, due to %s", job, job.LogID, err.Error())
makeLogEntry(nil).Infof("Could not marshal infojson creation jobs %v for %s, due to %s", job, job.LogID, err.Error())
job.ResponseMessage = fmt.Sprintf("Could not marshal infojson creation jobs %v for %s, due to %s", job, job.LogID, err.Error())
return c.JSON(http.StatusInternalServerError, job)
}
// put API based indexing jobs to the begin start (queue start is right)
_, err = redisClient.RPush(config.RedisIndexQueue, b).Result()
// put API based infojson creation jobs to the start (queue start is right)
_, err = redisClient.RPush(config.RedisInfoJsonQueue, b).Result()
if err != nil {
makeLogEntry(nil).Infof("Could not push indexing job for %s, due to %s", job.Document, err)
job.ResponseMessage = fmt.Sprintf("Could not push indexing job for %s, due to %s", job.Document, err)
makeLogEntry(nil).Infof("Could not push infojson creation jobs for %s, due to %s", job.Document, err)
job.ResponseMessage = fmt.Sprintf("Could not push infojson creation jobs for %s, due to %s", job.Document, err)
return c.JSON(http.StatusInternalServerError, job)
}
makeLogEntry(nil).Infof("Indexing job staged for %s", job.Document)
makeLogEntry(nil).Infof("Infojson creation jobs job staged for %s", job.Document)
job.ResponseMessage = "staged"
return c.JSON(http.StatusOK, job)
}
......@@ -595,11 +593,11 @@ func saveInfojsonJob(c echo.Context) error {
//
// e.GET("/api/infojson/jobs", getNumberOfInfojsonJobs)
func getNumberOfInfojsonJobs(c echo.Context) error {
log.Debugf("config.IndexerCtxPath: %s", config.IndexerCtxPath)
log.Debugf("config.InfojsonCtxPath: %s", config.InfojsonCtxPath)
queue := new(Queue)
queue.Name = config.RedisIndexQueue
queue.Name = config.RedisInfoJsonQueue
val, err := redisClient.LLen(queue.Name).Result()
if err != nil {
makeLogEntry(nil).Infof("Could not request redis, due to %s", err.Error())
......@@ -616,15 +614,15 @@ func getNumberOfInfojsonJobs(c echo.Context) error {
//
// e.GET("/api/infojson/jobs/recreate", doRecreateInfojsons)
func doRecreateInfojsons(c echo.Context) error {
log.Debugf("config.ReindexerCtxPath: %s", config.ReindexerCtxPath)
log.Debugf("config.RecreateInfojsonCtxPath: %s", config.RecreateInfojsonCtxPath)
queue := new(Queue)
queue.Name = config.RedisIndexQueue
queue.Name = config.RedisInfoJsonQueue
go helper.IndexAll()
//go helper.RecreateAll()
makeLogEntry(nil).Infoln("Indexer queue deleted, reindex started")
queue.ResponseMessage = "Reindex started"
makeLogEntry(nil).Infoln("Infojson creation jobs queue deleted, recreate started")
queue.ResponseMessage = "Recreate of Infojson started"
return c.JSON(http.StatusOK, queue)
}
......@@ -704,10 +702,8 @@ func existInRedisHQueue(queue string, key string) bool {
val, err := redisClient.HGet(queue, key).Result()
if err != nil {
//makeLogEntry(nil).Infof("id %s not yet in the queue %s (%v)", key, queue, val)
return false
} else {
//makeLogEntry(nil).Infof("id %s is in the queue %s (%v)", key, queue, val)
return true
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment