Bash перенаправление не создает текстовый файл - PullRequest
0 голосов
/ 08 апреля 2020

У меня есть следующий код:

RAN=$RANDOM
STDOUT="out${RAN}.txt"
STDERR="err${RAN}.txt"
Rscript ...solvers/script.r ${CONFIG_PARAMS} 1> ${STDOUT} 2> ${STDERR}

Получение следующей ошибки:

error: out30304.txt: No such file or directory

Но не должна ли строка, начинающаяся с Rscript, создавать текстовый файл?

РЕДАКТИРОВАТЬ: многоточие на самом деле не присутствует в коде, он там, чтобы удалить ненужную информацию.

EDIT2: больше кода для контекста. Опять же, все пути сокращены для удобства чтения и безопасности:

# 2020-04-08 12:33:17 EDT: Estimating execution time using 2% of 590400 = 11808
Error : == irace == running command ''.../tuning/target-runner' 1 1 1042861479 .../tuning/Instances/README   9 11728 0.6487 0.8525 226 2>&1' had status 1
== irace == The call to targetRunner was:
.../tuning/target-runner 1 1 1042861479 .../tuning/Instances/README   9 11728 0.6487 0.8525 226
== irace == The output was:
.../tuning/target-runner: line 57: 74728 Killed                  Rscript .../tblupcpp.r ${CONFIG_PARAMS} > ${STDOUT} 2> ${STDERR}
Wed Apr  8 16:34:10 UTC 2020: .../tuning/target-runner: error: out30304.txt: No such file or directory
== irace == This is not a bug in irace, but means that something failed when running the command(s) above or they were terminated before completion. Try to run the command(s) above from the execution directory '.../solvers' to investigate the issue. See also Appendix B (targetRunner troubleshooting checklist) of the User Guide (https://cran.r-project.org/package=irace/vignettes/irace-package.pdf).
 Error : == irace == running command ''.../tuning/target-runner' 3 1 1042861479 .../tuning/Instances/README   8 18796 0.5252 0.5963 327 2>&1' had status 1
== irace == The call to targetRunner was:
.../tuning/target-runner 3 1 1042861479 .../tuning/Instances/README   8 18796 0.5252 0.5963 327
== irace == The output was:
.../tuning/target-runner: line 57: 74727 Killed                  Rscript .../tblupcpp.r ${CONFIG_PARAMS} > ${STDOUT} 2> ${STDERR}
Wed Apr  8 16:34:04 UTC 2020: .../tuning/target-runner: error: out22101.txt: No such file or directory
== irace == This is not a bug in irace, but means that something failed when running the command(s) above or they were terminated before completion. Try to run the command(s) above from the execution directory '.../solvers' to investigate the issue. See also Appendix B (targetRunner troubleshooting checklist) of the User Guide (https://cran.r-project.org/package=irace/vignettes/irace-package.pdf).
Error: == irace == A child process triggered a fatal error
In addition: Warning message:
In parallel::mclapply(experiments, exec.target.runner, mc.preschedule = !scenario$loadBalancing,  :
  2 function calls resulted in an error
Execution halted

1 Ответ

0 голосов
/ 14 апреля 2020

Перенаправить стандартный вывод в файл STDOUT и стандартный вывод в файл STDERR:

RAN=$RANDOM
STDOUT="out${RAN}.txt"
STDERR="err${RAN}.txt"
yourScript.r ${CONFIG_PARAMS} > ${STDOUT} 2>${STDERR}
...