[英]Azure Synapse Notebook Read Variable
I have a vary simple/toy pipeline where I have a pyspark notebook that has an exit value, a set variable activity set to the exit value and a second notebook that is parameterized with the variable.我有一个 vary simple/toy pipeline,其中我有一个 pyspark 笔记本,它有一个退出值,一个设置为退出值的变量活动和一个用变量参数化的第二个笔记本。 It looks like the below.
它看起来像下面这样。
I successfully set the variable, but I cannot seem to read this variable into the input_values
notebook.我成功设置了变量,但似乎无法将此变量读入
input_values
笔记本。 The notebook looks like the below, also quite simple.笔记本如下所示,也很简单。
My pipeline parameters then look like the below.我的管道参数如下所示。 However my exit value just comes out as "hello "
但是我的退出值只是“你好”
I have also tried accessing the variable directly in the notebook (without parametrization) by f"hello {@variables("my_message")}"
, but this resulted in an error.我还尝试通过
f"hello {@variables("my_message")}"
直接在笔记本中访问变量(没有参数化),但这导致了错误。 When I try to look at documentation for this type of behavior it generally points to calling a notebook from another notebook so caller/callee notebooks, such as the examples from this documentation .当我尝试查看此类行为的文档时,它通常指向从另一个笔记本调用笔记本,因此调用者/被调用者笔记本,例如本文档中的示例。 This seems to be backwards for creating a DAG, so I do not want to do that.
这似乎是创建 DAG 的倒退,所以我不想那样做。 What I want to do seems possible and I saw an example of something similar here , but I can't seem to get it to work.
我想做的似乎是可能的,我在这里看到了一个类似的例子,但我似乎无法让它发挥作用。
Can anyone point me to documentation that would explain how to accomplish what I want or is there something in the above that I am missing?任何人都可以指出可以解释如何完成我想要的事情的文档,或者上面是否有我遗漏的内容?
I tried to set the msg
parameter to @activity('exit_values').output.status.Output.result.exitValue
, which is what I successfully set the my_message
variable to and that did not work either.我尝试将
msg
参数设置为@activity('exit_values').output.status.Output.result.exitValue
,这是我成功将my_message
变量设置为的参数,但也不起作用。
I don't feel very smart, but I will leave this up for anyone else that might be in the same position. I was setting my msg
parameter on the pipeline, not the individual notebook.我觉得不是很聪明,但我会把这个留给可能在同一个 position 中的任何其他人。我在管道上设置我的
msg
参数,而不是在个人笔记本上。 I successfully ran it by setting the parameter on the notebook.我在笔记本上设置参数成功运行了。
I successfully ran it by setting the parameter on the notebook.
我在笔记本上设置参数成功运行了。
It is the correct way to pass the values to the Notebook parameters.这是将值传递给笔记本参数的正确方法。
In the above the @variables('msg_var')
is a should be given to in a dyamic content and not in default value.在上面,
@variables('msg_var')
应该在动态内容中给出,而不是默认值。 The pipeline parameters do not support dynamic content here.此处管道参数不支持动态内容。
Also, we have to give the value of the Notebook pipeline in Base parameters of Notebook activity by creating a parameter with same name as that.此外,我们必须通过创建一个与该名称相同的参数,在 Notebook 活动的基本参数中提供 Notebook 管道的值。
Here, it supports dynamic content, so give the variable like below.这里,它支持动态内容,所以给变量如下。
Notebook output:笔记本 output:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.