Github user som-snytt commented on the issue:

    https://github.com/apache/spark/pull/21495
  
    The Scala REPL change at startup was to read user input while the 
single-threaded compiler was initializing on the main thread.
    
    There is a `SplashReader` that collects that input; its last act is to 
replace itself with the real interactive reader. (I see that `-e` is 
implemented as a reader of the expression string.)
    
    Since you can forgo the illusion of a "snappy start-up", I think your 
`printWelcome` could just block on a latch, waiting for your custom init to 
complete. (Your init code could either just print stuff, or it could stash a 
string for your printWelcome to append.)
    
    Never mind, that doesn't work because printWelcome is on the main thread, 
not the splash thread; since printWelcome is expensive I/O, I ought to have had 
the foresight to move it to the splash thread.
    
    So, your best bet for synchronous startup is to do everything in 
printWelcome: createInterpreter, your init commands that produce output. 
`IMain` has a compiler that is initialized lazily, so I don't think you have to 
explicitly `intp.initializeSynchronous`.
    
    But `createInterpreter` will be called again; you'll want to detect that 
and make it a no-op; the method is also called for `:replay`, I don't know if 
that is useful in the spark environment?
    
    Unfortunately, there is no option for specifying a custom splash reader 
that might do these things.
    
    As a final irony, I did some janitorial work to deprecate `-Yrepl-sync`, 
which was unused (I think it was put in because the old threading was broken); 
maybe I will revive it for this use case, to skip the splash reader which 
prints the prompt you don't want.
    



---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to