Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Future async compatibility #96

Open
gil-obradors opened this issue Jul 17, 2020 · 7 comments
Open

Future async compatibility #96

gil-obradors opened this issue Jul 17, 2020 · 7 comments
Labels

Comments

@gil-obradors
Copy link

Any intentions to convert to async compatible package?

I'm learning about it....

@luqasz
Copy link
Owner

luqasz commented Jul 17, 2020

Hi. Yes I'd like to support that BUT asyncio in python is a one big state machine and I'd like to avoid it. Trio IMO is much easier.

@gil-obradors do you have any experience with asyncio ?

@gil-obradors
Copy link
Author

Hi ! Sorry for the delay.

I have teorical knowloedges, but not real experience, more than use frameworks that are ready for async like starlette,

My conclusion after some mental loops that I have thinked last days...

  • librouters is low level interface. So I'm not sure if its interesting to await for byte level reciveing. May be can be interesting at command sentense level.
  • Need an event loop, but must be mixed with other tasks to get full async functions. An event loop dedicated for librouteros havn't got sense inspite of a big app that is doing 100 calls to routes Mikrotik, like starlette is with Http requests, do you follow me?
  • Interesting implementations use workers like celery. This workers can do async tasks. Maybe this can be the best approach

Trio is a tool for create and manage async app, with event loop... This would be for the second point that I have described. I'm wrong?

Gil

@luqasz
Copy link
Owner

luqasz commented Aug 6, 2020

No need to implement event loop. This is already provided in asyncio and trio. The challenge is to enable .tag support, which will provide multiple commands execution in one connection.

@gil-obradors
Copy link
Author

possible roadmaps:

  • include tag to transactions (provide multiple commands execution in one connection )
  • migrate socket to asyncore ( async/await ready)

I will keep thinking about how to deal with this.

I'm getting inspired with pysnmp, that you can run async or sync requests as you want : asyncore,asyncio, trollius, twisted

@luqasz
Copy link
Owner

luqasz commented Jan 3, 2021

Keep in mind that it is impossible to be 100% DRY with both synchronous and async code. Some parts (if not a lot of them) will have to be wrote twice.

@thefathacker
Copy link

Hi @gil-obradors,

Sorry do not know if this is an old topic, this is library is only something I have only just found while attempting to automate my mikrotik network.

What I am doing in order to speed up my process I am using python threading and a thread per device it may be a way to increase performance

Regards,

TFH

@theGowda
Copy link
Contributor

Hi @gil-obradors,

Sorry do not know if this is an old topic, this is library is only something I have only just found while attempting to automate my mikrotik network.

What I am doing in order to speed up my process I am using python threading and a thread per device it may be a way to increase performance

Regards,

TFH

PR #303 should solve this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants