Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 15 for lifespan (0.18 sec)

  1. docs/en/docs/advanced/events.md

        You can read more about the Starlette `lifespan` handlers in <a href="https://www.starlette.io/lifespan/" class="external-link" target="_blank">Starlette's  Lifespan' docs</a>.
    
        Including how to handle lifespan state that can be used in other areas of your code.
    
    ## Sub Applications
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 7.8K bytes
    - Viewed (0)
  2. docs_src/events/tutorial003.py

        return x * 42
    
    
    ml_models = {}
    
    
    @asynccontextmanager
    async def lifespan(app: FastAPI):
        # Load the ML model
        ml_models["answer_to_everything"] = fake_answer_to_everything_ml_model
        yield
        # Clean up the ML models and release the resources
        ml_models.clear()
    
    
    app = FastAPI(lifespan=lifespan)
    
    
    @app.get("/predict")
    async def predict(x: float):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Mar 07 15:46:00 GMT 2023
    - 569 bytes
    - Viewed (0)
  3. tests/test_router_events.py

        assert state.sub_router_shutdown is True
    
    
    def test_app_lifespan_state(state: State) -> None:
        @asynccontextmanager
        async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
            state.app_startup = True
            yield
            state.app_shutdown = True
    
        app = FastAPI(lifespan=lifespan)
    
        @app.get("/")
        def main() -> Dict[str, str]:
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Oct 18 12:36:40 GMT 2023
    - 3.2K bytes
    - Viewed (0)
  4. docs/de/docs/advanced/events.md

        Weitere Informationen zu Starlettes `lifespan`-Handlern finden Sie in <a href="https://www.starlette.io/lifespan/" class="external-link" target="_blank">Starlettes Lifespan-Dokumentation</a>.
    
        Einschließlich, wie man Lifespan-Zustand handhabt, der in anderen Bereichen Ihres Codes verwendet werden kann.
    
    ## Unteranwendungen
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 30 20:30:59 GMT 2024
    - 9.1K bytes
    - Viewed (0)
  5. docs/pt/docs/advanced/events.md

        Você pode ler mais sobre o manipulador `lifespan` do Starlette na <a href="https://www.starlette.io/lifespan/" class="external-link" target="_blank">Documentação do Lifespan Starlette</a>.
    
        Incluindo como manipular estado do lifespan que pode ser usado em outras áreas do seu código.
    
    ## Sub Aplicações
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 8.6K bytes
    - Viewed (0)
  6. docs/em/docs/advanced/events.md

    ```Python
    async with lifespan(app):
        await do_stuff()
    ```
    
    🕐❔ 👆 ✍ 🔑 👨‍💼 ⚖️ 🔁 🔑 👨‍💼 💖 🔛, ⚫️❔ ⚫️ 🔨 👈, ⏭ 🛬 `with` 🍫, ⚫️ 🔜 🛠️ 📟 ⏭ `yield`, &amp; ⏮️ ❎ `with` 🍫, ⚫️ 🔜 🛠️ 📟 ⏮️ `yield`.
    
    👆 📟 🖼 🔛, 👥 🚫 ⚙️ ⚫️ 🔗, ✋️ 👥 🚶‍♀️ ⚫️ FastAPI ⚫️ ⚙️ ⚫️.
    
    `lifespan` 🔢 `FastAPI` 📱 ✊ **🔁 🔑 👨‍💼**, 👥 💪 🚶‍♀️ 👆 🆕 `lifespan` 🔁 🔑 👨‍💼 ⚫️.
    
    ```Python hl_lines="22"
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 6.2K bytes
    - Viewed (0)
  7. docs/en/docs/advanced/async-tests.md

    !!! warning
        If your application relies on lifespan events, the `AsyncClient` won't trigger these events. To ensure they are triggered, use `LifespanManager` from <a href="https://github.com/florimondmanca/asgi-lifespan#usage" class="external-link" target="_blank">florimondmanca/asgi-lifespan</a>.
    
    ## Other Asynchronous Function Calls
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Jan 13 12:07:15 GMT 2024
    - 3.9K bytes
    - Viewed (0)
  8. api/maven-api-core/src/main/java/org/apache/maven/api/di/MojoExecutionScoped.java

    import static java.lang.annotation.ElementType.METHOD;
    import static java.lang.annotation.ElementType.TYPE;
    import static java.lang.annotation.RetentionPolicy.RUNTIME;
    
    /**
     * Indicates that the annotated bean has a lifespan limited to a given mojo execution,
     * which means each mojo execution will result in a different instance being injected.
     *
     * TODO: this is currently not implemented
     *
     * @since 4.0.0
     */
    @Scope
    @Documented
    Java
    - Registered: Sun Apr 21 03:35:09 GMT 2024
    - Last Modified: Mon Feb 05 09:45:47 GMT 2024
    - 1.4K bytes
    - Viewed (0)
  9. docs/de/docs/advanced/async-tests.md

    !!! warning "Achtung"
        Falls Ihre Anwendung auf Lifespan-Events angewiesen ist, der `AsyncClient` löst diese Events nicht aus. Um sicherzustellen, dass sie ausgelöst werden, verwenden Sie `LifespanManager` von <a href="https://github.com/florimondmanca/asgi-lifespan#usage" class="external-link" target="_blank">florimondmanca/asgi-lifespan</a>.
    
    ## Andere asynchrone Funktionsaufrufe
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 30 20:25:57 GMT 2024
    - 4.4K bytes
    - Viewed (0)
  10. api/maven-api-di/src/main/java/org/apache/maven/api/di/MojoExecutionScoped.java

    import static java.lang.annotation.ElementType.METHOD;
    import static java.lang.annotation.ElementType.TYPE;
    import static java.lang.annotation.RetentionPolicy.RUNTIME;
    
    /**
     * Indicates that the annotated bean has a lifespan limited to a given mojo execution,
     * which means each mojo execution will result in a different instance being injected.
     *
     * TODO: this is currently not implemented
     *
     * @since 4.0.0
     */
    @Scope
    @Documented
    Java
    - Registered: Sun Apr 28 03:35:10 GMT 2024
    - Last Modified: Mon Apr 22 13:58:08 GMT 2024
    - 1.4K bytes
    - Viewed (0)
Back to top