You mentioned that after adding zarr export support to AffineFusion, you ran into the following error when running a distributed spark instance:
Exception in thread "main" java.lang.NoSuchMethodError: com.google.gson.reflect.TypeToken.getParameterized(Ljava/lang/reflect/Type;[Ljava/lang/reflect/Type;)Lcom/google/gson/reflect/TypeToken;
at org.janelia.saalfeldlab.n5.zarr.N5ZarrReader.getZArraryAttributes(N5ZarrReader.java:259)
...
I think this problem occurs because the Hadoop libraries used by Spark pull in an ancient version of Gson (likely 2.2.4 or similar) and the n5 zarr library (currently) relies upon Gson 2.8.6. Even though Gson 2.8.6 is bundled in the big-stitcher fat jar, the Hadoop stuff is higher in the classpath when running a Spark cluster - so you end up running with ancient Gson. This post describes the issue very nicely.
As the post mentions, the best way to fix this issue is to force Spark to use a newer Gson library by specifying additional --conf arguments when launching spark-submit like this:
find a gson-2.8.6.jar file - I pulled it from my local maven repo: ${HOME}/.m2/repository/com/google/code/gson/gson/2.8.6/gson-2.8.6.jar,
copy it to a network filesystem location that your spark driver and workers can access, and
then add the path to the spark.driver.extraClassPath and spark.executor.extraClassPath configuration as I did above.
Give this a shot and let me know if it solves the errors you were getting.
I ran a small test case at Janelia and was able to successfully produce a zarr result - so, I'm hopeful this will work for you.
Finally while debugging this problem, I made a few minor tweaks to your commits here that mean you will need to specify -s ZARR (capitalized) instead of your original lower case version if you pull and run with the latest code.
Hi @kgabor,
You mentioned that after adding zarr export support to AffineFusion, you ran into the following error when running a distributed spark instance:
I think this problem occurs because the Hadoop libraries used by Spark pull in an ancient version of Gson (likely 2.2.4 or similar) and the n5 zarr library (currently) relies upon Gson 2.8.6. Even though Gson 2.8.6 is bundled in the big-stitcher fat jar, the Hadoop stuff is higher in the classpath when running a Spark cluster - so you end up running with ancient Gson. This post describes the issue very nicely.
As the post mentions, the best way to fix this issue is to force Spark to use a newer Gson library by specifying additional
--conf
arguments when launching spark-submit like this:You'll need to:
${HOME}/.m2/repository/com/google/code/gson/gson/2.8.6/gson-2.8.6.jar
,spark.driver.extraClassPath
andspark.executor.extraClassPath
configuration as I did above.Give this a shot and let me know if it solves the errors you were getting. I ran a small test case at Janelia and was able to successfully produce a zarr result - so, I'm hopeful this will work for you.
Finally while debugging this problem, I made a few minor tweaks to your commits here that mean you will need to specify
-s ZARR
(capitalized) instead of your original lower case version if you pull and run with the latest code.Let me know how it goes, Eric