[英]Pass parameters from one notebook to another
I have two notebooks in python. 我在python中有两个笔记本。
The first one checks if a file exits in the data lake. 第一个检查文件是否在数据湖中退出。 I want to return a Boolean from here and the filePath if it exits.
我想从这里返回一个布尔值,如果存在则返回filePath。
The next notebook will then uses these Params as in input. 然后,下一个笔记本将使用这些参数作为输入。 How is this possible?
这怎么可能?
Also could I use a condition IF in the pipeline to check the returned Boolean? 还可以在管道中使用条件IF来检查返回的布尔值吗?
Kind of new to Azure ADF Azure ADF的新种类
One method to pass messages between separate python scripts or jupyter notebooks is to use the pyzmq library. 在单独的python脚本或jupyter笔记本之间传递消息的一种方法是使用pyzmq库。 Run pairserver in one notebook and pairclient in another.
在一个笔记本中运行pairserver,在另一个笔记本中运行pairclient。 You will see messages being passed from one to the other.
您将看到消息从一个传递到另一个。 This does add an extra dependency to your code, but pyzmq is a mature package.
这确实给您的代码增加了额外的依赖性,但是pyzmq是成熟的软件包。
pairserver.ipynb pairserver.ipynb
#!/usr/bin/python3
import zmq
import random
import time
port = '5556'
context = zmq.Context()
socket = context.socket(zmq.PAIR)
socket.bind('tcp://*:%s' % port)
while True:
socket.send(b'Server message to client')
msg = socket.recv()
print(msg)
time.sleep(1)
pairclient.ipynb pairclient.ipynb
#!/usr/bin/python3
import zmq
import random
import sys
import time
port = '5556'
context = zmq.Context()
socket = context.socket(zmq.PAIR)
socket.connect("tcp://localhost:%s" % port)
while True:
msg = socket.recv()
print(msg)
socket.send_string("client message to server")
time.sleep(1)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.