Update pipeline parameters
Create a list of pipeline parameter objects, using the create_link_parameter
method. Update the pipeline information with the parameter list.
parameters = [
MRXLinkPipelineParameterModel(name="x", value="456"),
MRXLinkPipelineParameterModel(name="y", value="gasdv")
]
pipeline.set_parameters(new_parameters=parameters)
- Parameters
new_parameters
(list): List of pipeline parameters defined using thecreate_link_parameter
method
- Troubleshooting
- ValueError: Pipeline parameter names should not be duplicated: ['name']
- This occurs when pipeline parameter names are duplicated.
- ValueError: Pipeline parameter names should not be duplicated: ['name']
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)
# Print pipeline
print("<Before>")
pipeline.print()
# Update pipeline parameters
parameter1 = create_link_parameter(name="a", value="123")
parameter2 = create_link_parameter(name="b", value="baregasdv")
parameter3 = create_link_parameter(name="c", value="baregasdasdfv")
parameters = [parameter1, parameter2, parameter3]
pipeline.set_parameters(new_parameters=parameters)
# Print pipeline
print("<After>")
pipeline.print()
Output
<Before>
##### PIPELINE #####
ID Name Status Parent IDs
----- ------ -------- ------------
111-1 test Ready []
111-2 test2 Ready ['111-1']
##### PARAMETERS #####
Name Type Value
------ ------ -----------
x str "123"
y str "baregasdv"
<After>
##### PIPELINE #####
ID Name Status Parent IDs
----- ------ -------- ------------
111-1 test Ready []
111-2 test2 Ready ['111-1']
##### PARAMETERS #####
Name Type Value
------ ------ ---------------
a str "123"
b str "baregasdv"
c str "baregasdasdfv"