# flyte.extend

## Directory

### Classes

| Class | Description |
|-|-|
| [`AsyncFunctionTaskTemplate`](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.extend/asyncfunctiontasktemplate/page.md) | A task template that wraps an asynchronous functions. |
| [`ImageBuildEngine`](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.extend/imagebuildengine/page.md) | ImageBuildEngine contains a list of builders that can be used to build an ImageSpec. |
| [`TaskTemplate`](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.extend/tasktemplate/page.md) | Task template is a template for a task that can be executed. |

### Protocols

| Protocol | Description |
|-|-|
| [`ImageBuilder`](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.extend/imagebuilder/page.md) |  |
| [`ImageChecker`](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.extend/imagechecker/page.md) |  |

### Methods

| Method | Description |
|-|-|
| [`download_code_bundle()`](#download_code_bundle) | Downloads the code bundle if it is not already downloaded. |
| [`get_proto_resources()`](#get_proto_resources) | Get main resources IDL representation from the resources object. |
| [`is_initialized()`](#is_initialized) | Check if the system has been initialized. |
| [`lazy_module()`](#lazy_module) | This function is used to lazily import modules. |
| [`pod_spec_from_resources()`](#pod_spec_from_resources) |  |

### Variables

| Property | Type | Description |
|-|-|-|
| `PRIMARY_CONTAINER_DEFAULT_NAME` | `str` |  |
| `TaskPluginRegistry` | `_Registry` |  |

## Methods

#### download_code_bundle()

```python
def download_code_bundle(
    code_bundle: flyte.models.CodeBundle,
) -> flyte.models.CodeBundle
```
Downloads the code bundle if it is not already downloaded.

| Parameter | Type | Description |
|-|-|-|
| `code_bundle` | `flyte.models.CodeBundle` | The code bundle to download. |

**Returns:** The code bundle with the downloaded path.

#### get_proto_resources()

```python
def get_proto_resources(
    resources: flyte._resources.Resources | None,
) -> typing.Optional[flyteidl2.core.tasks_pb2.Resources]
```
Get main resources IDL representation from the resources object

| Parameter | Type | Description |
|-|-|-|
| `resources` | `flyte._resources.Resources \| None` | User facing Resources object containing potentially both requests and limits |

**Returns:** The given resources as requests and limits

#### is_initialized()

```python
def is_initialized()
```
Check if the system has been initialized.

**Returns:** True if initialized, False otherwise

#### lazy_module()

```python
def lazy_module(
    fullname,
)
```
This function is used to lazily import modules.  It is used in the following way:
.. code-block:: python
    from flytekit.lazy_import import lazy_module
    sklearn = lazy_module("sklearn")
    sklearn.svm.SVC()

| Parameter | Type | Description |
|-|-|-|
| `fullname` |  | |

#### pod_spec_from_resources()

```python
def pod_spec_from_resources(
    primary_container_name: str,
    requests: typing.Optional[flyte._resources.Resources],
    limits: typing.Optional[flyte._resources.Resources],
    k8s_gpu_resource_key: str,
) -> V1PodSpec
```
| Parameter | Type | Description |
|-|-|-|
| `primary_container_name` | `str` | |
| `requests` | `typing.Optional[flyte._resources.Resources]` | |
| `limits` | `typing.Optional[flyte._resources.Resources]` | |
| `k8s_gpu_resource_key` | `str` | |

## Subpages

- [AsyncFunctionTaskTemplate](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.extend/asyncfunctiontasktemplate/page.md)
  - Parameters
  - Properties
  - Methods
  - aio()
  - config()
  - container_args()
  - custom_config()
  - data_loading_config()
  - execute()
  - forward()
  - override()
  - post()
  - pre()
  - sql()
- [ImageBuildEngine](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.extend/imagebuildengine/page.md)
- [ImageBuilder](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.extend/imagebuilder/page.md)
  - Methods
  - build_image()
  - get_checkers()
- [ImageChecker](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.extend/imagechecker/page.md)
  - Methods
  - image_exists()
- [TaskTemplate](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.extend/tasktemplate/page.md)
  - Parameters
  - Properties
  - Methods
  - aio()
  - config()
  - container_args()
  - custom_config()
  - data_loading_config()
  - execute()
  - forward()
  - override()
  - post()
  - pre()
  - sql()

---
**Source**: https://github.com/unionai/unionai-docs/blob/main/content/api-reference/flyte-sdk/packages/flyte.extend/_index.md
**HTML**: https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.extend/
