Skip to content

Commit 2fcb23a

Browse files
authored
Rename driver description (#123848)
1 parent 7f16b3b commit 2fcb23a

File tree

12 files changed

+58
-61
lines changed

12 files changed

+58
-61
lines changed

x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/operator/Driver.java

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,10 @@ public class Driver implements Releasable, Describable {
5353
private final String sessionId;
5454

5555
/**
56-
* Description of the task this driver is running. This description should be
57-
* short and meaningful as a grouping identifier. We use the phase of the
58-
* query right now: "data", "node_reduce", "final".
56+
* Description of the driver. This description should be short and meaningful as a grouping identifier.
57+
* We use the phase of the query right now: "data", "node_reduce", "final".
5958
*/
60-
private final String taskDescription;
59+
private final String shortDescription;
6160

6261
/**
6362
* The wall clock time when this driver was created in milliseconds since epoch.
@@ -103,10 +102,8 @@ public class Driver implements Releasable, Describable {
103102
/**
104103
* Creates a new driver with a chain of operators.
105104
* @param sessionId session Id
106-
* @param taskDescription Description of the task this driver is running. This
107-
* description should be short and meaningful as a grouping
108-
* identifier. We use the phase of the query right now:
109-
* "data", "node_reduce", "final".
105+
* @param shortDescription Description of the driver. This description should be short and meaningful as a grouping identifier.
106+
* We use the phase of the query right now: "data", "node_reduce", "final".
110107
* @param driverContext the driver context
111108
* @param source source operator
112109
* @param intermediateOperators the chain of operators to execute
@@ -116,7 +113,7 @@ public class Driver implements Releasable, Describable {
116113
*/
117114
public Driver(
118115
String sessionId,
119-
String taskDescription,
116+
String shortDescription,
120117
String clusterName,
121118
String nodeName,
122119
long startTime,
@@ -130,7 +127,7 @@ public Driver(
130127
Releasable releasable
131128
) {
132129
this.sessionId = sessionId;
133-
this.taskDescription = taskDescription;
130+
this.shortDescription = shortDescription;
134131
this.startTime = startTime;
135132
this.startNanos = startNanos;
136133
this.driverContext = driverContext;
@@ -144,7 +141,7 @@ public Driver(
144141
this.status = new AtomicReference<>(
145142
new DriverStatus(
146143
sessionId,
147-
taskDescription,
144+
shortDescription,
148145
clusterName,
149146
nodeName,
150147
startTime,
@@ -485,7 +482,7 @@ public DriverProfile profile() {
485482
throw new IllegalStateException("can only get profile from finished driver");
486483
}
487484
return new DriverProfile(
488-
status.taskDescription(),
485+
status.description(),
489486
status.clusterName(),
490487
status.nodeName(),
491488
status.started(),
@@ -534,7 +531,7 @@ private void updateStatus(long extraCpuNanos, int extraIterations, DriverStatus.
534531

535532
return new DriverStatus(
536533
sessionId,
537-
taskDescription,
534+
shortDescription,
538535
prev.clusterName(),
539536
prev.nodeName(),
540537
startTime,

x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/operator/DriverProfile.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
/**
2626
* Profile results from a single {@link Driver}.
2727
*
28-
* @param taskDescription Description of the task this driver is running. This description should be short and meaningful
29-
* as a grouping identifier. We use the phase of the query right now: "data", "node_reduce", "final".
28+
* @param description Description of the driver. This description should be short and meaningful as a grouping identifier.
29+
* We use the phase of the query right now: "data", "node_reduce", "final".
3030
* @param clusterName The name of the cluster this driver is running on.
3131
* @param nodeName The name of the node this driver is running on.
3232
* @param startMillis Millis since epoch when the driver started.
@@ -37,7 +37,7 @@
3737
* @param operators Status of each {@link Operator} in the driver when it finished.
3838
*/
3939
public record DriverProfile(
40-
String taskDescription,
40+
String description,
4141
String clusterName,
4242
String nodeName,
4343
long startMillis,
@@ -69,7 +69,7 @@ public static DriverProfile readFrom(StreamInput in) throws IOException {
6969
public void writeTo(StreamOutput out) throws IOException {
7070
if (out.getTransportVersion().onOrAfter(TransportVersions.ESQL_DRIVER_TASK_DESCRIPTION)
7171
|| out.getTransportVersion().isPatchFrom(TransportVersions.ESQL_DRIVER_TASK_DESCRIPTION_90)) {
72-
out.writeString(taskDescription);
72+
out.writeString(description);
7373
}
7474
if (out.getTransportVersion().onOrAfter(TransportVersions.ESQL_DRIVER_NODE_DESCRIPTION)) {
7575
out.writeString(clusterName);
@@ -91,7 +91,7 @@ public void writeTo(StreamOutput out) throws IOException {
9191
@Override
9292
public Iterator<? extends ToXContent> toXContentChunked(ToXContent.Params params) {
9393
return Iterators.concat(ChunkedToXContentHelper.startObject(), Iterators.single((b, p) -> {
94-
b.field("task_description", taskDescription);
94+
b.field("description", description);
9595
b.field("cluster_name", clusterName);
9696
b.field("node_name", nodeName);
9797
b.timestampFieldsFromUnixEpochMillis("start_millis", "start", startMillis);

x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/operator/DriverStatus.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
* {@link Task.Status} reported from a {@link Driver} to be reported by the tasks api.
2828
*
2929
* @param sessionId The session for this driver.
30-
* @param taskDescription Description of the task this driver is running.
30+
* @param description Description of the driver.
3131
* @param clusterName The name of the cluster this driver is running on.
3232
* @param nodeName The name of the node this driver is running on.
3333
* @param started When this {@link Driver} was started.
@@ -40,7 +40,7 @@
4040
*/
4141
public record DriverStatus(
4242
String sessionId,
43-
String taskDescription,
43+
String description,
4444
String clusterName,
4545
String nodeName,
4646
long started,
@@ -84,7 +84,7 @@ public void writeTo(StreamOutput out) throws IOException {
8484
out.writeString(sessionId);
8585
if (out.getTransportVersion().onOrAfter(TransportVersions.ESQL_DRIVER_TASK_DESCRIPTION)
8686
|| out.getTransportVersion().isPatchFrom(TransportVersions.ESQL_DRIVER_TASK_DESCRIPTION_90)) {
87-
out.writeString(taskDescription);
87+
out.writeString(description);
8888
}
8989
if (out.getTransportVersion().onOrAfter(TransportVersions.ESQL_DRIVER_NODE_DESCRIPTION)) {
9090
out.writeString(clusterName);
@@ -115,7 +115,7 @@ public String getWriteableName() {
115115
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
116116
builder.startObject();
117117
builder.field("session_id", sessionId);
118-
builder.field("task_description", taskDescription);
118+
builder.field("description", description);
119119
builder.field("cluster_name", clusterName);
120120
builder.field("node_name", nodeName);
121121
builder.field("started", DateFieldMapper.DEFAULT_DATE_TIME_FORMATTER.formatMillis(started));

x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/DriverProfileTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public void testToXContent() {
4747
);
4848
assertThat(Strings.toString(status, true, true), equalTo("""
4949
{
50-
"task_description" : "test",
50+
"description" : "test",
5151
"cluster_name" : "elasticsearch",
5252
"node_name" : "node-1",
5353
"start" : "1973-11-29T09:27:00.000Z",
@@ -122,7 +122,7 @@ protected DriverProfile createTestInstance() {
122122

123123
@Override
124124
protected DriverProfile mutateInstance(DriverProfile instance) throws IOException {
125-
String taskDescription = instance.taskDescription();
125+
String shortDescription = instance.description();
126126
String clusterName = instance.clusterName();
127127
String nodeName = instance.nodeName();
128128
long startMillis = instance.startMillis();
@@ -133,7 +133,7 @@ protected DriverProfile mutateInstance(DriverProfile instance) throws IOExceptio
133133
var operators = instance.operators();
134134
var sleeps = instance.sleeps();
135135
switch (between(0, 9)) {
136-
case 0 -> taskDescription = randomValueOtherThan(taskDescription, DriverStatusTests::randomIdentifier);
136+
case 0 -> shortDescription = randomValueOtherThan(shortDescription, DriverStatusTests::randomIdentifier);
137137
case 1 -> clusterName = randomValueOtherThan(clusterName, DriverStatusTests::randomIdentifier);
138138
case 2 -> nodeName = randomValueOtherThan(nodeName, DriverStatusTests::randomIdentifier);
139139
case 3 -> startMillis = randomValueOtherThan(startMillis, ESTestCase::randomNonNegativeLong);
@@ -146,7 +146,7 @@ protected DriverProfile mutateInstance(DriverProfile instance) throws IOExceptio
146146
default -> throw new UnsupportedOperationException();
147147
}
148148
return new DriverProfile(
149-
taskDescription,
149+
shortDescription,
150150
clusterName,
151151
nodeName,
152152
startMillis,

x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/DriverStatusTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public void testToXContent() {
5252
assertThat(Strings.toString(status, true, true), equalTo("""
5353
{
5454
"session_id" : "ABC:123",
55-
"task_description" : "test",
55+
"description" : "test",
5656
"cluster_name" : "elasticsearch",
5757
"node_name" : "node-1",
5858
"started" : "1973-11-29T09:27:00.000Z",
@@ -153,7 +153,7 @@ private static OperatorStatus randomOperatorStatus() {
153153
@Override
154154
protected DriverStatus mutateInstance(DriverStatus instance) throws IOException {
155155
var sessionId = instance.sessionId();
156-
var taskDescription = instance.taskDescription();
156+
var description = instance.description();
157157
var clusterName = instance.clusterName();
158158
var nodeName = instance.nodeName();
159159
long started = instance.started();
@@ -166,7 +166,7 @@ protected DriverStatus mutateInstance(DriverStatus instance) throws IOException
166166
var sleeps = instance.sleeps();
167167
switch (between(0, 11)) {
168168
case 0 -> sessionId = randomValueOtherThan(sessionId, ESTestCase::randomIdentifier);
169-
case 1 -> taskDescription = randomValueOtherThan(taskDescription, ESTestCase::randomIdentifier);
169+
case 1 -> description = randomValueOtherThan(description, ESTestCase::randomIdentifier);
170170
case 2 -> clusterName = randomValueOtherThan(clusterName, ESTestCase::randomIdentifier);
171171
case 3 -> nodeName = randomValueOtherThan(nodeName, ESTestCase::randomIdentifier);
172172
case 4 -> started = randomValueOtherThan(started, ESTestCase::randomNonNegativeLong);
@@ -181,7 +181,7 @@ protected DriverStatus mutateInstance(DriverStatus instance) throws IOException
181181
}
182182
return new DriverStatus(
183183
sessionId,
184-
taskDescription,
184+
description,
185185
clusterName,
186186
nodeName,
187187
started,

x-pack/plugin/esql/qa/server/single-node/src/javaRestTest/java/org/elasticsearch/xpack/esql/qa/single_node/RestEsqlIT.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,8 @@ public void testProfile() throws IOException {
300300
for (Map<String, Object> o : operators) {
301301
sig.add(checkOperatorProfile(o));
302302
}
303-
String taskDescription = p.get("task_description").toString();
304-
switch (taskDescription) {
303+
String description = p.get("description").toString();
304+
switch (description) {
305305
case "data" -> assertMap(
306306
sig,
307307
matchesList().item("LuceneSourceOperator")
@@ -325,7 +325,7 @@ public void testProfile() throws IOException {
325325
.item("ProjectOperator")
326326
.item("OutputOperator")
327327
);
328-
default -> throw new IllegalArgumentException("can't match " + taskDescription);
328+
default -> throw new IllegalArgumentException("can't match " + description);
329329
}
330330
}
331331
}
@@ -400,7 +400,7 @@ public void testInlineStatsProfile() throws IOException {
400400
}
401401
signatures.add(sig);
402402
}
403-
// TODO adapt this to use task_description once this is reenabled
403+
// TODO adapt this to use description once this is re-enabled
404404
assertThat(
405405
signatures,
406406
containsInAnyOrder(
@@ -501,8 +501,8 @@ public void testForceSleepsProfile() throws IOException {
501501
MapMatcher sleepMatcher = matchesMap().entry("reason", "exchange empty")
502502
.entry("sleep_millis", greaterThan(0L))
503503
.entry("wake_millis", greaterThan(0L));
504-
String taskDescription = p.get("task_description").toString();
505-
switch (taskDescription) {
504+
String description = p.get("description").toString();
505+
switch (description) {
506506
case "data" -> assertMap(sleeps, matchesMap().entry("counts", Map.of()).entry("first", List.of()).entry("last", List.of()));
507507
case "node_reduce" -> {
508508
assertMap(sleeps, matchesMap().entry("counts", matchesMap().entry("exchange empty", greaterThan(0))).extraOk());
@@ -525,14 +525,14 @@ public void testForceSleepsProfile() throws IOException {
525525
.entry("last", List.of(sleepMatcher))
526526
);
527527
}
528-
default -> throw new IllegalArgumentException("unknown task: " + taskDescription);
528+
default -> throw new IllegalArgumentException("unknown task: " + description);
529529
}
530530
}
531531
}
532532

533533
private MapMatcher commonProfile() {
534534
return matchesMap() //
535-
.entry("task_description", any(String.class))
535+
.entry("description", any(String.class))
536536
.entry("cluster_name", any(String.class))
537537
.entry("node_name", any(String.class))
538538
.entry("start_millis", greaterThan(0L))

x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/action/CrossClusterAsyncEnrichStopIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public void testEnrichAfterStop() throws Exception {
9696
assertBusy(() -> {
9797
List<TaskInfo> tasks = getDriverTasks(client(REMOTE_CLUSTER_2));
9898
List<TaskInfo> reduceTasks = tasks.stream()
99-
.filter(t -> t.status() instanceof DriverStatus ds && ds.taskDescription().equals("remote_reduce"))
99+
.filter(t -> t.status() instanceof DriverStatus ds && ds.description().equals("remote_reduce"))
100100
.toList();
101101
assertThat(reduceTasks, not(empty()));
102102
});
@@ -108,7 +108,7 @@ public void testEnrichAfterStop() throws Exception {
108108
assertBusy(() -> {
109109
List<TaskInfo> tasks = getDriverTasks(client(REMOTE_CLUSTER_2));
110110
List<TaskInfo> reduceTasks = tasks.stream()
111-
.filter(t -> t.status() instanceof DriverStatus ds && ds.taskDescription().equals("remote_reduce"))
111+
.filter(t -> t.status() instanceof DriverStatus ds && ds.description().equals("remote_reduce"))
112112
.toList();
113113
assertThat(reduceTasks, empty());
114114
});

0 commit comments

Comments
 (0)