This is an automated email from the ASF dual-hosted git repository.
dpavlov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git
The following commit(s) were added to refs/heads/master by this push:
new 263a81c Monitoring small changes to show task run time.
263a81c is described below
commit 263a81c5609aca03353cbcd465dea6afdcb885c0
Author: Dmitriy Pavlov <[email protected]>
AuthorDate: Thu Nov 29 19:37:12 2018 +0300
Monitoring small changes to show task run time.
---
.../ignite/ci/di/MonitoredTaskInterceptor.java | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/di/MonitoredTaskInterceptor.java
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/di/MonitoredTaskInterceptor.java
index c77816a..04feea0 100644
---
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/di/MonitoredTaskInterceptor.java
+++
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/di/MonitoredTaskInterceptor.java
@@ -52,7 +52,6 @@ public class MonitoredTaskInterceptor implements
MethodInterceptor {
lastStartTs.set(startTs);
lastEndTs.set(0);
- lastResult.set("(running)");
}
void saveEnd(long ts, Object res) {
@@ -68,23 +67,36 @@ public class MonitoredTaskInterceptor implements
MethodInterceptor {
return callsCnt.get();
}
+ /**
+ * @return time printable of last observed start time of the task.
+ */
public String start() {
final long l = lastStartTs.get();
return TimeUtil.timestampToDateTimePrintable(l);
}
+ /**
+ * @return time printable of last observed end time of the task.
+ */
public String end() {
- final long l = lastEndTs.get();
- return TimeUtil.timestampToDateTimePrintable(l);
+ return TimeUtil.timestampToDateTimePrintable(lastEndTs.get());
}
+ /**
+ * @return printable task result to be displayed in cell.
+ */
public String result() {
- final Object obj = lastResult.get();
+ if (lastEndTs.get() == 0) {
+ long time = System.currentTimeMillis() - lastStartTs.get();
+
+ return ("(running for " +
TimeUtil.millisToDurationPrintable(time) + ")");
+ }
- return Objects.toString(obj);
+ return Objects.toString(lastResult.get());
}
}
+ /** {@inheritDoc} */
@Override public Object invoke(MethodInvocation invocation) throws
Throwable {
final long startTs = System.currentTimeMillis();