Skip to content
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

HPCC-18038 Remove the version option from the publish and java command #10316

Merged
merged 1 commit into from Aug 14, 2017

Conversation

mayx
Copy link
Member

@mayx mayx commented Jul 31, 2017

  • Remove the --version option from the usage message
  • Don't pass in any version info when loading dependencies,
    pass in 0 instead.
  • Don't validate version command option
  • Replace --version with --build for printing out build info
  • Remove the --version option from the batch file for ECL IDE

Signed-off-by: mayx yanrui.ma@lexisnexisrisk.com

Type of change:

  • This change is a bug fix (non-breaking change which fixes an issue).
  • This change is a new feature (non-breaking change which adds functionality).
  • This change improves the code (refactor or other change that does not change the functionality)
  • This change fixes warnings (the fix does not alter the functionality or the generated code)
  • This change is a breaking change (fix or feature that will cause existing behavior to change).
  • This change alters the query API (existing queries will have to be recompiled)

Checklist:

  • My code follows the code style of this project.
    • My code does not create any new warnings from compiler, build system, or lint.
  • The commit message is properly formatted and free of typos.
    • The commit message title makes sense in a changelog, by itself.
    • The commit is signed.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly, or...
    • I have created a JIRA ticket to update the documentation.
    • Any new interfaces or exported functions are appropriately commented.
  • I have read the CONTRIBUTORS document.
  • The change has been fully tested:
    • I have added tests to cover my changes.
    • All new and existing tests passed.
    • I have checked that this change does not introduce memory leaks.
    • I have used Valgrind or similar tools to check for potential issues.
  • I have given due consideration to all of the following potential concerns:
    • Scalability
    • Performance
    • Security
    • Thread-safety
    • Premature optimization
    • Existing deployed queries will not be broken
    • This change fixes the problem, not just the symptom
    • The target branch of this pull request is appropriate for such a change.
  • There are no similar instances of the same problem that should be addressed
    • I have addressed them here
    • I have raised JIRA issues to address them separately
  • This is a user interface / front-end modification
    • I have tested my changes in multiple modern browsers
    • The component(s) render as expected

Testing:

@hpcc-jirabot
Copy link

@mayx
Copy link
Member Author

mayx commented Jul 31, 2017

@rpastrana @afishbeck Please review when you have a chance.

