Git Product home page Git Product logo

Comments (8)

parente avatar parente commented on May 30, 2024 1

Setting the Console out and err at the start of each cell execution leads to all sorts of problems when using anonymous functions with executors. The history in #31 should show many of the things I tried without success: marking everything transient, wrapping the stream setting in a object, marking the object properties transient, letting the object be serialized but error'ing quietly on executors, ...

Taking a step back, the correct way to solve this problem is still what I noted above: setting the console stdout/stderr before / around creation of the SparkContext so that all threads inherit the streams. The only reason I avoided that approach to start is because it's going to be difficult (and hopefully not impossible) to get initializing ordering right using spylon, pyspark, and py4j.

What we currently do:

  1. Initialize pyspark.SparkContext which creates a py4j gateway for us
  2. Initialize the Scala interpreter using the gateway
  3. Set the Console / System streams to what we want (which doesn't work for all threads)

What we need to do:

  1. Launch the py4j gateway ourselves using pyspark.java_gateway.launch_gateway
  2. Initialize the Scala interpreter using the gateway
  3. Set the Console / System streams to what we want
  4. Initialize pyspark.SparkContext with the gateway instance

from spylon-kernel.

parente avatar parente commented on May 30, 2024

Saw this yesterday in a different case. Turned out it was a spark config setting that actually disabled output for explain. In your case, if you run the cell again, does it work the second time? Or is it that particular call always gives nothing.

from spylon-kernel.

patrick-nicholson avatar patrick-nicholson commented on May 30, 2024

No, in my case it refuses to return no matter the number of retries. It seems to be more about the command refusing to return output than the cell. That is, if I change the command within the same cell it will return output, but if I try the refused command in a new cell, it still refuses.

from spylon-kernel.

parente avatar parente commented on May 30, 2024

That's what i saw yesterday with explain but it was due to how Spark was configured.

from spylon-kernel.

parente avatar parente commented on May 30, 2024

After talking with @patrick-nicholson, his case is likely another form of #21. Leaving this open for the time being.

from spylon-kernel.

parente avatar parente commented on May 30, 2024

Got a report of at least one instance where the output started going into the notebook log instead of into the notebook, but then restored itself back to going into the notebook a few cells / calls later.

from spylon-kernel.

parente avatar parente commented on May 30, 2024

I can reproduce the above behavior by running cells quickly in succession. Not sure yet if it's coming from the scala or python process when it happens.

from spylon-kernel.

parente avatar parente commented on May 30, 2024

Problem is in scala. Console.setOut/setErr is thread specific, allows mutation (it's a setter!), and, for these reasons, deprecated in Scala 2.12. Tried using System.set but to no avail. Fix that works is to wrap all code to be interpreted in a Console.withOut/withErr(fileHandle) { } block. Will work this change in soon and see how it behaves with some interesting cases after some other code cleanup.

from spylon-kernel.

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.