python - 尝试运行 Azure ML 管道时权限被拒绝:“.\NTUSER.DAT”
问题描述
简短的故事是,当我尝试从 jupyter 笔记本提交 azure ML 管道运行(一个azure ML 管道,而不是Azure 管道)时,我得到 PermissionError: [Errno 13] Permission denied: '.\NTUSER.DAT'。更多细节:
相关代码:
from azureml.train.automl import AutoMLConfig
from azureml.train.automl.runtime import AutoMLStep
automl_settings = {
"iteration_timeout_minutes": 20,
"experiment_timeout_minutes": 30,
"n_cross_validations": 3,
"primary_metric": 'r2_score',
"preprocess": True,
"max_concurrent_iterations": 3,
"max_cores_per_iteration": -1,
"verbosity": logging.INFO,
"enable_early_stopping": True,
'time_column_name': "DateTime"
}
automl_config = AutoMLConfig(task = 'forecasting',
debug_log = 'automl_errors.log',
path = ".",
compute_target=compute_target,
run_configuration=conda_run_config,
training_data = financeforecast_dataset,
label_column_name = 'TotalUSD',
**automl_settings
)
automl_step = AutoMLStep(
name='automl_module',
automl_config=automl_config,
allow_reuse=False)
training_pipeline = Pipeline(
description="training_pipeline",
workspace=ws,
steps=[automl_step])
training_pipeline_run = Experiment(ws, 'test').submit(training_pipeline)
training_pipeline 步骤运行 apx 20 秒,然后我得到一个很长的跟踪,结束于:
~\AppData\Local\Continuum\anaconda2\envs\forecasting\lib\site-
packages\azureml\pipeline\core\_module_builder.py in _hash_from_file_paths(hash_src)
100 hasher = hashlib.md5()
101 for f in hash_src:
--> 102 with open(str(f), 'rb') as afile:
103 buf = afile.read()
104 hasher.update(buf)
PermissionError: [Errno 13] Permission denied: '.\\NTUSER.DAT'
根据Azure 关于此主题的文档,提交管道会上传您指定的“源目录”的“快照”。最初,我没有指定源目录,因此,为了测试它,我添加了:
default_source_directory="testing",
作为 training_pipeline 对象的参数,但是当我尝试运行它时看到了相同的行为。不确定这是否与文档所指的源目录相同。文档还说,如果没有指定源目录,则上传“当前本地目录”。我使用 print (os.getcwd()) 来获取工作目录并授予“Everyone”对该目录的完全控制权限(在 Windows 环境中工作)。
前面的所有代码都可以正常工作,如果我使用 ScriptRunConfig 并在附加的计算上运行它而不是使用管道/训练集群,我可以提交一个实验。
有任何想法吗?提前感谢任何试图提供帮助的人。PS 没有“azure-machine-learning-pipelines”标签,我也不能加一个,因为我没有足够的声望点。别人虽然可以! 关于它们的一般信息。
解决方案
我通过在 AutoMLConfig 任务对象中设置路径和 data_script 变量解决了这个答案,如下所示(相关代码由 --> 指示):
automl_config = AutoMLConfig(task = 'forecasting',
debug_log = 'automl_errors.log',
compute_target=compute_target,
run_configuration=conda_run_config,
-->path = "c:\\users\\me",
data_script ="script.py",<--
**automl_settings
)
如下所示,将 data_script 变量设置为包含完整路径并不起作用。
automl_config = AutoMLConfig(task = 'forecasting',
debug_log = 'automl_errors.log',
path = ".",
-->data_script = "c:\\users\\me\\script.py"<--
compute_target=compute_target,
run_configuration=conda_run_config,
**automl_settings
)
推荐阅读
- c++11 - 如何定义堆栈对象的集合?
- swift - 在同一个子 Firebase 中添加超过 1 个信息时遇到问题
- javascript - 序列化:如何排除 json 响应中的实体列,但不排除 Nestjs 中的内部查询
- tabulator - table.getdata 返回一个空字符串
- msbuild - 使用 msbuild proj 文件进行 SonarQube 分析
- android - Kotlin 合成 id 碰撞错误
- sql-server - 为什么默认的 newsequentialid() 不起作用?
- node.js - 如何使用 puppeteer 页面中的会话数据获取 url?
- docker - 如何使用 Goland IDE 和 Docker compose 调试 dockerized Golang 应用程序
- node.js - 无法使用“导入”导入多个模块