-
Notifications
You must be signed in to change notification settings - Fork 176
Client refactor #1192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Client refactor #1192
Changes from all commits
4e46675
b615f2c
d11aeee
918bfa8
ed0cccf
8aa0415
3b9550a
817b162
207f121
54af31d
33b7bc1
eea3e1b
973a021
6c2e857
6b40cf5
ec1c1cc
0c77d25
663bdf0
d483f06
389a7a8
2062597
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| package zingg.common.client; | ||
|
|
||
| import org.apache.commons.logging.Log; | ||
| import org.apache.commons.logging.LogFactory; | ||
| import zingg.common.client.arguments.model.IArguments; | ||
| import zingg.common.client.arguments.model.IZArgs; | ||
|
|
||
| public class ArgumentsAssembler { | ||
|
|
||
| public final Log LOG = LogFactory.getLog(ArgumentsAssembler.class); | ||
|
Check warning on line 10 in common/client/src/main/java/zingg/common/client/ArgumentsAssembler.java
|
||
|
|
||
| public IZArgs assemble(IZArgs args, ClientOptions options) { | ||
| int jobId = Long.valueOf(System.currentTimeMillis()).intValue();; | ||
|
Check warning on line 13 in common/client/src/main/java/zingg/common/client/ArgumentsAssembler.java
|
||
|
|
||
| if (options.get(ClientOptions.JOBID) != null) { | ||
| LOG.info("Using job id from command line"); | ||
| jobId = Integer.parseInt(options.get(ClientOptions.JOBID).getValue()); | ||
| } else if (args.getJobId() != -1) { | ||
| jobId = args.getJobId(); | ||
| } | ||
| args.setJobId(jobId); | ||
| if (options.get(ClientOptions.ZINGG_DIR) != null) { | ||
| args.setZinggDir(options.get(ClientOptions.ZINGG_DIR).getValue()); | ||
| } | ||
| if (options.get(ClientOptions.MODEL_ID) != null) { | ||
| args.setModelId(options.get(ClientOptions.MODEL_ID).getValue()); | ||
| } | ||
| if (options.get(ClientOptions.COLLECT_METRICS) != null) { | ||
| args.setCollectMetrics(Boolean.parseBoolean(options.get(ClientOptions.COLLECT_METRICS).getValue())); | ||
| } | ||
| if (options.get(ClientOptions.SHOW_CONCISE) != null && args instanceof IArguments) { | ||
| ((IArguments) args).setShowConcise(Boolean.parseBoolean(options.get(ClientOptions.SHOW_CONCISE).getValue())); | ||
| } | ||
| if (options.get(ClientOptions.COLUMN) != null && args instanceof IArguments) { | ||
| ((IArguments) args).setColumn(options.get(ClientOptions.COLUMN).getValue()); | ||
| } | ||
| return args; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| package zingg.common.client; | ||
|
|
||
| import org.apache.commons.logging.Log; | ||
| import org.apache.commons.logging.LogFactory; | ||
|
|
||
| public class BannerPrinter { | ||
|
|
||
| private static final Log LOG = LogFactory.getLog(BannerPrinter.class); | ||
|
sonalgoyal marked this conversation as resolved.
|
||
|
|
||
| public void print(boolean collectMetrics) { | ||
| String productName = getProductName(); | ||
| String version = getProductVersion(); | ||
| LOG.info(""); | ||
| LOG.info("**************************************************************************"); | ||
| LOG.info("* *"); | ||
| LOG.info("* "+productName+" *"); | ||
|
Check failure on line 16 in common/client/src/main/java/zingg/common/client/BannerPrinter.java
|
||
| LOG.info("* (C) 2021 Zingg Labs, Inc. *"); | ||
| LOG.info("* *"); | ||
| LOG.info("* https://www.zingg.ai/ *"); | ||
| LOG.info("* *"); | ||
| LOG.info("* using: Zingg v"+version+" *"); | ||
|
Check failure on line 21 in common/client/src/main/java/zingg/common/client/BannerPrinter.java
|
||
| LOG.info("* *"); | ||
| if(collectMetrics) { | ||
| 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 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("* 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(""); | ||
| } | ||
| } | ||
|
|
||
| protected String getProductName(){ return "Zingg AI"; } | ||
| protected String getProductVersion(){ return "0.6.0"; } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.