# tff.framework.ResourceManagingExecutorFactory

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/federated/blob/v0.87.0 Version 2.0, January 2004 Licensed under the Apache License, Version 2.0 (the) |

Implementation of executor factory holding an executor per cardinality.

Inherits From: [`ExecutorFactory`](https://www.tensorflow.org/federated/api_docs/python/tff/framework/ExecutorFactory)

    tff.framework.ResourceManagingExecutorFactory(
        executor_stack_fn: Callable[[executor_factory.CardinalitiesType], executor_base.Executor]
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `executor_stack_fn` | Callable taking a mapping from `placements.PlacementLiteral` to integers, and returning an `executor_base.Executor`. The returned executor will be configured to handle these cardinalities. |

<br />

## Methods

### `clean_up_executor`

[View source](https://github.com/tensorflow/federated/blob/v0.87.0
Version 2.0, January 2004
Licensed under the Apache License, Version 2.0 (the)

    clean_up_executor(
        cardinalities: https://www.tensorflow.org/federated/api_docs/python/tff/framework/CardinalitiesType
    )

Calls `close` on constructed executors, resetting internal cache.

If a caller holds a name bound to any of the executors returned from
`create_executor` with the specified cardinalities, this executor
should be assumed to be in an invalid state, and should not be used after
this method is called. Instead, callers should again invoke
`create_executor`.

<br />

<br />

<br />

| Args ||
|---|---|
| `cardinalities` | The cardinalities of the executor to be cleaned up. |

<br />

### `create_executor`

[View source](https://github.com/tensorflow/federated/blob/v0.87.0
Version 2.0, January 2004
Licensed under the Apache License, Version 2.0 (the)

    create_executor(
        cardinalities: https://www.tensorflow.org/federated/api_docs/python/tff/framework/CardinalitiesType
    ) -> executor_base.Executor

Constructs or gets existing executor.

Returns a previously-constructed executor if this method has already been
invoked with `cardinalities`. If not, invokes `self._executor_stack_fn`
with `cardinalities` and returns the result.

<br />

<br />

<br />

| Args ||
|---|---|
| `cardinalities` | `dict` with `placements.PlacementLiteral` keys and integer values, specifying the population size at each placement. The executor stacks returned from this method are not themselves polymorphic; a concrete stack must have fixed sizes at each placement. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| Instance of `executor_base.Executor` as described above. ||

<br />