Conversation
* Add `invokeForeignLoader` to commonize the way tasks are attempted to be launched in a foreign class loader * Add `buildClassLoader` to accomplish the common tasks for hadoop jobs when building a ClassLoader
|
This generally LGTM, assuming it still works :). Is there a way to add tests? |
|
@cheddar : @xvrl and I briefly spoke about what the best way to test this kind of stuff is. Due to the overhead of setting up and tearing down a yarn and hdfs temporary single-node-cluster, a test outside the default It is worth noting that I used this technique for the recompressing segments and reduced our metrics datasize by about 20%. So in general the technique works. The question simply remains how best to test that this task still functions. A few options for adding in hadoopy tests are:
|
There was a problem hiding this comment.
earlier it was HadoopIndexGeneratorInnerProcessing.class.getName() which is more compiler friendly. You can possibly change the invokeForeignLoader(Class clazz,...) instead of invokeForeignLoader(String clazz,..) too.
There was a problem hiding this comment.
I did it this way on purpose. The prior way didn't work as expected because it was causing the clazz to get loaded in the current classloader instead of the foreign classloader. This way achieves complete isolation.
There was a problem hiding this comment.
do you have an example of what did not work as a consequence of this? This is something we should have a test for
There was a problem hiding this comment.
It was in some modifications I did for the compression task, not in the hadoop task (though some OTHER hadoop problems may have been a result of this).
I tried to find a way to add unit tests but couldn't find a clean method (all of maybe 20 minutes). If anyone knows how to do classloading isolation unit tests I'm all ears.
There was a problem hiding this comment.
Specifically, there were some classes in the target clazz (method parameters, etc) that were getting loaded in the current classloader, so when it came time to use them, they were failing because the class was not loaded properly.
There was a problem hiding this comment.
We also need to make sure this doesn't introduce new problems that the old way of loading somehow masked.

invokeForeignLoaderto commonize the way tasks are attempted to be launched in a foreign class loaderbuildClassLoaderto accomplish the common tasks for hadoop jobs when building a ClassLoaderThis is to help take a baby step towards abstracting hadoop tasks better (and allowing things like Conversion tasks also use hadoop)