Menu
Introduction
Getting Started
Developer guide
Release
Architecture
CLI
Technical documentations
Version
Publication date

Mar 9, 2022

Confidentiality
Public
Reactions
1
Share

ProtocolProxy

This class can be used in a Jupyter Notebook to create and configure a protocol

To create it use the add_protocol method on another protocol

Functions
__init__

Initialize self. See help(type(self)) for accurate signature.

protocol_model : ProtocolModel
add_connector

Add a connector between to process of this protocol

Exemple : protocol.add_connector(create.get_output_port('robot'), sub_proto.get_input_port('robot_i')) OR protocol.add_connector(create >> 'robot', sub_proto << 'robot_i')

out_port : ProcessWithPort
in_port : ProcessWithPort
add_connector_by_names

Add a connector between to process of this protocol

Exemple : protocol.add_connector_by_names('create', 'robot', 'sub_proto','robot_i')

from_process_name : str
from_port_name : str
to_process_name : str
to_port_name : str
add_connectors

Add multiple connector inside the protocol

Exemple : protocol.add_connectors([ (create >> 'robot', sub_proto << 'robot_i'), (sub_proto.get_output_port('robot_o'), robot_travel.get_input_port('robot')) ])

connectors : list
add_dynamic_input_port

Add a dynamic input port to the process

port_spec_dto : IOSpecDTO | None
Return type : ProcessWithPort
add_empty_protocol

Add an empty protocol to this protocol

instance_name : str | None
Return type : ProtocolProxy
add_interface

Add an interface to link an input of the protocol to the input of one of the protocol's process

name : str
name of the interface
from_process_name : str
process_input_name : str
name of the process input to plug
add_outerface

Add an outerface to link the output of one of the protocol's process to the output of the protocol

name : str
name of the interface
to_process_name : str
process_ouput_name : str
name of the process output to plug
add_output

Add an output task to the protocol that receive the out_port resource

instance_name : str | None
instance name of the task
out_port : ProcessWithPort
out_port connect to connect to the output task
flag_resource : bool - True
flag the resource
Return type : TaskProxy
add_process

Add a process (task or protocol) to this protocol. This process is automatically saved in the database

process_type : type
instance_name : str | None
config_params : dict
Return type : ProcessProxy
add_process_dynamic_input_port

Add a dynamic input port to the process. The method is here because it update the protocol model.

process_instance_name : str
port_spec_dto : gws_core.io.io_spec.IOSpecDTO | None
Return type : ProcessWithPort
add_protocol

Add a protocol from a protocol type

protocol_type : type
instance_name : str | None
config_params : dict
Return type : ProtocolProxy
add_resource

Add a resource to the protocol and connected it to the in_port

instance_name : str | None
instance name of the task
resource_model_id : str
the id of the resource model the source will provided as input
in_port : ProcessWithPort
the in port that should receive the resource. If None, the resource is added to the protocol without connection
Return type : TaskProxy
add_resources_to_process_dynamic_input
add_source

Add a Source task to the protocol and connected it to the in_port

instance_name : str | None
instance name of the task
resource_model_id : str
the id of the resource model the source will provided as input
in_port : ProcessWithPort
the in port that should receive the resource
Return type : TaskProxy
add_task

Add a task to this

task_type : type
instance_name : str | None
config_params : dict
Return type : TaskProxy
delete_connector

Delete a connector between to process of this protocol

Exemple : protocol.delete_connector('sub_proto','robot_i')

to_process_name : str
to_port_name : str
delete_interface

Delete an interface of the protocol

name : str
delete_outerface

Delete an outerface of the protocol

name : str
delete_process
instance_name : str
get_all_next_processes

Return all the next processes of the specified process in this protocol

instance_name : str
the instance name of the process
Return type : set
get_all_processes

Return all the processes of this protocol

Return type : dict
get_direct_next_processes

Return the direct next processes of the specified process in this protocol

instance_name : str
the instance name of the process
Return type : set
get_direct_previous_processes

Return the direct previous processes of the specified process in this protocol

instance_name : str
the instance name of the process
Return type : set
get_first_inport
Return type : ProcessWithPort
get_first_outport
Return type : ProcessWithPort
get_input

retrieve the resource of the input

name : Any
name of the input port
get_input_port

Access input port information of a process to create connectors in protocol

port_name : str
Return type : ProcessWithPort
get_input_ports

Access all input port information of a process to create connectors in protocol

Return type : list[ProcessWithPort]
get_input_resource_model

retrieve the resource model of the input

name : Any
name of the input port
Return type : ResourceModel
get_model
Return type : ProtocolModel
get_model_id
Return type : str
get_output

retrieve the resource of the output

name : Any
name of the output port
Return type : Resource
get_output_port

Access output port information of a process to create connectors in protocol

port_name : str
Return type : ProcessWithPort
get_output_ports

Access all output port information of a process to create connectors in protocol

Return type : list[ProcessWithPort]
get_output_resource_model

retrieve the resource model of the output

name : Any
name of the output port
Return type : ResourceModel
get_param
name : str
Return type : Any
get_process

retreive a protocol or a task in this protocol

instance_name : str
[description]
Return type : ProcessProxy
get_process_type
Return type : type[Process]
get_processes_by_type

retreive a protocol or a task in this protocol by type

process_type : type
[description]
Return type : list
has_dynamic_inputs
Return type : bool
has_dynamic_outputs
Return type : bool
has_parent_protocol
Return type : bool
is_input_task
Return type : bool
is_output_task
Return type : bool
is_process_input_port_connected

Check if an input port is connected. The method is here because it update the protocol model.

port : ProcessWithPort
The port to check
Return type : bool
is_process_output_port_connected

Check if an output port is connected. The method is here because it update the protocol model.

port : ProcessWithPort
The port to check
Return type : bool
refresh
Return type : ProcessProxy
replace_output_with_process

Replace an output task by another process (task or protocol). Connect the input of the new process to the process that was connected to the output task.

output_instance_name : str
the instance name of the output task to replace
instance_name : str
the instance name of the new process
process_type : type
the type of the new process (task or protocol)
new_process_input_port_name : str
the name of the input port of the new process
config_params : dict[str, typing.Any] | None
the config params of the new process
Return type : ProcessProxy
replace_process

Replace a process (task or protocol) by another process (task or protocol). If the new_process_input_port_name and existing_process_input_port_name are provided, the input of the new process is connected to the process that was connected to the existing_process_input_port_name (replace the process and connect it as the predecessor).

existing_process_instance_name : str
new_process_instance_name : str
the instance name of the new process
new_process_process_type : type
the type of the new process (task or protocol)
new_process_input_port_name : str | None
the name of the input port of the new process
existing_process_input_port_name : str | None
new_process_config_params : dict[str, typing.Any] | None
the config params of the new process
Return type : ProcessProxy
reset_config
set_config_params

Set the config param values

config_params : dict
set_param

Set the param value

param_name : str
value : Any
get_by_id @classmethod
id : str
Return type : ProtocolProxy
Shine Logo
Technical bricks to reuse or customize

Have you developed a brick?

Share it to accelerate projects for the entire community.