From 86f3c6198eb2aefcc2587d5652de3dc207c68567 Mon Sep 17 00:00:00 2001 From: sania-16 Date: Wed, 13 Nov 2024 17:27:48 +0530 Subject: [PATCH 1/4] issue #602 --- .../main/java/zingg/common/client/Client.java | 58 ++++++++++--------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/common/client/src/main/java/zingg/common/client/Client.java b/common/client/src/main/java/zingg/common/client/Client.java index 8167c81a4..1d30123ff 100644 --- a/common/client/src/main/java/zingg/common/client/Client.java +++ b/common/client/src/main/java/zingg/common/client/Client.java @@ -1,6 +1,7 @@ package zingg.common.client; import java.io.Serializable; +import java.util.*; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -32,7 +33,7 @@ public abstract class Client implements Serializable { protected S session; protected PipeUtilBase pipeUtil; public static final Log LOG = LogFactory.getLog(Client.class); - + String versionStr; protected String zFactoryClassName; @@ -56,7 +57,8 @@ public Client(IArguments args, ClientOptions options, String zFactory) throws Zi setOptions(options); try { buildAndSetArguments(args, options); - printAnalyticsBanner(arguments.getCollectMetrics()); + setProductNameAndVersion("0.4.1-SNAPSHOT"); //14 char + printBanner(arguments.getCollectMetrics()); setZingg(args, options); } catch (Exception e) { @@ -148,41 +150,38 @@ else if (args.getJobId() != -1) { setArguments(args); } - public void printBanner() { - String versionStr = "0.4.1-SNAPSHOT"; - LOG.info(""); - LOG.info("********************************************************"); - LOG.info("* Zingg AI *"); - LOG.info("* (C) 2021 Zingg.AI *"); - LOG.info("********************************************************"); - LOG.info(""); - LOG.info("using: Zingg v" + versionStr); + public void printBanner(boolean collectMetrics) { LOG.info(""); - } - - public void printAnalyticsBanner(boolean collectMetrics) { + LOG.info("**************************************************************************"); + LOG.info("* *"); + LOG.info("* Zingg AI *"); + LOG.info("* (C) 2021 Zingg Labs, Inc. *"); + LOG.info("* *"); + LOG.info("* https://www.zingg.ai/ *"); + LOG.info("* *"); + LOG.info("* using: Zingg v"+getProductNameAndVersion()+" *"); + LOG.info("* *"); if(collectMetrics) { - LOG.info(""); - LOG.info("**************************************************************************"); LOG.info("* ** Note about analytics collection by Zingg AI ** *"); LOG.info("* *"); LOG.info("* Please note that Zingg captures a few metrics about application's *"); - LOG.info("* runtime parameters. However, no user's personal data or application *"); - LOG.info("* data is captured. If you want to switch off this feature, please *"); - LOG.info("* set the flag collectMetrics to false in config. For details, please *"); - LOG.info("* refer to the Zingg docs (https://docs.zingg.ai/zingg/security) *"); + LOG.info("* runtime parameters. However, no personal data or application data *"); + LOG.info("* is captured. If you want to switch off this feature, please set the *"); + LOG.info("* flag collectMetrics to false in config. For details, please refer to *"); + LOG.info("* the Zingg docs (https://docs.zingg.ai/zingg/security). *"); + LOG.info("* *"); LOG.info("**************************************************************************"); LOG.info(""); } else { - LOG.info(""); - LOG.info("*************************************************************************************************************"); - LOG.info("* Zingg is not collecting any analytics data and will only log a blank event with the name of the phase *"); - LOG.info("*************************************************************************************************************"); + LOG.info("* Zingg is not collecting any analytics data and will only log a blank *"); + LOG.info("* event with name of the phase. *"); + LOG.info("* *"); + LOG.info("**************************************************************************"); LOG.info(""); } } - + public abstract Client getClient(IArguments args, ClientOptions options) throws ZinggClientException; public ClientOptions getClientOptions(String ... args){ @@ -190,7 +189,6 @@ public ClientOptions getClientOptions(String ... args){ } public void mainMethod(String... args) { - printBanner(); Client client = null; ClientOptions options = null; try { @@ -360,5 +358,13 @@ public void setSession(S s) { public void setPipeUtil(PipeUtilBase pipeUtil) { this.pipeUtil = pipeUtil; } + + public void setProductNameAndVersion(String versionStr){ + this.versionStr = versionStr; + } + + public String getProductNameAndVersion(){ + return versionStr; + } } \ No newline at end of file From 7050e21713b1c28f1258aa4ff97a209f72b8251f Mon Sep 17 00:00:00 2001 From: sania-16 Date: Wed, 13 Nov 2024 17:29:36 +0530 Subject: [PATCH 2/4] issue #602 --- common/client/src/main/java/zingg/common/client/Client.java | 1 - 1 file changed, 1 deletion(-) diff --git a/common/client/src/main/java/zingg/common/client/Client.java b/common/client/src/main/java/zingg/common/client/Client.java index fd958bfd6..273a3bc1c 100644 --- a/common/client/src/main/java/zingg/common/client/Client.java +++ b/common/client/src/main/java/zingg/common/client/Client.java @@ -1,7 +1,6 @@ package zingg.common.client; import java.io.Serializable; -import java.util.*; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; From 65aa7171c6cf959897e31751ff8ce756c8ee00d5 Mon Sep 17 00:00:00 2001 From: sania-16 Date: Wed, 20 Nov 2024 11:40:22 +0530 Subject: [PATCH 3/4] review changes --- .../main/java/zingg/common/client/Client.java | 17 ++++++++--------- .../client/cols/FieldDefSelectedCols.java | 1 - .../IVerifyBlockingPipeUtil.java | 3 ++- .../VerifyBlocking.java | 2 +- .../VerifyBlockingPipes.java | 2 +- .../core/executor/TestExecutorsSingle.java | 2 +- .../executor/validate/BlockerValidator.java | 4 +--- .../spark/core/executor/SparkVerifyBlocker.java | 2 +- .../core/executor/SparkVerifyBlockingPipes.java | 2 +- 9 files changed, 16 insertions(+), 19 deletions(-) rename common/core/src/main/java/zingg/common/core/executor/{verifyBlocking => blockingverifier}/IVerifyBlockingPipeUtil.java (92%) rename common/core/src/main/java/zingg/common/core/executor/{verifyBlocking => blockingverifier}/VerifyBlocking.java (98%) rename common/core/src/main/java/zingg/common/core/executor/{verifyBlocking => blockingverifier}/VerifyBlockingPipes.java (97%) diff --git a/common/client/src/main/java/zingg/common/client/Client.java b/common/client/src/main/java/zingg/common/client/Client.java index 273a3bc1c..41826ec85 100644 --- a/common/client/src/main/java/zingg/common/client/Client.java +++ b/common/client/src/main/java/zingg/common/client/Client.java @@ -56,8 +56,6 @@ public Client(IArguments args, ClientOptions options, String zFactory) throws Zi setOptions(options); try { buildAndSetArguments(args, options); - setProductNameAndVersion("0.4.1-SNAPSHOT"); //14 char - printBanner(arguments.getCollectMetrics()); setZingg(args, options); } catch (Exception e) { @@ -152,12 +150,12 @@ public void printBanner(boolean collectMetrics) { LOG.info(""); LOG.info("**************************************************************************"); LOG.info("* *"); - LOG.info("* Zingg AI *"); + LOG.info("* "+getProductName()+" *"); LOG.info("* (C) 2021 Zingg Labs, Inc. *"); LOG.info("* *"); LOG.info("* https://www.zingg.ai/ *"); LOG.info("* *"); - LOG.info("* using: Zingg v"+getProductNameAndVersion()+" *"); + LOG.info("* using: Zingg v"+getProductVersion()+" *"); LOG.info("* *"); if(collectMetrics) { LOG.info("* ** Note about analytics collection by Zingg AI ** *"); @@ -189,6 +187,7 @@ public ClientOptions getClientOptions(String ... args){ public void mainMethod(String... args) { Client client = null; ClientOptions options = null; + try { for (String a: args) LOG.debug("args " + a); @@ -210,7 +209,7 @@ else if (options.get(ClientOptions.CONF).value.endsWith("env")) { else { arguments = getArgsUtil().createArgumentsFromJSONString(options.get(ClientOptions.CONF).value, phase); } - + printBanner(arguments.getCollectMetrics()); client = getClient(arguments, options); client.init(); // after setting arguments etc. as some of the listeners need it @@ -356,12 +355,12 @@ public void setPipeUtil(PipeUtilBase pipeUtil) { this.pipeUtil = pipeUtil; } - public void setProductNameAndVersion(String versionStr){ - this.versionStr = versionStr; + public String getProductName(){ + return "Zingg AI"; } - public String getProductNameAndVersion(){ - return versionStr; + public String getProductVersion(){ + return "0.4.1-SNAPSHOT"; } } \ No newline at end of file diff --git a/common/client/src/main/java/zingg/common/client/cols/FieldDefSelectedCols.java b/common/client/src/main/java/zingg/common/client/cols/FieldDefSelectedCols.java index af5f615a0..3584c501b 100644 --- a/common/client/src/main/java/zingg/common/client/cols/FieldDefSelectedCols.java +++ b/common/client/src/main/java/zingg/common/client/cols/FieldDefSelectedCols.java @@ -4,7 +4,6 @@ import java.util.List; import zingg.common.client.FieldDefinition; -import zingg.common.client.MatchType; public class FieldDefSelectedCols extends SelectedCols { diff --git a/common/core/src/main/java/zingg/common/core/executor/verifyBlocking/IVerifyBlockingPipeUtil.java b/common/core/src/main/java/zingg/common/core/executor/blockingverifier/IVerifyBlockingPipeUtil.java similarity index 92% rename from common/core/src/main/java/zingg/common/core/executor/verifyBlocking/IVerifyBlockingPipeUtil.java rename to common/core/src/main/java/zingg/common/core/executor/blockingverifier/IVerifyBlockingPipeUtil.java index 7e2077552..faf1d6cd2 100644 --- a/common/core/src/main/java/zingg/common/core/executor/verifyBlocking/IVerifyBlockingPipeUtil.java +++ b/common/core/src/main/java/zingg/common/core/executor/blockingverifier/IVerifyBlockingPipeUtil.java @@ -1,4 +1,4 @@ -package zingg.common.core.executor.verifyblocking; +package zingg.common.core.executor.blockingverifier; import zingg.common.client.IArguments; import zingg.common.client.pipe.Pipe; @@ -23,3 +23,4 @@ public interface IVerifyBlockingPipeUtil { } + diff --git a/common/core/src/main/java/zingg/common/core/executor/verifyBlocking/VerifyBlocking.java b/common/core/src/main/java/zingg/common/core/executor/blockingverifier/VerifyBlocking.java similarity index 98% rename from common/core/src/main/java/zingg/common/core/executor/verifyBlocking/VerifyBlocking.java rename to common/core/src/main/java/zingg/common/core/executor/blockingverifier/VerifyBlocking.java index c069e6d58..adbb16fb4 100644 --- a/common/core/src/main/java/zingg/common/core/executor/verifyBlocking/VerifyBlocking.java +++ b/common/core/src/main/java/zingg/common/core/executor/blockingverifier/VerifyBlocking.java @@ -1,4 +1,4 @@ -package zingg.common.core.executor.verifyblocking; +package zingg.common.core.executor.blockingverifier; import java.util.List; diff --git a/common/core/src/main/java/zingg/common/core/executor/verifyBlocking/VerifyBlockingPipes.java b/common/core/src/main/java/zingg/common/core/executor/blockingverifier/VerifyBlockingPipes.java similarity index 97% rename from common/core/src/main/java/zingg/common/core/executor/verifyBlocking/VerifyBlockingPipes.java rename to common/core/src/main/java/zingg/common/core/executor/blockingverifier/VerifyBlockingPipes.java index a82f0c0d3..880376cb4 100644 --- a/common/core/src/main/java/zingg/common/core/executor/verifyBlocking/VerifyBlockingPipes.java +++ b/common/core/src/main/java/zingg/common/core/executor/blockingverifier/VerifyBlockingPipes.java @@ -1,4 +1,4 @@ -package zingg.common.core.executor.verifyblocking; +package zingg.common.core.executor.blockingverifier; import zingg.common.client.IArguments; import zingg.common.client.pipe.FilePipe; diff --git a/common/core/src/test/java/zingg/common/core/executor/TestExecutorsSingle.java b/common/core/src/test/java/zingg/common/core/executor/TestExecutorsSingle.java index 05f173e5d..c75e92f06 100644 --- a/common/core/src/test/java/zingg/common/core/executor/TestExecutorsSingle.java +++ b/common/core/src/test/java/zingg/common/core/executor/TestExecutorsSingle.java @@ -13,7 +13,7 @@ import zingg.common.core.executor.validate.MatcherValidator; import zingg.common.core.executor.validate.TrainerValidator; import zingg.common.core.executor.validate.TrainingDataFinderValidator; -import zingg.common.core.executor.verifyblocking.VerifyBlocking; +import zingg.common.core.executor.blockingverifier.VerifyBlocking; public abstract class TestExecutorsSingle extends TestExecutorsGeneric { diff --git a/common/core/src/test/java/zingg/common/core/executor/validate/BlockerValidator.java b/common/core/src/test/java/zingg/common/core/executor/validate/BlockerValidator.java index 60f9ffb77..0aa720a12 100644 --- a/common/core/src/test/java/zingg/common/core/executor/validate/BlockerValidator.java +++ b/common/core/src/test/java/zingg/common/core/executor/validate/BlockerValidator.java @@ -10,9 +10,7 @@ import zingg.common.client.ZFrame; import zingg.common.client.ZinggClientException; import zingg.common.client.util.ColName; -import zingg.common.core.executor.verifyblocking.IVerifyBlockingPipeUtil; -import zingg.common.core.executor.verifyblocking.VerifyBlocking; -import zingg.common.core.executor.verifyblocking.VerifyBlockingPipes; +import zingg.common.core.executor.blockingverifier.*; public class BlockerValidator extends ExecutorValidator { diff --git a/spark/core/src/main/java/zingg/spark/core/executor/SparkVerifyBlocker.java b/spark/core/src/main/java/zingg/spark/core/executor/SparkVerifyBlocker.java index 756f92692..ec0a4787b 100644 --- a/spark/core/src/main/java/zingg/spark/core/executor/SparkVerifyBlocker.java +++ b/spark/core/src/main/java/zingg/spark/core/executor/SparkVerifyBlocker.java @@ -12,7 +12,7 @@ import zingg.common.client.IArguments; import zingg.common.client.ZinggClientException; import zingg.common.client.options.ZinggOptions; -import zingg.common.core.executor.verifyblocking.VerifyBlocking; +import zingg.common.core.executor.blockingverifier.VerifyBlocking; import zingg.spark.core.context.ZinggSparkContext; public class SparkVerifyBlocker extends VerifyBlocking,Row,Column,DataType> { diff --git a/spark/core/src/main/java/zingg/spark/core/executor/SparkVerifyBlockingPipes.java b/spark/core/src/main/java/zingg/spark/core/executor/SparkVerifyBlockingPipes.java index 23a2e139e..97fe903fd 100644 --- a/spark/core/src/main/java/zingg/spark/core/executor/SparkVerifyBlockingPipes.java +++ b/spark/core/src/main/java/zingg/spark/core/executor/SparkVerifyBlockingPipes.java @@ -9,7 +9,7 @@ import zingg.common.client.pipe.FilePipe; import zingg.common.client.pipe.Pipe; import zingg.common.client.util.PipeUtilBase; -import zingg.common.core.executor.verifyblocking.VerifyBlockingPipes; +import zingg.common.core.executor.blockingverifier.VerifyBlockingPipes; public class SparkVerifyBlockingPipes extends VerifyBlockingPipes,Row,Column>{ From 9ffb418fab729420ccb7640a148377ade0966b6a Mon Sep 17 00:00:00 2001 From: sania-16 Date: Wed, 20 Nov 2024 11:42:20 +0530 Subject: [PATCH 4/4] review changes --- common/client/src/main/java/zingg/common/client/Client.java | 1 - 1 file changed, 1 deletion(-) diff --git a/common/client/src/main/java/zingg/common/client/Client.java b/common/client/src/main/java/zingg/common/client/Client.java index 41826ec85..42886fbf2 100644 --- a/common/client/src/main/java/zingg/common/client/Client.java +++ b/common/client/src/main/java/zingg/common/client/Client.java @@ -32,7 +32,6 @@ public abstract class Client implements Serializable { protected S session; protected PipeUtilBase pipeUtil; public static final Log LOG = LogFactory.getLog(Client.class); - String versionStr; protected String zFactoryClassName;