Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -443,11 +443,17 @@ public Collection<TaskRunnerWorkItem> getPendingTasks()
@Override
public TaskLocation getTaskLocation(String taskId)
{
final KubernetesWorkItem workItem = tasks.get(taskId);
if (workItem == null) {
try {
final KubernetesWorkItem workItem = tasks.get(taskId);
if (workItem == null) {
return TaskLocation.unknown();
} else {
return workItem.getLocation();
}
}
catch (Exception e) {
log.warn("Unable to find location for task [%s]", taskId);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we are not logging the exception ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, will add it in

return TaskLocation.unknown();
} else {
return workItem.getLocation();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,24 @@ public TaskLocation getLocation()
Assert.assertEquals(TaskLocation.create("host", 0, 1, false), taskLocation);
}

@Test
public void test_getTaskLocation_throws()
{
KubernetesWorkItem workItem = new KubernetesWorkItem(task, null)
{
@Override
public TaskLocation getLocation()
{
throw new RuntimeException();
}
};

runner.tasks.put(task.getId(), workItem);

TaskLocation taskLocation = runner.getTaskLocation(task.getId());
Assert.assertEquals(TaskLocation.unknown(), taskLocation);
}

@Test
public void test_getTaskLocation_noTaskFound()
{
Expand Down