You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nlpcraft.apache.org by ar...@apache.org on 2021/04/24 07:10:08 UTC
[incubator-nlpcraft] branch NLPCRAFT-301 updated: Update NCCli.scala
This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch NLPCRAFT-301
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-301 by this push:
new a5fdb78 Update NCCli.scala
a5fdb78 is described below
commit a5fdb7884f3bf2ed30a7df14c4287b9abc8e838d
Author: Aaron Radzinzski <ar...@datalingvo.com>
AuthorDate: Sat Apr 24 10:09:57 2021 +0300
Update NCCli.scala
---
.../nlpcraft/model/tools/cmdline/NCCli.scala | 58 +++++++++++++++-------
1 file changed, 39 insertions(+), 19 deletions(-)
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala
index da4f8fb..94e3678 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala
@@ -799,6 +799,12 @@ object NCCli extends NCCliBase {
logProbeInfo(beacon)
+ // Reload server beacon to pick up new connected probe.
+ loadServerBeacon()
+
+ // Log all connected probes (including this one).
+ logConnectedProbes()
+
showTip()
}
}
@@ -998,7 +1004,7 @@ object NCCli extends NCCliBase {
try {
val baseUrl = "http://" + beacon.restEndpoint
- // Attempt to signin with the default account.
+ // Attempt to sign in with the default account.
if (autoSignIn && state.accessToken.isEmpty)
httpPostResponseJson(
baseUrl,
@@ -1396,7 +1402,7 @@ object NCCli extends NCCliBase {
* @return
*/
private def logServerInfo(beacon: NCCliServerBeacon): Unit = {
- var tbl = new NCAsciiTable
+ val tbl = new NCAsciiTable
val logPath = if (beacon.logPath != null) g(beacon.logPath) else y("<not available>")
@@ -1430,7 +1436,37 @@ object NCCli extends NCCliBase {
logln(s"Local server:\n${tbl.toString}")
- tbl = new NCAsciiTable()
+ logConnectedProbes()
+
+ logSignedInUser()
+ }
+
+ /**
+ *
+ */
+ private def logSignedInUser(): Unit = {
+ if (state.accessToken.isDefined) {
+ val tbl = new NCAsciiTable()
+
+ tbl += (s"${g("Email")}", state.userEmail.get)
+ tbl += (s"${g("Access token")}", state.accessToken.get)
+
+ logln(s"Signed in user account:\n$tbl")
+ }
+ }
+
+ /**
+ *
+ */
+ private def logConnectedProbes(): Unit = {
+ val tbl = new NCAsciiTable
+
+ tbl #= (
+ "Probe ID",
+ "Uptime",
+ "Host / OS",
+ "Model IDs"
+ )
def addProbeToTable(tbl: NCAsciiTable, probe: Probe): NCAsciiTable = {
tbl += (
@@ -1450,25 +1486,9 @@ object NCCli extends NCCliBase {
tbl
}
- tbl #= (
- "Probe ID",
- "Uptime",
- "Host / OS",
- "Deployed Models"
- )
-
state.probes.foreach(addProbeToTable(tbl, _))
logln(s"Connected probes (${state.probes.size}):\n${tbl.toString}")
-
- if (state.accessToken.isDefined) {
- val tbl = new NCAsciiTable()
-
- tbl += (s"${g("Email")}", state.userEmail.get)
- tbl += (s"${g("Access token")}", state.accessToken.get)
-
- logln(s"Signed in user account:\n$tbl")
- }
}
/**