airflow_balancer.BalancerConfiguration

pydantic model airflow_balancer.BalancerConfiguration[source]

Bases: BaseModel

Show JSON schema
{
   "title": "BalancerConfiguration",
   "type": "object",
   "properties": {
      "hosts": {
         "items": {
            "$ref": "#/$defs/Host"
         },
         "title": "Hosts",
         "type": "array"
      },
      "ports": {
         "items": {
            "$ref": "#/$defs/Port"
         },
         "title": "Ports",
         "type": "array"
      },
      "default_username": {
         "default": "airflow",
         "title": "Default Username",
         "type": "string"
      },
      "default_password": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "$ref": "#/$defs/Variable"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Default Password"
      },
      "default_key_file": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Default Key File"
      },
      "primary_queue": {
         "default": "default",
         "title": "Primary Queue",
         "type": "string"
      },
      "secondary_queue": {
         "default": "default",
         "title": "Secondary Queue",
         "type": "string"
      },
      "default_queue": {
         "default": "default",
         "title": "Default Queue",
         "type": "string"
      },
      "default_size": {
         "default": 8,
         "title": "Default Size",
         "type": "integer"
      },
      "override_pool_size": {
         "default": false,
         "title": "Override Pool Size",
         "type": "boolean"
      },
      "create_connection": {
         "default": false,
         "title": "Create Connection",
         "type": "boolean"
      }
   },
   "$defs": {
      "Host": {
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "username": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Username"
            },
            "password": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "$ref": "#/$defs/Variable"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Password"
            },
            "key_file": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Key File"
            },
            "os": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Os"
            },
            "pool": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Pool"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "size": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Size"
            },
            "queues": {
               "items": {
                  "type": "string"
               },
               "title": "Queues",
               "type": "array"
            },
            "tags": {
               "items": {
                  "type": "string"
               },
               "title": "Tags",
               "type": "array"
            }
         },
         "required": [
            "name"
         ],
         "title": "Host",
         "type": "object"
      },
      "Pool": {
         "properties": {
            "pool": {
               "description": "Pool name",
               "title": "Pool",
               "type": "string"
            },
            "slots": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Number of slots in the pool",
               "title": "Slots"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": "",
               "description": "Pool description",
               "title": "Description"
            },
            "include_deferred": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": false,
               "description": "Whether to include deferred tasks in the pool",
               "title": "Include Deferred"
            }
         },
         "required": [
            "pool"
         ],
         "title": "Pool",
         "type": "object"
      },
      "Port": {
         "properties": {
            "name": {
               "default": "",
               "title": "Name",
               "type": "string"
            },
            "host": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Host"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "host_name": {
               "default": "",
               "title": "Host Name",
               "type": "string"
            },
            "port": {
               "default": null,
               "description": "Port number",
               "maximum": 65535,
               "minimum": 1,
               "title": "Port",
               "type": "integer"
            },
            "tags": {
               "items": {
                  "type": "string"
               },
               "title": "Tags",
               "type": "array"
            }
         },
         "title": "Port",
         "type": "object"
      },
      "Variable": {
         "properties": {
            "key": {
               "description": "Variable key",
               "title": "Key",
               "type": "string"
            },
            "_val": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": "",
               "description": "Variable value",
               "title": "Val"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": "",
               "description": "Variable description",
               "title": "Description"
            },
            "is_encrypted": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": false,
               "description": "Whether the variable is encrypted",
               "title": "Is Encrypted"
            },
            "deserialize_json": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": false,
               "description": "Whether to deserialize JSON",
               "title": "Deserialize Json"
            }
         },
         "required": [
            "key"
         ],
         "title": "Variable",
         "type": "object"
      }
   }
}

Fields:
  • create_connection (bool)

  • default_key_file (str | None)

  • default_password (str | airflow_pydantic.utils.variable.Variable | None)

  • default_queue (str)

  • default_size (int)

  • default_username (str)

  • hosts (List[airflow_pydantic.extras.balancer.host.Host])

  • override_pool_size (bool)

  • ports (List[airflow_pydantic.extras.balancer.port.Port])

  • primary_queue (str)

  • secondary_queue (str)

field hosts: List[Host] [Optional]
field ports: List[Port] [Optional]
field default_username: str = 'airflow'
field default_password: str | Variable | None = None
field default_key_file: str | None = None
field primary_queue: str = 'default'
field secondary_queue: str = 'default'
field default_queue: str = 'default'
field default_size: int = 8
field override_pool_size: bool = False
field create_connection: bool = False
property all_hosts
property all_ports
filter_hosts(name: str | List[str] | None = None, queue: str | List[str] | None = None, os: str | List[str] | None = None, tag: str | List[str] | None = None, custom: Callable | None = None) List[Host][source]
select_host(name: str | List[str] | None = None, queue: str | List[str] | None = None, os: str | List[str] = '', tag: str | List[str] = '', custom: Callable = None) List[Host][source]
filter_ports(name: str | List[str] | None = None, tag: str | List[str] | None = None, custom: Callable | None = None) List[Host][source]
select_port(name: str | List[str] | None = None, tag: str | List[str] = '', custom: Callable = None) List[Host][source]
free_port(host: Host, min: int = 1000, max: int = 65535) Port[source]
static load_path(yaml_file: str | Path, _config_dir: str | Path = None) Self[source]

Load configuration from yaml file

static load(config_dir: Path | str = 'config', config_name: Path | str = '', overrides: list[str] | None = None, *, basepath: str = '', _offset: int = 4) BalancerConfiguration[source]