gaogaotiantian commented on PR #60108:
URL: https://github.com/apache/spark/pull/60108#issuecomment-6754550102

   Thanks for the re-review.
   
   **Pip installs:** you're right, and my earlier reply here was wrong. The 
wheel ships `pyspark/python/lib/pyspark.zip` and the py4j zip, and 
`sparkPythonPath` puts them first on the worker path. I checked with the 4.1.0 
wheel in a fresh venv: a worker loads pyspark from 
`.../pyspark/python/lib/pyspark.zip/pyspark/__init__.py` and py4j from 
`.../py4j-0.10.9.9-src.zip/py4j/__init__.py`. So pip-installed workers keep 
those archives and get the speedup. The description now says so.
   
   **A user zip that bundles pyspark or py4j:** I went with the second option. 
In fa217e33b9c, the `_SPARK_ARCHIVES` comment says that a zip which supplies 
the worker's `pyspark` or `py4j` counts as Spark's archive and must not be 
replaced while the application runs. The description says the same. Two reasons:
   
   - Such a zip can't be replaced safely mid-application, even on master. The 
daemon and its workers already run pyspark (or py4j) modules from it, and 
pyspark imports many of its submodules lazily, so after a refresh the later 
imports would come from the new copy while the modules already loaded come from 
the old one. The refresh on master changes how that layout fails, but doesn't 
make it work.
   - Limiting the set to entries the JVM passes would drop YARN. Executors 
there have no `SPARK_HOME`, so the localized `pyspark.zip` reaches the worker 
through the `PYTHONPATH` that `Client` builds, not through `sparkPythonPath`. A 
list from `PythonWorkerFactory` wouldn't include it, so YARN workers would lose 
the speedup unless the archive list were plumbed from the client as well.
   
   The two inline findings are answered in their threads.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to