Export a pipeline to an ipynb
notebook file
ipynb
notebook fileConvert and save a Link pipeline from Python code to an ipynb
notebook file.
pipeline.convert_to_ipynb(file="str")
- Parameters
file
(str): The path and name of the IPYNB file you wish to convert and save
- Troubleshooting
- NameError: It must not be blank
- This occurs when the file name is blank.
- NameError: It must not include [: * " ? < > |]
- This occurs when
: * " ? < > |
is included infile
.
- This occurs when
- NameError: The file name must end with .ipynb
- This occurs when the name of
file
does not end with.ipynb
.
- This occurs when the name of
- NameError: It must not be blank
Example
from mrx_link.sdk.utils import *
# code cell
code1 = """
x = 1
"""
code2 = """
print(f"{x=}, {y=}")
"""
if __name__ == "__main__":
# Create components
component1 = create_link_component(identifier="111-1", name="test", code=code1)
component2 = create_link_component(identifier="111-2", name="test2", code=code2)
components = [component1, component2]
# Create edges
edge1 = create_link_edge(parent_id="111-1", child_id="111-2")
edges = [edge1]
# Create pipeline parameters
parameter1 = create_link_parameter(name="x", value="123")
parameter2 = create_link_parameter(name="y", value="baregasdv")
parameters = [parameter1, parameter2]
# Create pipeline
pipeline = create_link_pipeline(components=components, parameters=parameters, edges=edges)
# Convert the pipeline to `sample.ipynb` file
pipeline.convert_to_ipynb(file="sample.ipynb")