Fix the Injector creation in HadoopTask (#13138)

* Injector fix in HadoopTask

* Log the ExtensionsConfig while instantiating the HadoopTask

* Log the config in the run() method instead of the ctor
This commit is contained in:
Laksh Singla 2022-09-24 10:38:25 +05:30 committed by GitHub
parent 306f612f86
commit 0bfa81b7df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -330,6 +330,7 @@ public class HadoopIndexTask extends HadoopTask implements ChatHandler
try {
registerResourceCloserOnAbnormalExit(config -> killHadoopJob());
String hadoopJobIdFile = getHadoopJobIdFileName();
logExtensionsConfig();
final ClassLoader loader = buildClassLoader(toolbox);
boolean determineIntervals = spec.getDataSchema().getGranularitySpec().inputIntervals().isEmpty();

View File

@ -50,7 +50,7 @@ public abstract class HadoopTask extends AbstractBatchIndexTask
{
private static final Logger log = new Logger(HadoopTask.class);
static final Injector INJECTOR = new StartupInjectorBuilder().withExtensions().build();
static final Injector INJECTOR = new StartupInjectorBuilder().forServer().build();
private static final ExtensionsLoader EXTENSIONS_LOADER = ExtensionsLoader.instance(INJECTOR);
private final List<String> hadoopDependencyCoordinates;
@ -207,6 +207,15 @@ public abstract class HadoopTask extends AbstractBatchIndexTask
return classLoader;
}
/**
* This method logs the {@link ExtensionsConfig} that was used to fetch the hadoop dependencies and build the classpath
* for the jobs
*/
protected static void logExtensionsConfig()
{
log.info("HadoopTask started with the following config:\n%s", EXTENSIONS_LOADER.config().toString());
}
/**
* This method tries to isolate class loading during a Function call
*