question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ApplicationRunner API improvements

See original GitHub issue

Currently, the “usual” way to run an ApplicationSession-derived component is via the ApplicationRunner API. This lumps together several things:

  • creates the component (ComponentConfig + instantiating the session)
  • possibly sets up TLS options, if wss:// URI
  • starts the event-loop (reactor.run() for Twisted or run_until_complete in asyncio).
  • starts logging (via txaio.start_logging).
  • handles several error-cases

This becomes awkward for certain use-cases, and e.g. spawned a start_reactor=bool kwarg for the Twisted version (which also lumps in logging, because start_logging is only called if it starts the reactor itself).

I am filing this bug to collect these use-cases as a way to improve the “I wish to run a component” API to ensure they’re covered.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
potens1commented, Jun 28, 2016

I subscribe to this. IMHO, the ApplicationRunner does too much of magic (well, it’s not magic at all, the code is very short and easy to understand, but you have to check what is going on here when you are discovering autobahn-python), i.e. running the loop and closing the loop. I think this should be done explicitly by the user (or there should be a way to do it manually, if the default is doing all the machinery of the loop) because, when writing software that has already asyncio components, it’s a bit strange not being able to start the loop by yourself, or adding an autobahn component to an already running loop/software, more over, when the connection to the router is lost, the complete program stops (because the loop is stopped), and, if i.e. you want to do asyncio things to clean stuffs (i.e, start an asyncio commit to db, continue running tasks and restart a new session,…) you can’t. I know you can subclass ApplicationRunner to change all those things, by I’m more or less convinced that’s what will happen to the majority of users, rewriting ApplicationRunner in a way or another, so, maybe there is some value to rethink the thing. I also find the documentation should emphase ApplicationRunner is designed for quick tests and development and is likely to be subclassed for more complex setup.

1reaction
mayerwincommented, Jun 14, 2016

It is indeed very annoying not to be able to control logging (I have been struggling to find why logging was duplicate), and the event loop (most asyncio code allows to pass an arbitrary loop to be used).

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use ApplicationRunner in Spring Boot application?
Let's Jump to Code. As per API documentation, ApplicationRunner is an Interface, so we cannot create an instance of it, but we can...
Read more >
Spring Boot Features
This section dives into the details of Spring Boot. Here you can learn about the key features that you may want to use...
Read more >
App wrapper on top of ApplicationRunner #208 - GitHub
App wrapper on top of ApplicationRunner #208 ... The use of Context changes the API of every procedure/handler. It cannot be any longer...
Read more >
SEP-13: unify high- and low-level user applications in YARN and ...
ApplicationRunner only supports high-level API and does not fully support low-level ... A high-level overview of the proposed changes is illustrated below:.
Read more >
When and why do we need ApplicationRunner and Runner ...
These runners are used to run the logic on application startup, for example spring boot has ApplicationRunner(Functional Interface) with run ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found