@@ -180,7 +180,7 @@ bool EsdlCMDShell::parseCommandLineOptions(ArgvIterator &iter)
void EsdlCMDShell::usage()
{
fprintf(stdout,"\nUsage:\n"
" esdl [--version] <command> [<args>]\n\n"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should provide usage for the new "build" command, but also consider keeping this version command to remain consistent across various HPCC command line tools (ecl, eclcc, etc).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did add usage for --build in the common command usage. What I'm trying to do is to avoid overloading the meaning of --version, as although we're removing it from publish and java, it's still being used for specifying esdl version in xsd and wsdl commands.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could change the xsd and wsdl to use --ver_ (which nicely corresponds to the url parameter name to specify service version), and restore --version solely to printout build info. Do you guys like that better?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense, maybe the tool version command remains --version and the interface version gets an explicit name --interfaceversion or some shorter derivation of it?

Copy link
Member

@afishbeck afishbeck Jul 31, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed that we should use --version the way other commands do (like ecl.exe) rather than --build.

Where we do want interface version specified, the long intuitive name should be something like "--interface-version".. for people who haven't memorized the short easy name, something like "-iv", or if you guys have a better idea for the short name I'm open.

"--" should always be a long form very intuitive and explicit name. So not --ver_. Single "-" should be a short name, often an abbreviation or single letter. But again I think -ver_ is a bit too awkward.

Copy link
Member Author

@mayx mayx Jul 31, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds reasonable, I'll replace --version with --interface-version and -iv, then replace --build with --version.

@mayx mayx force-pushed the HPCC-17859 branch 2 times, most recently from 5b09435 to c427fe7 Compare August 1, 2017 20:54
@mayx
Copy link
Member Author

mayx commented Aug 1, 2017

Changes made as suggested. @rpastrana @afishbeck please review again.

Copy link
Member

@rpastrana rpastrana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mayx A couple of concerns, I might have clouded the issue with my attempt to explain my concerns... don't hesitate to contact me directly if my explanation doesn't make sense.

@@ -79,7 +79,6 @@ class EsdlPublishCmdCommon : public EsdlCmdCommon
" --port <port> WsESDLConfig service port\n"
" -u, --username <name> Username for accessing WsESDLConfig service\n"
" -pw, --password <pw> Password for accessing WsESDLConfig service\n"
" --version <ver> ESDL service version\n"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to keep this line in the base class usage (and update it to "--interface-version, ESDL interface version\n") since all extensions of this class support should support --version (now --interface-version)
If publish command won't acknowledge this argument, then that class needs to override this usage.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually the --version (now --interface-version) is not being used by other publish commands. A couple of other commands takes a "definition version/sequence#" as parameter but that is specified on the command line directly, not with --version (now --interface-version) option. I don't think any of the publish commands need or should specify the interface version.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh.. ok so then StringAttr optVersionStr; and double optVersion; are actually being used as "esdl_definition_version"?? maybe we refactor them to esdl_def_ver?

@@ -94,8 +93,6 @@ class EsdlPublishCmdCommon : public EsdlCmdCommon
return true;
if (iter.matchFlag(optWSProcPort, ESDL_OPTION_SERVICE_PORT) || iter.matchFlag(optWSProcPort, ESDL_OPT_SERVICE_PORT))
return true;
if (iter.matchFlag(optVersionStr, ESDLOPT_VERSION))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This if needs to stay, and check for ESDLOPT_INTERFACE_VERSION || ESDLOPT_IV... we might also want to refactor optVersionStr and optVersion to reflect their actual purpose which is to hold the InterfaceVersion value as declared by the user.

--UPDATE-- looking through the code, I just realized that this member var is also used to hold the ESDL definition version for EsdlDeleteESDLDefCmd; EsdlBindMethodCmd. I don't like overloading variables, so we can either declare a new member var for those classes to hold the ESDL definition version, or live with the way things are, but then we can't refactor optVersionStr and optVersion as suggested above

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this is another thing I was thinking to change, but thought it would tie better with another improvement subtask I may make. But maybe changing the variable name now will make it more clear, let me check...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, while we're at it...
It seems the usage at the top level might be off:
esdlcmd_shell.cpp:
esdl [--version] []\n\n"
should change to
esdl []\n\n"
and --version should be listed as a command

@JamesDeFabia this change might require a doc change (I think an issue is already open, but wanted to point this out)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may also refactor the variable name for the definition sequence. What better describes this variable, "definitionVersion" or "defintionSequence", @rpastrana @afishbeck ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both are appropriate, sequence might be more accurate, but I think we refer to that number as the definition version in other places. I vote definitionVersion

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with moving --version as a command.

@mayx
Copy link
Member Author

mayx commented Aug 2, 2017

Did the variable name refactoring, also added a separate line for --version usage. @rpastrana @afishbeck please review again.

@@ -615,7 +599,7 @@ class EsdlDeleteESDLDefCmd : public EsdlPublishCmdCommon
optESDLService.set(arg);
break;
case 1:
optVersionStr.set(arg);
optDefinitionVersionStr.set(arg);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems inconsistent to me that when we bind a service we use a definition ID of the format "MyDefinition.3", but here we use a separate ESDLService and Version "MyDefinition 3".

I prefer the ID type usage... which is how roxie queries work... "myquery.5".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Especially when it looks like we turn it into an ID before sending it to ESP.

If we make that change we may not need the variable anymore, but I also wonder if the name "PublishedVersion" is more descriptive... meaning the particular version of the ESDLService that was published for "myserv.3"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, my original implementation introduced this inconsistency. Changing things now will break users, but we might have to tear off the band-aid quickly and move on.
If we make the change, we could make the fix backward compatible, but I'm not sure if that would be worth the effort.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry missed this string of comments. I was thinking to deal with this inconsistency in a separate issue, but since we're already here and touched on the code already, I may just do it now.

@@ -62,6 +62,8 @@ typedef IEsdlCommand *(*EsdlCommandFactory)(const char *cmdname);
#define ESDLOPT_XSLT_PATH "--xslt"

#define ESDLOPT_VERSION "--version"
#define ESDLOPT_INTERFACE_VERSION "--interface-version"
#define ESDLOPT_IV "-iv"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"-iv" is considered an abbreviated or short form of "--interface-version" so there is a naming convention to just add an "_S". Making it #define ESDLOPT_INTERFACE_VERSION_S "-iv"

Like this example:

#define ECLOPT_INPUT "--input"
#define ECLOPT_INPUT_S "-in"

Copy link
Member

@afishbeck afishbeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments

@mayx
Copy link
Member Author

mayx commented Aug 3, 2017

Changed ESDLOPT_IV to ESDLOPT_INTERFACE_VERSION_S, please review again. There're a few other existing options that don't follow this convention, but I think it would be better to address them in a separate refactoring issue.

- For publish and java commands, remove the version option and don't
  pass in version when loading dependencies
- Don't validate version command option for publish and java
- Remove the --version option from the batch file for ECL IDE
- Remove the --version from ReadMeFirst.txt help file
- Refactor the variable name optVersion to optInterfaceVersion for
  xsd and wsdl commands
- Change defintion version to definition id for commands delete and
  bind-method.

Signed-off-by: mayx <yanrui.ma@lexisnexisrisk.com>
@mayx
Copy link
Member Author

mayx commented Aug 7, 2017

Removed optDefinitionVersion variable, changed definition version to definition id for commands delete and bind-method. @afishbeck @rpastrana please review again.

@HPCCSmoketest
Copy link
Contributor

Automated Smoketest: ✅
Sha: 7a0d3de
Build: success
Build: success
ECL Watch: Rebuilding Site

errors warnings build time
0 65 91.65 seconds

Install hpccsystems-platform-community_6.4.1-closedown0.el7.x86_64.rpm
HPCC Start: OK

Unit tests result:

Test total passed failed errors timeout
unittest 95 95 0 0 0
wutoolTest(Dali) 19 19 0 0 0
wutoolTest(Cassandra) 19 19 0 0 0

Regression test result:

phase total pass fail
setup (hthor) 11 11 0
setup (thor) 11 11 0
setup (roxie) 11 11 0
test (hthor) 733 733 0
test (thor) 627 627 0
test (roxie) 760 760 0

HPCC Stop: OK
HPCC Uninstall: OK

@@ -863,7 +826,7 @@ class EsdlBindMethodCmd : public EsdlBindServiceCmd
printf( "\n Use this command to publish ESDL Service based bindings.\n"
" To bind a ESDL Service, provide the target ESP process name\n"
" (esp which will host the service.) \n"
" It is also necessary to provide the Port on which this service is configured to run (ESP Binding),\n"
" It is also necessary to provide the target ESP binding name,\n"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does just specifying the port not work? I think using port is much more intuitive than ESP binding name... which is usually a confusing unique id. If it doesn't work, please open a JIRA to add it (to any command line that currently requires ESP binding name). If it does work the help should still say so (in fact it should be considered the preferred way.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mayx @rpastrana Btw, in the future when this is fully dynamic the port will still make sense, but the ESP binding name will no longer make sense.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this command (bind-method), it doesn't take port as a parameter. I've created an issue for it: https://track.hpccsystems.com/browse/HPCC-18126

Copy link
Member

@afishbeck afishbeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mayx some comments

Copy link
Member

@afishbeck afishbeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mayx looks good

" ESDLServiceDefinitionName The name of the ESDL service definition to delete\n"
" ESDLServiceDefinitionVersion The version of the ESDL service definition to delete\n");
"esdl delete <ESDLDefinitionID> [command options]\n\n"
" ESDLDefinitionID The ESDL definition id <esdldefname>.<esdldefver>\n");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JamesDeFabia note this change. It needs to be documented

"Commonly used commands:\n"
" xml Generate XML from ESDL definition.\n"
" ecl Generate ECL from ESDL definition.\n"
" xsd Generate XSD from ESDL definition.\n"
" wsdl Generate WSDL from ESDL definition.\n"
" publish Publish ESDL Definition for ESP use.\n"
" list-definitions List all ESDL definitions.\n"
" get-definition Get ESDL definition.\n"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this part of a different change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rpastrana get-definition command is already there, it was only missing from the usage.

Copy link
Member

@rpastrana rpastrana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mayx looks good. I do have a question about the new command "get-definition"

Copy link
Member

@rpastrana rpastrana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mayx looks good.

@richardkchapman richardkchapman merged commit 419fbb5 into hpcc-systems:candidate-6.4.2 Aug 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants