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
2,035 changes: 1,029 additions & 1,006 deletions go/internal/proto/console/console.pb.go

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ message ExecuteCommandRequest {
message ExecuteCommandResponse {
string error_message = 1;
io.deephaven.proto.backplane.grpc.FieldsChangeUpdate changes = 2;

// Start timestamp for command execution, in nanoseconds since the unix epoch.
int64 start_timestamp = 3 [jstype=JS_STRING];
Copy link
Member

Choose a reason for hiding this comment

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

I'm a little sad when I see this; maybe Colin has more context, but we are still not able to use google.protobuf.Timestamp and/or google.protobuf.Duration?

Copy link
Member

Choose a reason for hiding this comment

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

Colin suggested this in a previous comment: #7145 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As per Colin's comment sticking with this jstype syntax, further discussion of protobuf types seems like a broader discussion beyond the scope of this ticket

Copy link
Member

Choose a reason for hiding this comment

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

the jstype option and using one of the built in types are sort of unrelated - but yes, we can't (yet) use other semi "built-in" types.

// End timestamp for command execution, in nanoseconds since the unix epoch.
int64 end_timestamp = 4 [jstype=JS_STRING];
}
message BindTableToVariableRequest {
io.deephaven.proto.backplane.grpc.Ticket console_id = 1;
Expand Down
250 changes: 127 additions & 123 deletions py/client/deephaven_core/proto/console_pb2.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.google.common.base.Throwables;
import com.google.rpc.Code;
import io.deephaven.base.LockFreeArrayQueue;
import io.deephaven.base.clock.Clock;
import io.deephaven.configuration.Configuration;
import io.deephaven.engine.context.ExecutionContext;
import io.deephaven.engine.context.QueryScope;
Expand Down Expand Up @@ -197,6 +198,7 @@ public void executeCommand(

// If not set, we'll use defaults, otherwise we will explicitly set the systemicness.
final ScriptSession.Changes changes;
long startTimestamp = Clock.system().currentTimeNanos();
switch (systemicOption) {
case NOT_SET_SYSTEMIC:
changes = scriptSession.evaluateScript(request.getCode());
Expand All @@ -213,6 +215,7 @@ public void executeCommand(
throw new UnsupportedOperationException(
"Unrecognized systemic option: " + systemicOption);
}
long endTimestamp = Clock.system().currentTimeNanos();
Copy link
Member

Choose a reason for hiding this comment

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

Note: if you actually only care about the duration (and not the timestamps), the difference between java.lang.System.nanoTime() would be more appropriate than the difference between Clock.system().currentTimeNanos().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Although we are ultimately interested in the duration on the UI, I think the timestamps are sufficient for us #7145 (comment)


final ExecuteCommandResponse.Builder diff = ExecuteCommandResponse.newBuilder();
final FieldsChangeUpdate.Builder fieldChanges = FieldsChangeUpdate.newBuilder();
Expand All @@ -226,7 +229,11 @@ public void executeCommand(
diff.setErrorMessage(Throwables.getStackTraceAsString(changes.error));
log.error().append("Error running script: ").append(changes.error).endl();
}
return diff.setChanges(fieldChanges).build();

return diff.setChanges(fieldChanges)
.setStartTimestamp(startTimestamp)
.setEndTimestamp(endTimestamp)
.build();
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import com.vertispan.tsdefs.annotations.TsInterface;
import com.vertispan.tsdefs.annotations.TsName;
import io.deephaven.web.client.api.DateWrapper;
import jsinterop.annotations.JsProperty;

/**
Expand All @@ -15,10 +16,14 @@
public class JsCommandResult {
private final JsVariableChanges changes;
private final String error;
private final String startTimestamp;
private final String endTimestamp;

public JsCommandResult(JsVariableChanges changes, String error) {
public JsCommandResult(JsVariableChanges changes, String error, String startTimestamp, String endTimestamp) {
this.changes = changes;
this.error = error;
this.startTimestamp = startTimestamp;
this.endTimestamp = endTimestamp;
}

/**
Expand All @@ -41,6 +46,26 @@ public String getError() {
return error;
}

/**
* The timestamp when the command started running.
*
* @return DateWrapper
*/
@JsProperty
public DateWrapper getStartTimestamp() {
return DateWrapper.of(Long.parseLong(startTimestamp));
}

/**
* The timestamp when the command finished running.
*
* @return DateWrapper
*/
@JsProperty
public DateWrapper getEndTimestamp() {
return DateWrapper.of(Long.parseLong(endTimestamp));
}

@Override
public String toString() {
if (error != null && !error.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,12 @@ public CancellablePromise<JsCommandResult> runCode(String code) {
});
runCodePromise.then(response -> {
JsVariableChanges changes = JsVariableChanges.from(response.getChanges());
final String startTimestamp = response.getStartTimestamp();
final String endTimestamp = response.getEndTimestamp();
if (response.getErrorMessage() == null || response.getErrorMessage().isEmpty()) {
promise.succeed(new JsCommandResult(changes, null));
promise.succeed(new JsCommandResult(changes, null, startTimestamp, endTimestamp));
} else {
promise.succeed(new JsCommandResult(changes, response.getErrorMessage()));
promise.succeed(new JsCommandResult(changes, response.getErrorMessage(), startTimestamp, endTimestamp));
}
return null;
}, err -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,10 @@ public static native ExecuteCommandResponse.ToObjectReturnType toObject(

public native void setErrorMessage(String value);

public native String getStartTimestamp();

public native String getEndTimestamp();

public native ExecuteCommandResponse.ToObjectReturnType0 toObject();

public native ExecuteCommandResponse.ToObjectReturnType0 toObject(boolean includeInstance);
Expand Down