Coder Social home page Coder Social logo

Comments (5)

jettify avatar jettify commented on September 15, 2024

Yeah, I suspected that my clean up logic was not good.

Issue in async python REPL server, we expose it on separate port so user can directly connect and bypass regular aiomonitor. It is hard to make proper clean up here. One solution is disable this bypassing feature and start and stop server on demand.

from aiomonitor.

jettify avatar jettify commented on September 15, 2024

are you calling close() method inside coroutine?

from aiomonitor.

agronholm avatar agronholm commented on September 15, 2024

This is the complete module in which I start and stop aiomonitor:

from aiomonitor import Monitor, MONITOR_PORT, CONSOLE_PORT
from asphalt.core import Component, Context, context_teardown


class AIOMonitorComponent(Component):
    def __init__(self, host: str = '0.0.0.0', port: int = MONITOR_PORT,
                 console_port: int = CONSOLE_PORT, console_enabled: bool = True) -> None:
        self.host = host
        self.port = port
        self.console_port = console_port
        self.console_enabled = console_enabled

    @context_teardown
    async def start(self, ctx: Context):
        with Monitor(ctx.loop, host=self.host, port=self.port, console_port=self.console_port,
                     console_enabled=self.console_enabled):
            yield

On aiomonitor 0.3.1, this works fine.

from aiomonitor.

jettify avatar jettify commented on September 15, 2024

0.3.1 did not close resources correctly as results tests were unstable... I never designed monitor to start inside coroutine. I think there should be separate API for async mode.

from aiomonitor.

jettify avatar jettify commented on September 15, 2024

This PR should fix an issue #175

I decided to start and end python console server on demand and close it after exit, this way code is cleaner.

from aiomonitor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.