Code Monkey home page Code Monkey logo

Comments (8)

pytestbot avatar pytestbot commented on May 29, 2024

Original comment by @RonnyPfannschmidt

after some investigation it seems like we need a utility function with a lock to have that one work properly

from execnet.

pytestbot avatar pytestbot commented on May 29, 2024

Original comment by @RonnyPfannschmidt

i created a proof of concept patch

please try https://bitbucket.org/RonnyPfannschmidt/execnet-patches/src/57cca2079529/linecache

after you report i'll commit it to the main repo

from execnet.

pytestbot avatar pytestbot commented on May 29, 2024

Original comment by Anonymous

Hi Ronny,

i looked at the patch and i guess it will work this way. I do understand that you want to always reload the module from disk when something changes but if i just want to execute the same module remotely lets say ten thousand times on different hosts it will result in reading the same module ten thousand times from disc. With your patch these ten thousand reads would be sequentially. Lets say the os and hard drive wouldnt cache HDD access. With 15ms hdd access speed it would take 150s to only load the module.

from execnet.

pytestbot avatar pytestbot commented on May 29, 2024

Original comment by @RonnyPfannschmidt

sadly i cant make linecache threadsafe,

however i can rely on disk-caches (if you load the same files thousands of times, its bound to end in cache)

a propper cache would be nice to have

could you give a more detailed example of your use-case,

we might be able to adapt things like execnet groups to do the file loading only once for large sets of gateways if it fits your use-case

from execnet.

pytestbot avatar pytestbot commented on May 29, 2024

Original comment by Anonymous

What iam doing right now with execnet:

{{{
I have n nodes.
For each node I create one group.
For each group I create one gateway.
}}}

Over each gateway I create x channels in different threads which are active in parallel with:
{{{
channel = gw.remote_exec(my_module) # this results in linecache activity
}}}

All channels load the same module (my_module). The remote code needs to be reloaded for a new channel
because its in a non recoverable state after execution. This means I cant ('without a lot of effort') let the channel stay open and send the next job.

Without looking at the remote_exec code a possibility could be something like this:

{{{
#!python

def remote_exec(self, ..., reload_module=True):
...

 if reload_module:
        linecache.updatecache(inspect.getsourcefile(source))

 ...

}}}

with this solution u wont break anyones production code if they decide to use a new version.

from execnet.

pytestbot avatar pytestbot commented on May 29, 2024

Original comment by @RonnyPfannschmidt

remote_exec cant have new args with special meaning

you should have one group with n nodes instead of n groups with 1 node

then we can do a group.remote_exec that will load once, send everywhere
the result will be a multichannel

from execnet.

pytestbot avatar pytestbot commented on May 29, 2024

Original comment by @RonnyPfannschmidt

btw, please drop by in the #pylib channel on the freenode irc network if possible

from execnet.

pytestbot avatar pytestbot commented on May 29, 2024

Original comment by @RonnyPfannschmidt

unresolved - feedback died down

from execnet.

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.