Skip to content
Snippets Groups Projects
Commit 20cb9393 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Added automated input file checking

parent 67f8504c
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,9 @@ object WriteDependencies extends Logging with Configurable {
def writeDependencies(functions: Seq[QFunction], outputFile: File): Unit = {
logger.info("Start calculating dependencies")
val errorOnMissingInput: Boolean = config("error_on_missing_input", false)
createFunctionNames(functions)
case class QueueFile(file: File) {
......@@ -43,14 +46,21 @@ object WriteDependencies extends Logging with Configurable {
}
def outputJobNames = outputJobs.toList.map(functionNames)
def getMap = Map(
"path" -> file.getAbsolutePath,
"intermediate" -> isIntermediate,
"output_jobs" -> outputJobNames,
"input_jobs" -> inputJobNames,
"exist_at_start" -> file.exists(),
"pipeline_input" -> outputJobs.isEmpty
)
def getMap = {
val fileExist = file.exists()
if (!fileExist && outputJobs.isEmpty) {
if (errorOnMissingInput) Logging.addError(s"Input file does not exist: $file")
else logger.warn(s"Input file does not exist: $file")
}
Map(
"path" -> file.getAbsolutePath,
"intermediate" -> isIntermediate,
"output_jobs" -> outputJobNames,
"input_jobs" -> inputJobNames,
"exist_at_start" -> fileExist,
"pipeline_input" -> outputJobs.isEmpty
)
}
def isIntermediate = outputJobs.exists(_.isIntermediate)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment