mirror of https://github.com/apache/druid.git
Do not print error message if pod not found when getting task location (#13971)
Do not print error message if pod not found when getting task location
This commit is contained in:
parent
2219e68fa3
commit
488f1d8363
|
@ -50,6 +50,7 @@ import org.apache.druid.k8s.overlord.common.DruidK8sConstants;
|
|||
import org.apache.druid.k8s.overlord.common.JobResponse;
|
||||
import org.apache.druid.k8s.overlord.common.K8sTaskId;
|
||||
import org.apache.druid.k8s.overlord.common.KubernetesPeonClient;
|
||||
import org.apache.druid.k8s.overlord.common.KubernetesResourceNotFoundException;
|
||||
import org.apache.druid.k8s.overlord.common.PeonPhase;
|
||||
import org.apache.druid.k8s.overlord.common.TaskAdapter;
|
||||
import org.apache.druid.tasklogs.TaskLogPusher;
|
||||
|
@ -469,6 +470,10 @@ public class KubernetesTaskRunner implements TaskLogStreamer, TaskRunner
|
|||
tlsEnabled
|
||||
);
|
||||
}
|
||||
catch (KubernetesResourceNotFoundException e) {
|
||||
log.debug(e, "Error getting task location for task %s", taskId);
|
||||
return TaskLocation.unknown();
|
||||
}
|
||||
catch (Exception e) {
|
||||
log.error(e, "Error getting task location for task %s", taskId);
|
||||
return TaskLocation.unknown();
|
||||
|
|
|
@ -52,6 +52,7 @@ import org.apache.druid.k8s.overlord.common.JobResponse;
|
|||
import org.apache.druid.k8s.overlord.common.K8sTaskAdapter;
|
||||
import org.apache.druid.k8s.overlord.common.K8sTaskId;
|
||||
import org.apache.druid.k8s.overlord.common.KubernetesPeonClient;
|
||||
import org.apache.druid.k8s.overlord.common.KubernetesResourceNotFoundException;
|
||||
import org.apache.druid.k8s.overlord.common.PeonPhase;
|
||||
import org.apache.druid.server.DruidNode;
|
||||
import org.apache.druid.server.log.StartupLoggingConfig;
|
||||
|
@ -427,6 +428,20 @@ public class KubernetesTaskRunnerTest
|
|||
assertEquals(TaskLocation.create("tweak", DruidK8sConstants.PORT, DruidK8sConstants.TLS_PORT, false), realLocation);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWorkItemGetLocation_withKubernetesResourceNotFoundException_returnsUnknownLocation()
|
||||
{
|
||||
KubernetesPeonClient client = mock(KubernetesPeonClient.class);
|
||||
|
||||
when(client.getMainJobPod(any())).thenThrow(KubernetesResourceNotFoundException.class);
|
||||
|
||||
Task task = mock(Task.class);
|
||||
when(task.getId()).thenReturn("id");
|
||||
KubernetesTaskRunner.K8sWorkItem k8sWorkItem = new KubernetesTaskRunner.K8sWorkItem(client, task, null);
|
||||
TaskLocation location = k8sWorkItem.getLocation();
|
||||
assertEquals(TaskLocation.unknown(), location);
|
||||
}
|
||||
|
||||
private Task makeTask()
|
||||
{
|
||||
return new TestableNoopTask(
|
||||
|
|
Loading…
Reference in New Issue