简体   繁体   English

将参数从一个笔记本传递到另一个

[英]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.

相关问题 从另一个带有参数的笔记本运行 Jupyter 笔记本 - Running a Jupyter notebook from another notebook with parameters 如何将参数从一个 Pass state 传递给另一个? - How to pass parameters from one Pass state to another? 将输入参数从 jupyter notebook 传递给脚本 - Pass input parameters to script from jupyter notebook 如何将参数从一个视图传递到另一个视图 - How can I pass parameters from one view to another Synapse Notebook 参考 - 使用参数从另一个调用 Synapse 笔记本 - Synapse Notebook reference - Call Synapse notebook from another with parameters 将数据帧从一个 Jupyter Notebook 导入另一个 Jupyter Notebook - Importing a Dataframe from one Jupyter Notebook into another Jupyter Notebook 如何将可选参数从一个函数传递给另一个函数,另一个函数也是第一个函数的参数? - How to to pass optional parameters from one function to another function, which is also a parameter of the first function? 从一个文件传递到另一个常量变量,不使用 function 参数 - Pass from one file to another a constant variable, without using function parameters 在 JupyterHub / notebook 中,有没有办法将包从一个 kernel 复制到另一个 kernel? - In JupyterHub / notebook, is there a way to copy packages from one kernel to another kernel? 将代码单元中的代码从一个 jupyter notebook 加载到另一个 jupyter notebook - load code from a code cell from one jupyter notebook into another jupyter notebook
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM