@@ -399,14 +399,19 @@ object FileUtils {
399399 val fileExecutionContext : ExecutionContext = Akka .system().dispatchers.lookup(" akka.actor.contexts.file-processing" )
400400 Future {
401401 try {
402- saveFile(file, f.ref.file, originalZipFile, clowderurl, apiKey, Some (user)).foreach { fixedfile =>
403- processFileBytes(fixedfile, f.ref.file, dataset)
404- files.setStatus(fixedfile.id, FileStatus .UPLOADED )
405- sinkService.logFileUploadEvent(fixedfile, dataset, Option (user))
406- processFile(fixedfile, clowderurl, index, flagsFromPrevious, showPreviews, dataset, runExtractors, apiKey)
407- processDataset(file, dataset, folder, clowderurl, user, index, runExtractors, apiKey)
408- files.setStatus(fixedfile.id, FileStatus .PROCESSED )
402+ saveFile(file, f.ref.file, originalZipFile, clowderurl, apiKey, Some (user)).match {
403+ case Some (fixedfile) => {
404+ processFileBytes(fixedfile, f.ref.file, dataset)
405+ files.setStatus(fixedfile.id, FileStatus .UPLOADED )
406+ sinkService.logFileUploadEvent(fixedfile, dataset, Option (user))
407+ processFile(fixedfile, clowderurl, index, flagsFromPrevious, showPreviews, dataset, runExtractors, apiKey)
408+ processDataset(file, dataset, folder, clowderurl, user, index, runExtractors, apiKey)
409+ files.setStatus(fixedfile.id, FileStatus .PROCESSED )
410+ }
411+ case None => Logger .error(s " File was not saved for ${file.id}, saveFile returned None " )
409412 }
413+ } catch {
414+ case _ : Throwable => Logger .error(s " Error ( ${_}), file was not saved for ${file.id}" )
410415 } finally {
411416 f.ref.clean()
412417 }
@@ -455,12 +460,18 @@ object FileUtils {
455460 // process rest of file in background
456461 val fileExecutionContext : ExecutionContext = Akka .system().dispatchers.lookup(" akka.actor.contexts.file-processing" )
457462 Future {
458- saveURL(file, url, clowderurl, apiKey, Some (user)).foreach { fixedfile =>
459- processFileBytes(fixedfile, new java.io.File (path), fileds)
460- files.setStatus(fixedfile.id, FileStatus .UPLOADED )
461- processFile(fixedfile, clowderurl, index, flagsFromPrevious, showPreviews, fileds, runExtractors, apiKey)
462- processDataset(file, fileds, folder, clowderurl, user, index, runExtractors, apiKey)
463- files.setStatus(fixedfile.id, FileStatus .PROCESSED )
463+ try {
464+ saveURL(file, url, clowderurl, apiKey, Some (user)).match {
465+ case Some (fixedfile) => {
466+ processFileBytes(fixedfile, new java.io.File (path), fileds)
467+ files.setStatus(fixedfile.id, FileStatus .UPLOADED )
468+ processFile(fixedfile, clowderurl, index, flagsFromPrevious, showPreviews, fileds, runExtractors, apiKey)
469+ processDataset(file, fileds, folder, clowderurl, user, index, runExtractors, apiKey)
470+ files.setStatus(fixedfile.id, FileStatus .PROCESSED )
471+ }
472+ }
473+ } catch {
474+ case _ : Throwable => Logger .error(s " Error ( ${_}), url was not saved for ${file.id}" )
464475 }
465476 }(fileExecutionContext)
466477
0 commit comments