Added exception handling
This commit is contained in:
parent
7a7bf4a6b4
commit
f2e2d8e2b6
17
OpusData.R
17
OpusData.R
@ -4,18 +4,14 @@
|
||||
source("ReadOpus.R")
|
||||
|
||||
# Determine file path
|
||||
#path <- commandArgs(trailingOnly = TRUE)[1]
|
||||
#file_name <- commandArgs(trailingOnly = TRUE)[2]
|
||||
#file_path <- paste0(path, file_name)
|
||||
file_path <- commandArgs(trailingOnly = TRUE)[1]
|
||||
|
||||
print(file_path)
|
||||
|
||||
# Convert opus binary file into dataframe
|
||||
data <- read_opus_univ(file_path, 5)
|
||||
|
||||
# Replace last "." with "_", add ".DPT"
|
||||
#file_name <- paste0(sub(".([^.]*)$", "_\\1", file_name), ".DPT")
|
||||
tryCatch(data <- read_opus_univ(file_path, 5), error=function(e){
|
||||
print("Failed converting OPUS file")
|
||||
exit()
|
||||
}
|
||||
)
|
||||
|
||||
# Determine target, where the result should appear
|
||||
target_path <- paste0("/tmp/", sub('.*\\/', "", file_path))
|
||||
@ -27,7 +23,6 @@ file.create(target_path)
|
||||
write.table(data, target_path, row.names = FALSE, col.names = FALSE, sep = ",")
|
||||
|
||||
# Call python script
|
||||
system(paste('python3 transferData.py', target_path))
|
||||
#py_run_file("transfer.py",local=FALSE, convert=FALSE)
|
||||
system(paste('./transfer-data.sh', target_path))
|
||||
|
||||
|
||||
|
@ -29,7 +29,7 @@ echo "Extracting data..."
|
||||
|
||||
shopt -s nullglob
|
||||
found=0
|
||||
for f in $MOUNTPOINT/*.[0-9]
|
||||
for f in $MOUNTPOINT/*.?
|
||||
do
|
||||
found=1
|
||||
echo "Processing $f..."
|
||||
|
Loading…
Reference in New Issue
Block a user