prefect.input.run_input
RunInput
data
to flows at runtime. Flows can send back responses, establishing two-way
channels with senders. These functions are particularly useful for systems that
require ongoing data transfer or need to react to input quickly.
real-time interaction and efficient data handling. It’s designed to facilitate
dynamic communication within distributed or microservices-oriented systems,
making it ideal for scenarios requiring continuous data synchronization and
processing. It’s particularly useful for systems that require ongoing data
input and output.
The following is an example of two flows. One sends a random number to the
other and waits for a response. The other receives the number, squares it, and
sends the result back. The sender flow then prints the result.
Sender flow:
keyset_from_paused_state
-
: the state to get the keyset forkeyset_from_base_key
-
: the base key to get the keyset forrun_input_subclass_from_type
RunInput
subclass from the given type.
send_input
receive_input
RunInputMetadata
BaseRunInput
keyset_from_type
load
-
: the keyset to load the input for-
: the flow run ID to load the input forload_from_flow_run_input
-
: the flow run input to load the input formetadata
respond
save
-
: the keyset to save the input for-
: the flow run ID to save the input forsend_to
with_initial_data
RunInput
subclass with the given initial data as field
defaults.
Args:
-
: a description to show when resuming
a flow run that requires input-
: the initial data to populate the subclassRunInput
keyset_from_type
load
-
: the keyset to load the input for-
: the flow run ID to load the input forload_from_flow_run_input
-
: the flow run input to load the input formetadata
receive
respond
save
-
: the keyset to save the input for-
: the flow run ID to save the input forsend_to
subclass_from_base_model_type
RunInput
subclass from the given pydantic.BaseModel
subclass.
Args:
-
: the class from which
to create the new RunInput
subclasswith_initial_data
RunInput
subclass with the given initial data as field
defaults.
Args:
-
: a description to show when resuming
a flow run that requires input-
: the initial data to populate the subclassAutomaticRunInput
keyset_from_type
load
-
: the keyset to load the input for-
: the flow run ID to load the input forload
-
: the keyset to load the input for-
: the flow run ID to load the input forload_from_flow_run_input
-
: the flow run input to load the input formetadata
receive
respond
save
-
: the keyset to save the input for-
: the flow run ID to save the input forsend_to
subclass_from_type
AutomaticRunInput
subclass from the given type.
This method uses the type’s name as a key prefix to identify related
flow run inputs. This helps in ensuring that values saved under a type
(like List[int]) are retrievable under the generic type name (like “list”).
with_initial_data
RunInput
subclass with the given initial data as field
defaults.
Args:
-
: a description to show when resuming
a flow run that requires input-
: the initial data to populate the subclassGetInputHandler
filter_for_inputs
next
to_instance
GetAutomaticInputHandler
filter_for_inputs
next
to_instance