Now deep clean is realy deep :)
This commit is contained in:
parent
9913ff6bb9
commit
450aefe9d2
@ -1,5 +1,5 @@
|
|||||||
cleanupMuso <- function(location=NULL, simplicity=TRUE,deep=FALSE){
|
cleanupMuso <- function(location=NULL, simplicity=TRUE,deep=FALSE){
|
||||||
|
areThereAnyFolders <- FALSE
|
||||||
whereAmI <- getwd()
|
whereAmI <- getwd()
|
||||||
if(!is.null(location)){
|
if(!is.null(location)){
|
||||||
setwd(location)
|
setwd(location)
|
||||||
@ -10,40 +10,48 @@ cleanupMuso <- function(location=NULL, simplicity=TRUE,deep=FALSE){
|
|||||||
setwd("LOG")
|
setwd("LOG")
|
||||||
file.remove(
|
file.remove(
|
||||||
grep("(out$)|(endpoint$)|(log$)",
|
grep("(out$)|(endpoint$)|(log$)",
|
||||||
list.files(), value = T)
|
list.files(), value = T))
|
||||||
)}
|
areThereAnyFolders <- TRUE
|
||||||
|
}
|
||||||
|
|
||||||
if(dir.exists("../ERROR")){
|
if(dir.exists("../ERROR")){
|
||||||
setwd("../ERROR")
|
setwd("../ERROR")
|
||||||
|
|
||||||
file.remove(
|
file.remove(
|
||||||
grep("(out$)|(endpoint$)|(log$)",
|
grep("(out$)|(endpoint$)|(log$)",
|
||||||
list.files(), value = T)
|
list.files(), value = T))
|
||||||
)}
|
areThereAnyFolders <- TRUE
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(dir.exists("../EPCS")){
|
if(dir.exists("../EPCS")){
|
||||||
setwd("../EPCS")
|
setwd("../EPCS")
|
||||||
|
|
||||||
file.remove(
|
file.remove(
|
||||||
grep("(out$)|(endpoint$)|(log$)|(epc$)",
|
grep("(out$)|(endpoint$)|(log$)|(epc$)",
|
||||||
list.files(), value = T)
|
list.files(), value = T))
|
||||||
)}
|
areThereAnyFolder <- TRUE
|
||||||
|
}
|
||||||
|
|
||||||
if(dir.exists("../WRONGEPC")){
|
if(dir.exists("../WRONGEPC")){
|
||||||
setwd("../WRONGEPC")
|
setwd("../WRONGEPC")
|
||||||
|
|
||||||
file.remove(
|
file.remove(
|
||||||
grep("(out$)|(endpoint$)|(log$)|(epc$)",
|
grep("(out$)|(endpoint$)|(log$)|(epc$)",
|
||||||
list.files(), value = T)
|
list.files(), value = T))
|
||||||
)}
|
areThereAnyFolders <- TRUE
|
||||||
|
}
|
||||||
setwd("..")
|
|
||||||
file.remove(
|
|
||||||
grep("(out$)|(endpoint$)|(log$)",
|
|
||||||
list.files(), value = T)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
if(areThereAnyFolders){
|
||||||
|
setwd("..")
|
||||||
|
file.remove(
|
||||||
|
grep("(out$)|(endpoint$)|(log$)",
|
||||||
|
list.files(), value = T))
|
||||||
|
} else {
|
||||||
|
file.remove(
|
||||||
|
grep("(out$)|(endpoint$)|(log$)",
|
||||||
|
list.files(), value = T))}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!simplicity){
|
if(!simplicity){
|
||||||
file.remove(
|
file.remove(
|
||||||
grep("(out$)|(endpoint$)|(log$)",
|
grep("(out$)|(endpoint$)|(log$)",
|
||||||
|
|||||||
@ -10,7 +10,7 @@ rungetMuso <- function(settings, timee="d", debugging=FALSE, logfilename=NULL, k
|
|||||||
|
|
||||||
#############################################################
|
#############################################################
|
||||||
############################spinup run############################
|
############################spinup run############################
|
||||||
##########################################################
|
##########################################################
|
||||||
|
|
||||||
##Copy the variables from settings
|
##Copy the variables from settings
|
||||||
inputloc <- settings$inputloc
|
inputloc <- settings$inputloc
|
||||||
@ -47,10 +47,10 @@ rungetMuso <- function(settings, timee="d", debugging=FALSE, logfilename=NULL, k
|
|||||||
|
|
||||||
if(silent){#silenc mode
|
if(silent){#silenc mode
|
||||||
if(Linuxp){
|
if(Linuxp){
|
||||||
#In this case, in linux machines
|
#In this case, in linux machines
|
||||||
system(paste(executable,ininput[1],"> /dev/null",sep=" "))
|
system(paste(executable,ininput[1],"> /dev/null",sep=" "))
|
||||||
} else {
|
} else {
|
||||||
#In windows machines there is a show.output.on.console option
|
#In windows machines there is a show.output.on.console option
|
||||||
system(paste(executable,ininput[1],sep=" "),show.output.on.console = FALSE)
|
system(paste(executable,ininput[1],sep=" "),show.output.on.console = FALSE)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,9 +69,9 @@ rungetMuso <- function(settings, timee="d", debugging=FALSE, logfilename=NULL, k
|
|||||||
|
|
||||||
if(!spincrash){##If spinup did not crashed, run the normal run.
|
if(!spincrash){##If spinup did not crashed, run the normal run.
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
###########################normal run#########################
|
###########################normal run#########################
|
||||||
#################################################################
|
#################################################################
|
||||||
|
|
||||||
##for the sake of safe we set the location again
|
##for the sake of safe we set the location again
|
||||||
setwd(inputloc)
|
setwd(inputloc)
|
||||||
@ -107,7 +107,7 @@ rungetMuso <- function(settings, timee="d", debugging=FALSE, logfilename=NULL, k
|
|||||||
perror<-as.numeric(as.vector(lapply(paste(outputloc,logfiles,sep="/"),function(x) tail(readLines(x,-1),1)))) #vector of spinup and normalrun error
|
perror<-as.numeric(as.vector(lapply(paste(outputloc,logfiles,sep="/"),function(x) tail(readLines(x,-1),1)))) #vector of spinup and normalrun error
|
||||||
|
|
||||||
if((debugging=="stamplog")|(debugging==TRUE)){#If debugging option turned on
|
if((debugging=="stamplog")|(debugging==TRUE)){#If debugging option turned on
|
||||||
#If log or ERROR directory does not exists create it!
|
#If log or ERROR directory does not exists create it!
|
||||||
dirName<-paste(inputloc,"LOG",sep="")
|
dirName<-paste(inputloc,"LOG",sep="")
|
||||||
dirERROR<-paste(inputloc,"ERROR",sep="")
|
dirERROR<-paste(inputloc,"ERROR",sep="")
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ rungetMuso <- function(settings, timee="d", debugging=FALSE, logfilename=NULL, k
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
##if errorsign is 1 there is error, if it is 0 everything ok
|
##if errorsign is 1 there is error, if it is 0 everything ok
|
||||||
if(length(perror)>sum(perror)){
|
if(length(perror)>sum(perror)){
|
||||||
errorsign <- 1
|
errorsign <- 1
|
||||||
} else {
|
} else {
|
||||||
@ -196,9 +196,9 @@ rungetMuso <- function(settings, timee="d", debugging=FALSE, logfilename=NULL, k
|
|||||||
|
|
||||||
if(leapYear){
|
if(leapYear){
|
||||||
Reva <- corrigMuso(settings,Reva)
|
Reva <- corrigMuso(settings,Reva)
|
||||||
rownames(Reva) <- musoDate(settings)
|
rownames(Reva) <- musoDate(settings)
|
||||||
} else {
|
} else {
|
||||||
rownames(Reva) <- musoDate(settings, corrigated=FALSE)
|
rownames(Reva) <- musoDate(settings, corrigated=FALSE)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(export!=FALSE){
|
if(export!=FALSE){
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user