> ## Documentation Index
> Fetch the complete documentation index at: https://interlocklabsinc.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Node

### set\_logger

<ParamField body="logger" type="logging.Logger" required>
  Sets a logger for this Node. Throws error if not a valid logger.
</ParamField>

### get\_status

<ResponseField name="" type="string">
  Returns the status of the node's execution.
  Will be one of `PENDING`, `EXECUTING`, `SUCCESS`, `FAILED`.

  Example: `SUCCESS`
</ResponseField>

### get\_id

<ResponseField name="" type="string">
  ID of this node.
</ResponseField>

### get\_name

<ResponseField type="string">
  Name assigned to the instance of this node.
</ResponseField>

### get\_input

<ResponseField type="dict[str:type]">
  Returns input as a dictionary of field name keys and type values. Input is meant to represent values passed in and set dynamically from other nodes.
</ResponseField>

### get\_output

<ResponseField type="dict[str:type]">
  Returns output as a dictionary of field name keys and type values.
</ResponseField>

### get\_execute\_args

<ResponseField type="dict[str:type]">
  Returns execute args as a dictionary of field name keys and type values. Execute args is meant to be set at runtime before a DAG starts.
</ResponseField>

### safe\_get\_execute\_args

<ParamField body="key" type="str" required>
  The key that being retrieved from execute args.
</ParamField>

<ParamField body="default" type="str">
  The expected default value in case the key is not found. Defaults to None.
</ParamField>

<ResponseField type="dict[str:type]">
  Returns execute args as a dictionary of field name keys and type values. Execute args is meant to be set at runtime before a DAG starts.
</ResponseField>

### set\_status

<ParamField body="status" type="str" required>
  Set the status of the node's execution. Must be one of `PENDING`, `EXECUTING`, `SUCCESS`, `FAILED`. If not, will raise an error.
</ParamField>

### set\_input

<ParamField body="input" type="dict[str:type]" required>
  Set input values to this Node as a dictionary. Input is meant to represent values passed in and set dynamically from other nodes.
</ParamField>

### set\_output

<ParamField body="output" type="dict[str:type]" required>
  Set output values to this Node as a dictionary. Output is the output of this node.
</ParamField>

### set\_execute\_args

<ParamField body="*args" type="list[type]" required>
  Set \*args to execute\_args. Execute args are meant to be set at runtime before a DAG starts.
</ParamField>

<ParamField body="**kwargs" type="dict[str:type]">
  Set \*\*kwargs to execute\_args.
</ParamField>

### set\_input\_s

<ParamField body="key" type="str" required>
  Set input schema as a dictionary of field name keys and type values. Input is meant to represent values passed in and set dynamically from other nodes.

  The allowed schema definitions are as follows:

  * The schema must be a dictionary
    ```
    Schema = 
        {
            "outer": str,
            "inner": {
                "level": int
            }
        }
    ```
  * Lists must be denoted as literals, and are treated as a set of allowable values
  * Dictionaries must have strings as keys, and types as values
  * Other types must be from the following selection: `int`, `float`, `str`, `bool`, `bytes`, `dict (generic)`, `list (generic)`.
  * **Parametrized generics are not supported as of yet and will throw an exception**
  * **Custom classes are not supported as of yet and will throw an exception**

  ```python theme={null}
      Schema = {
          "name": str,
          "favorites": dict, # will allow any dict containing anything
          "cities_lived": list, # will allow any list containing anything
          "schools_attended": [str], # will allow any strings
          "pre_ipo_user": bool,
          "age": float,
          "secret_code": bytes
      }
  ```
</ParamField>

### set\_output\_s

<ParamField body="key" type="str" required>
  Set output schema as a dictionary of field name keys and type values. Output is the output of this node.

  The allowed schema definitions are as follows:

  * The schema must be a dictionary
    ```
    Schema = 
        {
            "outer": str,
            "inner": {
                "level": int
            }
        }
    ```
  * Lists must be denoted as literals, and are treated as a set of allowable values
  * Dictionaries must have strings as keys, and types as values
  * Other types must be from the following selection: `int`, `float`, `str`, `bool`, `bytes`, `dict (generic)`, `list (generic)`.
  * **Parametrized generics are not supported as of yet and will throw an exception**
  * **Custom classes are not supported as of yet and will throw an exception**

  ```python theme={null}
      Schema = {
          "name": str,
          "favorites": dict, # will allow any dict containing anything
          "cities_lived": list, # will allow any list containing anything
          "schools_attended": [str], # will allow any strings
          "pre_ipo_user": bool,
          "age": float,
          "secret_code": bytes
      }
  ```
</ParamField>

### set\_pre\_execute\_hook

<ParamField body="hook" type="Callable[[dict[str:type]], dict[str:type]]" required>
  Set a hook to be called before the node executes within the DAG.

  Can be used to hard-set certain inputs or any custom functionality such as logging inputs to analytics.
</ParamField>

### set\_post\_execute\_hook

<ParamField body="hook" type="str" required>
  Set a hook to be called after the node executes within the DAG. TODO: what is this meant to be used for?

  Log outputs to analytics, send to data warehouse, CRM, etc
</ParamField>

### validate\_input

`validate_input` gets called in [dag.execute](./dag#execute), but feel free to call it wherever you want.

<ResponseField type="bool">
  Whether or not the input data (`input`) matches the input schema (`input_s`). Although we raise an exception for the failure case in DAG, whether you want to raise an exception or not when you use the method otherwise is up to you.
</ResponseField>

### validate\_output

`validate_output` gets called in [dag.execute](./dag#execute), but feel free to call it wherever you want.

<ResponseField type="bool">
  Whether or not the output data (`output`) matches the output schema (`output_s`). Although we raise an exception for the failure case in DAG, whether you want to raise an exception or not when you use the method otherwise is up to you.
</ResponseField>

### validate\_execute\_args

<ResponseField type="bool">
  Whether or not the execute args data (`execute_args`) matches the execute\_args schema (`__execute_args_s`).
</ResponseField>

### execute

Abstract method which must be implemented in a subclass. This method is called when the node is executed within a DAG.

In order to access the input for the `Node`, use `self.get_input()`. Once you have created the output dictionary, instead of returning it, set it as the `Node`'s output by using `self.set_output()`.
