You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vk...@apache.org on 2020/12/31 05:11:12 UTC

[ignite-3] branch main updated (5b05901 -> e316b6a)

This is an automated email from the ASF dual-hosted git repository.

vkulichenko pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git.


    from 5b05901  ignite-13740: fixing formatting issues
     new fbd8740  IGNITE-13936 - Fixed node startup on Windows
     new d9a19d5  IGNITE-13939 - Fixed highlighting on Windows
     new e316b6a  IGNITE-13937 - Updated the banner so that it uses only ASCII

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/org/apache/ignite/cli/IgniteCliApp.java   | 14 ++++++-
 .../ignite/cli/builtins/node/NodeManager.java      | 44 ++++++++--------------
 .../org/apache/ignite/cli/spec/SpecAdapter.java    | 27 ++++++-------
 .../java/org/apache/ignite/app/IgniteRunner.java   | 36 +++++++++++-------
 4 files changed, 65 insertions(+), 56 deletions(-)


[ignite-3] 01/03: IGNITE-13936 - Fixed node startup on Windows

Posted by vk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

vkulichenko pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git

commit fbd8740bc3937493ea0c15c5c5154c56071a4df2
Author: Valentin Kulichenko <va...@gmail.com>
AuthorDate: Wed Dec 30 21:08:09 2020 -0800

    IGNITE-13936 - Fixed node startup on Windows
---
 .../ignite/cli/builtins/node/NodeManager.java      | 44 ++++++++--------------
 1 file changed, 16 insertions(+), 28 deletions(-)

diff --git a/modules/cli/src/main/java/org/apache/ignite/cli/builtins/node/NodeManager.java b/modules/cli/src/main/java/org/apache/ignite/cli/builtins/node/NodeManager.java
index 3a00310..9c0934d 100644
--- a/modules/cli/src/main/java/org/apache/ignite/cli/builtins/node/NodeManager.java
+++ b/modules/cli/src/main/java/org/apache/ignite/cli/builtins/node/NodeManager.java
@@ -19,18 +19,13 @@ package org.apache.ignite.cli.builtins.node;
 
 import java.io.FileWriter;
 import java.io.IOException;
-import java.nio.file.FileSystems;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.StandardWatchEventKinds;
-import java.nio.file.WatchEvent;
-import java.nio.file.WatchService;
 import java.time.Duration;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
