Skip to content

prefect.input.actions

create_flow_run_input(client, key, value, flow_run_id=None, sender=None) async

Create a new flow run input. The given value will be serialized to JSON and stored as a flow run input value.

Parameters:

Name Type Description Default
- key (str

the flow run input key

required
- value (Any

the flow run input value

required
- flow_run_id (UUID

the, optional, flow run ID. If not given will default to pulling the flow run ID from the current context.

required
Source code in src/prefect/input/actions.py
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
@sync_compatible
@client_injector
async def create_flow_run_input(
    client: "PrefectClient",
    key: str,
    value: Any,
    flow_run_id: Optional[UUID] = None,
    sender: Optional[str] = None,
):
    """
    Create a new flow run input. The given `value` will be serialized to JSON
    and stored as a flow run input value.

    Args:
        - key (str): the flow run input key
        - value (Any): the flow run input value
        - flow_run_id (UUID): the, optional, flow run ID. If not given will
          default to pulling the flow run ID from the current context.
    """
    flow_run_id = ensure_flow_run_id(flow_run_id)

    await client.create_flow_run_input(
        flow_run_id=flow_run_id,
        key=key,
        sender=sender,
        value=orjson.dumps(value).decode(),
    )

delete_flow_run_input(client, key, flow_run_id=None) async

Delete a flow run input.

Parameters:

Name Type Description Default
- flow_run_id (UUID

the flow run ID

required
- key (str

the flow run input key

required
Source code in src/prefect/input/actions.py
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
@sync_compatible
@client_injector
async def delete_flow_run_input(
    client: "PrefectClient", key: str, flow_run_id: Optional[UUID] = None
):
    """Delete a flow run input.

    Args:
        - flow_run_id (UUID): the flow run ID
        - key (str): the flow run input key
    """

    flow_run_id = ensure_flow_run_id(flow_run_id)

    await client.delete_flow_run_input(flow_run_id=flow_run_id, key=key)

read_flow_run_input(client, key, flow_run_id=None) async

Read a flow run input.

Parameters:

Name Type Description Default
- key (str

the flow run input key

required
- flow_run_id (UUID

the flow run ID

required
Source code in src/prefect/input/actions.py
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
@sync_compatible
@client_injector
async def read_flow_run_input(
    client: "PrefectClient", key: str, flow_run_id: Optional[UUID] = None
) -> Any:
    """Read a flow run input.

    Args:
        - key (str): the flow run input key
        - flow_run_id (UUID): the flow run ID
    """
    flow_run_id = ensure_flow_run_id(flow_run_id)

    try:
        value = await client.read_flow_run_input(flow_run_id=flow_run_id, key=key)
    except PrefectHTTPStatusError as exc:
        if exc.response.status_code == 404:
            return None
        raise
    else:
        return orjson.loads(value)