You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2021/07/20 00:41:08 UTC
[GitHub] [druid] loquisgon commented on a change in pull request #11446: Add errorMessage in taskStatus for task failures in middleManagers/indexers/peons
loquisgon commented on a change in pull request #11446:
URL: https://github.com/apache/druid/pull/11446#discussion_r672722320
##########
File path: indexing-service/src/test/java/org/apache/druid/indexing/overlord/ForkingTaskRunnerTest.java
##########
@@ -145,12 +162,192 @@ public void testMaskedIterator()
"-Dsome.somepassword = secret=value",
"-Dsome.some=notasecret",
"-Dsome.otherSecret= =asfdhkj352872598====fasdlkjfa="
- ),
- "java -cp /path/to/somewhere:some-jars.jar /some===file /asecretFileNa=<masked> -Dsome.property=random -Dsome.otherproperty = random=random " +
- "-Dsome.somesecret =<masked> -Dsome.somesecret=<masked> -Dsome.somepassword =<masked> -Dsome.some=notasecret -Dsome.otherSecret=<masked>"
+ ),
+ "java -cp /path/to/somewhere:some-jars.jar /some===file /asecretFileNa=<masked> -Dsome.property=random -Dsome.otherproperty = random=random "
+ + "-Dsome.somesecret =<masked> -Dsome.somesecret=<masked> -Dsome.somepassword =<masked> -Dsome.some=notasecret -Dsome.otherSecret=<masked>"
);
StartupLoggingConfig startupLoggingConfig = new StartupLoggingConfig();
- ForkingTaskRunner forkingTaskRunner = new ForkingTaskRunner(new ForkingTaskRunnerConfig(), null, new WorkerConfig(), null, null, null, null, startupLoggingConfig);
- Assert.assertEquals(originalAndExpectedCommand.rhs, forkingTaskRunner.getMaskedCommand(startupLoggingConfig.getMaskProperties(), originalAndExpectedCommand.lhs));
+ ForkingTaskRunner forkingTaskRunner = new ForkingTaskRunner(
+ new ForkingTaskRunnerConfig(),
+ null,
+ new WorkerConfig(),
+ null,
+ null,
+ null,
+ null,
+ startupLoggingConfig
+ );
+ Assert.assertEquals(
+ originalAndExpectedCommand.rhs,
+ forkingTaskRunner.getMaskedCommand(
+ startupLoggingConfig.getMaskProperties(),
+ originalAndExpectedCommand.lhs
+ )
+ );
+ }
+
+ @Test
+ public void testTaskStatusWhenTaskProcessFails() throws ExecutionException, InterruptedException
+ {
+ ForkingTaskRunner forkingTaskRunner = new ForkingTaskRunner(
+ new ForkingTaskRunnerConfig(),
+ new TaskConfig(
+ null,
+ null,
+ null,
+ null,
+ ImmutableList.of(),
+ false,
+ new Period("PT0S"),
+ new Period("PT10S"),
+ ImmutableList.of(),
+ false,
+ false
+ ),
+ new WorkerConfig(),
+ new Properties(),
+ new NoopTaskLogs(),
+ new DefaultObjectMapper(),
+ new DruidNode("middleManager", "host", false, 8091, null, true, false),
+ new StartupLoggingConfig()
+ )
+ {
+ @Override
+ ProcessHolder runTaskProcess(List<String> command, File logFile, TaskLocation taskLocation)
+ {
+ ProcessHolder processHolder = Mockito.mock(ProcessHolder.class);
+ Mockito.doNothing().when(processHolder).registerWithCloser(ArgumentMatchers.any());
+ Mockito.doNothing().when(processHolder).shutdown();
+ return processHolder;
+ }
+
+ @Override
+ int waitForTaskProcessToComplete(Task task, ProcessHolder processHolder, File logFile, File reportsFile)
+ {
+ // Emulate task process failure
+ return 1;
+ }
+ };
+
+ final TaskStatus status = forkingTaskRunner.run(NoopTask.create()).get();
+ Assert.assertEquals(TaskState.FAILED, status.getStatusCode());
+ Assert.assertEquals(
+ "Task execution process exited unsuccessfully. See middleManager logs for more details.",
Review comment:
Now that you added the exit code to the message you need to update this message as well
##########
File path: indexing-service/src/test/java/org/apache/druid/indexing/overlord/ForkingTaskRunnerTest.java
##########
@@ -145,12 +162,192 @@ public void testMaskedIterator()
"-Dsome.somepassword = secret=value",
"-Dsome.some=notasecret",
"-Dsome.otherSecret= =asfdhkj352872598====fasdlkjfa="
- ),
- "java -cp /path/to/somewhere:some-jars.jar /some===file /asecretFileNa=<masked> -Dsome.property=random -Dsome.otherproperty = random=random " +
- "-Dsome.somesecret =<masked> -Dsome.somesecret=<masked> -Dsome.somepassword =<masked> -Dsome.some=notasecret -Dsome.otherSecret=<masked>"
+ ),
+ "java -cp /path/to/somewhere:some-jars.jar /some===file /asecretFileNa=<masked> -Dsome.property=random -Dsome.otherproperty = random=random "
+ + "-Dsome.somesecret =<masked> -Dsome.somesecret=<masked> -Dsome.somepassword =<masked> -Dsome.some=notasecret -Dsome.otherSecret=<masked>"
);
StartupLoggingConfig startupLoggingConfig = new StartupLoggingConfig();
- ForkingTaskRunner forkingTaskRunner = new ForkingTaskRunner(new ForkingTaskRunnerConfig(), null, new WorkerConfig(), null, null, null, null, startupLoggingConfig);
- Assert.assertEquals(originalAndExpectedCommand.rhs, forkingTaskRunner.getMaskedCommand(startupLoggingConfig.getMaskProperties(), originalAndExpectedCommand.lhs));
+ ForkingTaskRunner forkingTaskRunner = new ForkingTaskRunner(
+ new ForkingTaskRunnerConfig(),
+ null,
+ new WorkerConfig(),
+ null,
+ null,
+ null,
+ null,
+ startupLoggingConfig
+ );
+ Assert.assertEquals(
+ originalAndExpectedCommand.rhs,
+ forkingTaskRunner.getMaskedCommand(
+ startupLoggingConfig.getMaskProperties(),
+ originalAndExpectedCommand.lhs
+ )
+ );
+ }
+
+ @Test
+ public void testTaskStatusWhenTaskProcessFails() throws ExecutionException, InterruptedException
+ {
+ ForkingTaskRunner forkingTaskRunner = new ForkingTaskRunner(
+ new ForkingTaskRunnerConfig(),
+ new TaskConfig(
+ null,
+ null,
+ null,
+ null,
+ ImmutableList.of(),
+ false,
+ new Period("PT0S"),
+ new Period("PT10S"),
+ ImmutableList.of(),
+ false,
+ false
+ ),
+ new WorkerConfig(),
+ new Properties(),
+ new NoopTaskLogs(),
+ new DefaultObjectMapper(),
+ new DruidNode("middleManager", "host", false, 8091, null, true, false),
+ new StartupLoggingConfig()
+ )
+ {
+ @Override
+ ProcessHolder runTaskProcess(List<String> command, File logFile, TaskLocation taskLocation)
+ {
+ ProcessHolder processHolder = Mockito.mock(ProcessHolder.class);
+ Mockito.doNothing().when(processHolder).registerWithCloser(ArgumentMatchers.any());
+ Mockito.doNothing().when(processHolder).shutdown();
+ return processHolder;
+ }
+
+ @Override
+ int waitForTaskProcessToComplete(Task task, ProcessHolder processHolder, File logFile, File reportsFile)
+ {
+ // Emulate task process failure
+ return 1;
+ }
+ };
+
+ final TaskStatus status = forkingTaskRunner.run(NoopTask.create()).get();
+ Assert.assertEquals(TaskState.FAILED, status.getStatusCode());
+ Assert.assertEquals(
+ "Task execution process exited unsuccessfully. See middleManager logs for more details.",
Review comment:
"Task execution process exited unsuccessfully with code[1]. See middleManager logs for more details."
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org