-import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 import javax.inject.Inject;
@@ -44,7 +39,7 @@ public class NodeManager {
 
     private static final String MAIN_CLASS = "org.apache.ignite.app.IgniteRunner";
     private static final Duration NODE_START_TIMEOUT = Duration.ofSeconds(30);
-    private static final Duration LOG_FILE_POLL_INTERVAL = Duration.ofMillis(50);
+    private static final Duration LOG_FILE_POLL_INTERVAL = Duration.ofMillis(500);
 
     private final ModuleStorage moduleStorage;
 
@@ -109,34 +104,27 @@ public class NodeManager {
 
     // TODO: We need more robust way of checking if node successfully run
     private static boolean waitForStart(String started, Path file, Duration timeout) throws IOException, InterruptedException {
-       try(WatchService watchService = FileSystems.getDefault().newWatchService()) {
-           file.getParent().register(watchService, StandardWatchEventKinds.ENTRY_MODIFY);
-           var beginTime = System.currentTimeMillis();
-           while ((System.currentTimeMillis() - beginTime) < timeout.toMillis()) {
-               var key = watchService.poll(LOG_FILE_POLL_INTERVAL.toMillis(), TimeUnit.MILLISECONDS);
-               if (key != null) {
-                   for (WatchEvent<?> event : key.pollEvents()) {
-                       if (event.kind().equals(StandardWatchEventKinds.ENTRY_MODIFY) &&
-                           (((WatchEvent<Path>)event).context().getFileName()).equals(file.getFileName())) {
-                           var content = Files.readString(file);
-                           if (content.contains(started))
-                               return true;
-                           else if (content.contains("Exception"))
-                               throw new IgniteCLIException("Can't start the node. Read logs for details: " + file);
-                       }
-                   }
-                   key.reset();
-               }
-           }
-           return false;
-       }
+        var start = System.currentTimeMillis();
+
+        while ((System.currentTimeMillis() - start) < timeout.toMillis()) {
+            Thread.sleep(LOG_FILE_POLL_INTERVAL.toMillis());
+
+            var content = Files.readString(file);
+
+            if (content.contains(started))
+                return true;
+            else if (content.contains("Exception"))
+                throw new IgniteCLIException("Can't start the node. Read logs for details: " + file);
+        }
+
+        return false;
     }
 
     public String classpath() throws IOException {
         return moduleStorage.listInstalled().modules.stream()
             .flatMap(m -> m.artifacts.stream())
             .map(m -> m.toAbsolutePath().toString())
-            .collect(Collectors.joining(":"));
+            .collect(Collectors.joining(System.getProperty("path.separator")));
     }
 
     public List<String> classpathItems() throws IOException {


[ignite-3] 02/03: IGNITE-13939 - Fixed highlighting on Windows

Posted by vk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

vkulichenko pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git

commit d9a19d530f9a6f5c35af683cbe612e79a6e4c663
Author: Valentin Kulichenko <va...@gmail.com>
AuthorDate: Wed Dec 30 21:09:56 2020 -0800

    IGNITE-13939 - Fixed highlighting on Windows
---
 .../src/main/java/org/apache/ignite/cli/IgniteCliApp.java  | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/modules/cli/src/main/java/org/apache/ignite/cli/IgniteCliApp.java b/modules/cli/src/main/java/org/apache/ignite/cli/IgniteCliApp.java
index 020e97e..829139d 100644
--- a/modules/cli/src/main/java/org/apache/ignite/cli/IgniteCliApp.java
+++ b/modules/cli/src/main/java/org/apache/ignite/cli/IgniteCliApp.java
@@ -19,12 +19,24 @@ package org.apache.ignite.cli;
 
 import io.micronaut.context.ApplicationContext;
 import org.apache.ignite.cli.spec.IgniteCliSpec;
+import org.fusesource.jansi.AnsiConsole;
 
 public class IgniteCliApp {
     public static void main(String... args) {
         ApplicationContext applicationContext = ApplicationContext.run();
 
-        System.exit(IgniteCliSpec.initCli(applicationContext).execute(args));
+        int exitCode;
+
+        try {
+            AnsiConsole.systemInstall();
+
+            exitCode = IgniteCliSpec.initCli(applicationContext).execute(args);
+        }
+        finally {
+            AnsiConsole.systemUninstall();
+        }
+
+        System.exit(exitCode);
     }
 
 }


[ignite-3] 03/03: IGNITE-13937 - Updated the banner so that it uses only ASCII

Posted by vk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

vkulichenko pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git

commit e316b6a1453e7ee6ac364521538a95fadc6b70c3
Author: Valentin Kulichenko <va...@gmail.com>
AuthorDate: Wed Dec 30 21:10:37 2020 -0800

    IGNITE-13937 - Updated the banner so that it uses only ASCII
---
 .../org/apache/ignite/cli/spec/SpecAdapter.java    | 27 ++++++++--------
 .../java/org/apache/ignite/app/IgniteRunner.java   | 36 +++++++++++++---------
 2 files changed, 36 insertions(+), 27 deletions(-)

diff --git a/modules/cli/src/main/java/org/apache/ignite/cli/spec/SpecAdapter.java b/modules/cli/src/main/java/org/apache/ignite/cli/spec/SpecAdapter.java
index f0c8157..07f8f6c 100644
--- a/modules/cli/src/main/java/org/apache/ignite/cli/spec/SpecAdapter.java
+++ b/modules/cli/src/main/java/org/apache/ignite/cli/spec/SpecAdapter.java
@@ -27,18 +27,19 @@ import picocli.CommandLine.Model.CommandSpec;
 @CommandLine.Command(versionProvider = VersionProvider.class)
 public abstract class SpecAdapter implements Runnable {
     private static final String[] BANNER = new String[] {
-        "                       ___                         __",
-        "                      /   |   ____   ____ _ _____ / /_   ___",
-        "  @|red,bold       ⣠⣶⣿|@          / /| |  / __ \\ / __ `// ___// __ \\ / _ \\",
-        "  @|red,bold      ⣿⣿⣿⣿|@         / ___ | / /_/ // /_/ // /__ / / / // ___/",
-        "  @|red,bold  ⢠⣿⡏⠈⣿⣿⣿⣿⣷|@       /_/  |_|/ .___/ \\__,_/ \\___//_/ /_/ \\___/",
-        "  @|red,bold ⢰⣿⣿⣿⣧⠈⢿⣿⣿⣿⣿⣦|@            /_/",
-        "  @|red,bold ⠘⣿⣿⣿⣿⣿⣦⠈⠛⢿⣿⣿⣿⡄|@       ____               _  __           @|red,bold _____|@",
-        "  @|red,bold  ⠈⠛⣿⣿⣿⣿⣿⣿⣦⠉⢿⣿⡟|@      /  _/____ _ ____   (_)/ /_ ___     @|red,bold |__  /|@",
-        "  @|red,bold ⢰⣿⣶⣀⠈⠙⠿⣿⣿⣿⣿ ⠟⠁|@      / / / __ `// __ \\ / // __// _ \\     @|red,bold /_ <|@",
-        "  @|red,bold ⠈⠻⣿⣿⣿⣿⣷⣤⠙⢿⡟|@       _/ / / /_/ // / / // // /_ / ___/   @|red,bold ___/ /|@",
-        "  @|red,bold       ⠉⠉⠛⠏⠉|@      /___/ \\__, //_/ /_//_/ \\__/ \\___/   @|red,bold /____/|@",
-        "                        /____/\n"
+        "",
+        "  @|red,bold          #|@              ___                         __",
+        "  @|red,bold        ###|@             /   |   ____   ____ _ _____ / /_   ___",
+        "  @|red,bold    #  #####|@           / /| |  / __ \\ / __ `// ___// __ \\ / _ \\",
+        "  @|red,bold  ###  ######|@         / ___ | / /_/ // /_/ // /__ / / / // ___/",
+        "  @|red,bold #####  #######|@      /_/  |_|/ .___/ \\__,_/ \\___//_/ /_/ \\___/",
+        "  @|red,bold #######  ######|@            /_/",
+        "  @|red,bold   ########  ####|@        ____               _  __           @|red,bold _____|@",
+        "  @|red,bold  #  ########  ##|@       /  _/____ _ ____   (_)/ /_ ___     @|red,bold |__  /|@",
+        "  @|red,bold ####  #######  #|@       / / / __ `// __ \\ / // __// _ \\     @|red,bold /_ <|@",
+        "  @|red,bold  #####  #####|@        _/ / / /_/ // / / // // /_ / ___/   @|red,bold ___/ /|@",
+        "  @|red,bold    ####  ##|@         /___/ \\__, //_/ /_//_/ \\__/ \\___/   @|red,bold /____/|@",
+        "  @|red,bold      ##|@                  /____/\n"
     };
 
     @CommandLine.Spec
@@ -50,6 +51,6 @@ public abstract class SpecAdapter implements Runnable {
             .map(Ansi.AUTO::string)
             .collect(Collectors.joining("\n"));
 
-        return banner + '\n' + " ".repeat(19) + spec.version()[0] + "\n\n";
+        return '\n' + banner + '\n' + " ".repeat(22) + spec.version()[0] + "\n\n";
     }
 }
diff --git a/modules/ignite-runner/src/main/java/org/apache/ignite/app/IgniteRunner.java b/modules/ignite-runner/src/main/java/org/apache/ignite/app/IgniteRunner.java
index 061e69c..e336292 100644
--- a/modules/ignite-runner/src/main/java/org/apache/ignite/app/IgniteRunner.java
+++ b/modules/ignite-runner/src/main/java/org/apache/ignite/app/IgniteRunner.java
@@ -21,6 +21,8 @@ import java.io.FileReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.Reader;
+import java.util.Arrays;
+import java.util.stream.Collectors;
 import org.apache.ignite.configuration.ConfigurationModule;
 import org.apache.ignite.rest.RestModule;
 import org.apache.ignite.utils.IgniteProperties;
@@ -32,19 +34,21 @@ import org.slf4j.LoggerFactory;
  */
 public class IgniteRunner {
     /** */
-    private static final String BANNER = "\n" +
-        "                       ___                         __\n" +
-        "                      /   |   ____   ____ _ _____ / /_   ___\n" +
-        "        ⣠⣶⣿          / /| |  / __ \\ / __ `// ___// __ \\ / _ \\\n" +
-        "       ⣿⣿⣿⣿         / ___ | / /_/ // /_/ // /__ / / / // ___/\n" +
-        "   ⢠⣿⡏⠈⣿⣿⣿⣿⣷       /_/  |_|/ .___/ \\__,_/ \\___//_/ /_/ \\___/\n" +
-        "  ⢰⣿⣿⣿⣧⠈⢿⣿⣿⣿⣿⣦            /_/\n" +
-        "  ⠘⣿⣿⣿⣿⣿⣦⠈⠛⢿⣿⣿⣿⡄       ____               _  __           _____\n" +
-        "   ⠈⠛⣿⣿⣿⣿⣿⣿⣦⠉⢿⣿⡟      /  _/____ _ ____   (_)/ /_ ___     |__  /\n" +
-        "  ⢰⣿⣶⣀⠈⠙⠿⣿⣿⣿⣿ ⠟⠁      / / / __ `// __ \\ / // __// _ \\     /_ <\n" +
-        "  ⠈⠻⣿⣿⣿⣿⣷⣤⠙⢿⡟       _/ / / /_/ // / / // // /_ / ___/   ___/ /\n" +
-        "        ⠉⠉⠛⠏⠉      /___/ \\__, //_/ /_//_/ \\__/ \\___/   /____/\n" +
-        "                        /____/\n\n";
+    private static final String[] BANNER = new String[] {
+        "",
+        "           #              ___                         __",
+        "         ###             /   |   ____   ____ _ _____ / /_   ___",
+        "     #  #####           / /| |  / __ \\ / __ `// ___// __ \\ / _ \\",
+        "   ###  ######         / ___ | / /_/ // /_/ // /__ / / / // ___/",
+        "  #####  #######      /_/  |_|/ .___/ \\__,_/ \\___//_/ /_/ \\___/",
+        "  #######  ######            /_/",
+        "    ########  ####        ____               _  __           _____",
+        "   #  ########  ##       /  _/____ _ ____   (_)/ /_ ___     |__  /",
+        "  ####  #######  #       / / / __ `// __ \\ / // __// _ \\     /_ <",
+        "   #####  #####        _/ / / /_/ // / / // // /_ / ___/   ___/ /",
+        "     ####  ##         /___/ \\__, //_/ /_//_/ \\__/ \\___/   /____/",
+        "       ##                  /____/\n"
+    };
 
     /** */
     private static final String CONF_PARAM_NAME = "--config";
@@ -111,6 +115,10 @@ public class IgniteRunner {
     private static void ackBanner() {
         String ver = IgniteProperties.get(VER_KEY);
 
-        log.info(BANNER + "Apache Ignite ver. " + ver + "\n");
+        String banner = Arrays
+            .stream(BANNER)
+            .collect(Collectors.joining("\n"));
+
+        log.info(banner + '\n' + " ".repeat(22) + "Apache Ignite ver. " + ver + '\n');
     }
 }