GithubHelp home page GithubHelp logo

Comments (7)

minrk avatar minrk commented on July 20, 2024

If I understand corrctly, this is how IPython parallel already works. You can iterate through an AsyncResult, and it will yield results as they arrive.

Can you describe a bit more detail about what you are trying to accomplish?

from ipyparallel.

mbraak avatar mbraak commented on July 20, 2024

Thanks for your answer.

I see in the documentation that the view.map does indeed have an AsyncResult. Let me see if that works in our situation.

from ipyparallel.

mbraak avatar mbraak commented on July 20, 2024

It seems that our use case does not work with view.map.

We want something like this:

from ipyparallel import Client

def p():
  for i in range(10):
    do_yield(i)

rc = Client()
view = rc[:]
result = view.apply(p)

for v in result:
  print v

I think this is different from view.map because in this case it's the applied code that is responsible for the yielding.

The view.map alternative is subtly different:

result = view.map(lambda v: v, range(10))

for v in result:
    print v

from ipyparallel.

minrk avatar minrk commented on July 20, 2024

Just to clarify from your example above, you want all engines to run the same function p with the same arguments?

from ipyparallel.

mbraak avatar mbraak commented on July 20, 2024

No, we want 1 engine to run the p function.

This would be correct:

rc = Client()
view = rc[0]

from ipyparallel.

minrk avatar minrk commented on July 20, 2024

Here's an example of running a generator remotely. The gist is to:

  1. call the generator function on the engine
  2. create an iterator on the generator
  3. use apply(next, Reference('iterator')) to yield each item from the remote generator

Then you get a local generator yielding results from a remote generator.

from ipyparallel.

mbraak avatar mbraak commented on July 20, 2024

Thanks! This looks very promising.

from ipyparallel.

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.