mvp
needs hacked pacth in docker runner wip most tests pass
This commit is contained in:
@@ -5,7 +5,9 @@ logger.info "using standard command runner"
|
||||
|
||||
module.exports = CommandRunner =
|
||||
run: (project_id, command, directory, image, timeout, environment, callback = (error) ->) ->
|
||||
console.log("Command runner", directory)
|
||||
command = (arg.replace('$COMPILE_DIR', directory) for arg in command)
|
||||
console.log("Command runner 2", command)
|
||||
logger.log project_id: project_id, command: command, directory: directory, "running command"
|
||||
logger.warn "timeouts and sandboxing are not enabled with CommandRunner"
|
||||
|
||||
|
||||
@@ -34,11 +34,14 @@ module.exports = CompileController =
|
||||
status = "error"
|
||||
code = 500
|
||||
logger.error err: error, project_id: request.project_id, "error running compile"
|
||||
|
||||
else
|
||||
status = "failure"
|
||||
for file in outputFiles
|
||||
if file.path?.match(/output\.pdf$/)
|
||||
status = "success"
|
||||
if status == "failure"
|
||||
logger.err project_id: request.project_id, outputFiles:outputFiles, "project failed to compile successfully, no output.pdf generated"
|
||||
|
||||
timer.done()
|
||||
res.status(code or 200).send {
|
||||
|
||||
@@ -41,6 +41,7 @@ module.exports = CompileManager =
|
||||
|
||||
doCompile: (request, callback = (error, outputFiles) ->) ->
|
||||
compileDir = getCompileDir(request.project_id, request.user_id)
|
||||
console.log("doCompile",compileDir )
|
||||
|
||||
timer = new Metrics.Timer("write-to-disk")
|
||||
logger.log project_id: request.project_id, user_id: request.user_id, "syncing resources to disk"
|
||||
@@ -206,9 +207,14 @@ module.exports = CompileManager =
|
||||
file_path = base_dir + "/" + file_name
|
||||
compileDir = getCompileDir(project_id, user_id)
|
||||
synctex_path = Path.join(compileDir, "output.pdf")
|
||||
CompileManager._runSynctex ["code", synctex_path, file_path, line, column], (error, stdout) ->
|
||||
command = ["code", synctex_path, file_path, line, column]
|
||||
CompileManager._runSynctex command, (error, stdout) ->
|
||||
return callback(error) if error?
|
||||
logger.log project_id: project_id, user_id:user_id, file_name: file_name, line: line, column: column, stdout: stdout, "synctex code output"
|
||||
if stdout.toLowerCase().indexOf("warning") == -1
|
||||
logType = "log"
|
||||
else
|
||||
logType = "err"
|
||||
logger[logType] project_id: project_id, user_id:user_id, file_name: file_name, line: line, column: column, command:command, stdout: stdout, "synctex code output"
|
||||
callback null, CompileManager._parseSynctexFromCodeOutput(stdout)
|
||||
|
||||
syncFromPdf: (project_id, user_id, page, h, v, callback = (error, filePositions) ->) ->
|
||||
@@ -216,6 +222,7 @@ module.exports = CompileManager =
|
||||
base_dir = Settings.path.synctexBaseDir(compileName)
|
||||
compileDir = getCompileDir(project_id, user_id)
|
||||
synctex_path = Path.join(compileDir, "output.pdf")
|
||||
logger.log({base_dir, project_id, synctex_path}, "base diiir")
|
||||
CompileManager._runSynctex ["pdf", synctex_path, page, h, v], (error, stdout) ->
|
||||
return callback(error) if error?
|
||||
logger.log project_id: project_id, user_id:user_id, page: page, h: h, v:v, stdout: stdout, "synctex pdf output"
|
||||
@@ -243,6 +250,7 @@ module.exports = CompileManager =
|
||||
return callback(error) if error?
|
||||
if Settings.clsi?.synctexCommandWrapper?
|
||||
[bin_path, args] = Settings.clsi?.synctexCommandWrapper bin_path, args
|
||||
logger.log({bin_path, args}, "synctex being run")
|
||||
child_process.execFile bin_path, args, timeout: 10 * seconds, (error, stdout, stderr) ->
|
||||
if error?
|
||||
logger.err err:error, args:args, "error running synctex"
|
||||
|
||||
@@ -8,6 +8,7 @@ ProcessTable = {} # table of currently running jobs (pids or docker container n
|
||||
|
||||
module.exports = LatexRunner =
|
||||
runLatex: (project_id, options, callback = (error) ->) ->
|
||||
console.log("LatexRunner", options.directory)
|
||||
{directory, mainFile, compiler, timeout, image, environment} = options
|
||||
compiler ||= "pdflatex"
|
||||
timeout ||= 60000 # milliseconds
|
||||
|
||||
@@ -10,8 +10,6 @@ module.exports = OutputFileFinder =
|
||||
for resource in resources
|
||||
incomingResources[resource.path] = true
|
||||
|
||||
logger.log directory: directory, "getting output files"
|
||||
|
||||
OutputFileFinder._getAllFiles directory, (error, allFiles = []) ->
|
||||
if error?
|
||||
logger.err err:error, "error finding all output files"
|
||||
|
||||
@@ -109,6 +109,7 @@ module.exports = ResourceWriter =
|
||||
callback()
|
||||
|
||||
_writeResourceToDisk: (project_id, resource, basePath, callback = (error) ->) ->
|
||||
console.log("_writeResourceToDisk", basePath, resource.path)
|
||||
ResourceWriter.checkPath basePath, resource.path, (error, path) ->
|
||||
return callback(error) if error?
|
||||
mkdirp Path.dirname(path), (error) ->
|
||||
|
||||
Reference in New Issue
Block a user