我正在使用 Microsoft Azure 机器学习中的“工作室(预览版)”来创建一个管道,将机器学习应用于连接到我们的数据仓库的 Blob 存储中的数据集。
在“设计器”中,可以将“执行 R 脚本”操作添加到管道中。我正在使用此功能来执行我自己的一些机器学习算法。
我已经得到了该脚本的“hello world”版本(包括使用“脚本包”加载我自己的 R 文件中的函数)。它应用非常简单的操作(计算日期列中的日期和“今天”的天数差异),并将输出存储为新文件。鉴于导出的文件具有正确的信息,我知道 R 脚本运行良好。
脚本如下所示:
# R version: 3.5.1
# The script MUST contain a function named azureml_main
# which is the entry point for this module.
# The entry point function can contain up to two input arguments:
# Param<medals>: a R DataFrame
# Param<matches>: a R DataFrame
azureml_main <- function(dataframe1, dataframe2){
message("STARTING R script run.")
# If a zip file is connected to the third input port, it is
# unzipped under "./Script Bundle". This directory is added
# to sys.path.
message('Adding functions as source...')
if (FALSE) {
# This works...
source("./Script Bundle/first_function_for_script_bundle.R")
} else {
# And this works as well!
message('Sourcing all available functions...')
functions_folder = './Script Bundle'
list.files(path = functions_folder)
list_of_R_functions <- list.files(path = functions_folder, pattern = "^.*[Rr]$", include.dirs = FALSE, full.names = TRUE)
for (fun in list_of_R_functions) {
message(sprintf('Sourcing <%s>...', fun))
source(fun)
}
}
message('Executing R pipeline...')
dataframe1 = calculate_days_difference(dataframe = dataframe1)
# Return datasets as a Named List
return(list(dataset1=dataframe1, dataset2=dataframe2))
}
虽然我确实在 R 脚本中打印了一些消息,但我无法找到应包含这些打印消息的“stdoutlogs”或“stderrlogs”。
我需要打印的消息:1) 有关分析如何进行的信息,以及最重要的是 2) 代码失败时的调试。
现在,我(在多个位置)找到了文件“stdoutlogs.txt”和“stderrlogs.txt”。当我单击“设计器”中的“执行 R 脚本”时,可以在“日志”下找到这些内容。 当我单击完成的“运行”时,我还可以在“实验”下找到“stdoutlogs.txt”和“stderrlogs.txt”文件,然后在“输出”选项卡和“日志”选项卡下找到“stdoutlogs.txt”和“stderrlogs.txt”文件。 然而...所有这些文件都是空的。
谁能告诉我如何从 R 脚本打印消息并帮助我找到在哪里可以找到打印的信息?
最佳答案
关于r - 在 azure-ml : Where can stdout and stderr logs be found? 中调试 R 脚本(或者为什么它们是空的?),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59881727/