Skip to content

Commit 2471090

Browse files
committed
cilogon less verbose + more logs for save error
Added some messages to make sure files are saved correctly. Group checks for cilogon are now debug messages.
1 parent c87d8d1 commit 2471090

File tree

3 files changed

+29
-14
lines changed

3 files changed

+29
-14
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
99
### Fixed
1010
- Updated swagger documentation
1111

12+
### Changed
13+
- Added more information when writing files to make sure files are written correctly
14+
- Made cilogon group check debug message instead of error message
15+
1216
## 1.18.0 - 2021-07-08
1317

1418
### Added

app/services/CILogonProvider.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class CILogonProvider(application: Application) extends OAuth2Provider(applicati
5757
}
5858
}
5959
case (Some(_), None) => throw new AuthenticationException()
60-
case (None, _) => Logger.error("[securesocial] No check needed for groups")
60+
case (None, _) => Logger.debug("[securesocial] No check needed for groups")
6161
}
6262
user.copy(
6363
identityId = IdentityId(userId, id),

app/util/FileUtils.scala

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)