clean up logging

This commit is contained in:
Brian Gough 2017-08-03 10:56:16 +01:00
parent 0a859d3b33
commit fb29ac3031

View file

@ -29,7 +29,6 @@ module.exports = ClsiManager =
ClsiManager._buildRequest project_id, options, (error, req) -> ClsiManager._buildRequest project_id, options, (error, req) ->
return callback(error) if error? return callback(error) if error?
logger.log project_id: project_id, "sending compile to CLSI" logger.log project_id: project_id, "sending compile to CLSI"
console.log "REQUEST", JSON.stringify(req, null, 2)
ClsiFormatChecker.checkRecoursesForProblems req.compile?.resources, (err, validationProblems)-> ClsiFormatChecker.checkRecoursesForProblems req.compile?.resources, (err, validationProblems)->
if err? if err?
logger.err err, project_id, "could not check resources for potential problems before sending to clsi" logger.err err, project_id, "could not check resources for potential problems before sending to clsi"
@ -41,10 +40,7 @@ module.exports = ClsiManager =
if error? if error?
logger.err err:error, project_id:project_id, "error sending request to clsi" logger.err err:error, project_id:project_id, "error sending request to clsi"
return callback(error) return callback(error)
if response?.compile?.status is "conflict" logger.log project_id: project_id, outputFilesLength: response?.outputFiles?.length, status: response?.status, compile_status: response?.compile?.status, "received compile response from CLSI"
# FIXME try again without incremental option
console.log "CONFLICT TRY AGAIN"
logger.log project_id: project_id, outputFilesLength: response?.outputFiles?.length, status: response?.status, "received compile response from CLSI"
ClsiCookieManager._getServerId project_id, (err, clsiServerId)-> ClsiCookieManager._getServerId project_id, (err, clsiServerId)->
if err? if err?
logger.err err:err, project_id:project_id, "error getting server id" logger.err err:err, project_id:project_id, "error getting server id"
@ -124,7 +120,6 @@ module.exports = ClsiManager =
ProjectGetter.getProject project_id, {compiler: 1, rootDoc_id: 1, imageName: 1, rootFolder:1}, (error, project) -> ProjectGetter.getProject project_id, {compiler: 1, rootDoc_id: 1, imageName: 1, rootFolder:1}, (error, project) ->
return callback(error) if error? return callback(error) if error?
return callback(new Errors.NotFoundError("project does not exist: #{project_id}")) if !project? return callback(new Errors.NotFoundError("project does not exist: #{project_id}")) if !project?
console.log "PROJECT", project, JSON.stringify(project.rootFolder,null,2)
if project.compiler not in ClsiManager.VALID_COMPILERS if project.compiler not in ClsiManager.VALID_COMPILERS
project.compiler = "pdflatex" project.compiler = "pdflatex"
@ -137,20 +132,17 @@ module.exports = ClsiManager =
# make this incremental # make this incremental
ProjectEntityHandler.getAllDocPathsFromProject project, (error, docPath) -> ProjectEntityHandler.getAllDocPathsFromProject project, (error, docPath) ->
return callback(error) if error? return callback(error) if error?
console.log "PATHS", docPath
console.log "DOCS", docUpdaterDocs
docs = {} docs = {}
for doc in docUpdaterDocs or [] for doc in docUpdaterDocs or []
path = docPath[doc._id] path = docPath[doc._id]
docs[path] = doc docs[path] = doc
console.log "MAPPED DOCS", docs
options.incremental = projectState options.incremental = projectState
ClsiManager._finaliseRequest project_id, options, project, docs, [], callback ClsiManager._finaliseRequest project_id, options, project, docs, [], callback
else else
ClsiManager._getContentFromMongo project_id, (error, docs, files) -> ClsiManager._getContentFromMongo project_id, (error, docs, files) ->
return callback(error) if error? return callback(error) if error?
console.log "DOCS", docs # FIXME want to store state after project has been sent to
# FIXME want to store state after project has been sent to clsi # clsi, but need to do it here.
ClsiStateManager.setProjectState project_id, project, (error, projectState) -> ClsiStateManager.setProjectState project_id, project, (error, projectState) ->
if error? if error?
logger.err err:error, project_id:project_id, "error storing state in redis" logger.err err:error, project_id:project_id, "error storing state in redis"