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

019 minor fixes #292

Merged
merged 33 commits into from
Apr 14, 2020
Merged

019 minor fixes #292

merged 33 commits into from
Apr 14, 2020

Conversation

Evildoor
Copy link
Contributor

@Evildoor Evildoor commented Oct 28, 2019

Fix various minor problems with the stage.

  • Add/improve help messages and options to use them properly.
  • Add message when a default config is used.
  • Add comments describing script logic to esFormat.php.
  • Fix errors discovered during work on the PR (eb7759a, ae23121).
  • Correct typos, lack of numeration in README, and other minor readability issues.

https://trello.com/c/ZUvvKjKC
https://trello.com/c/wjTOlVWt

@Evildoor Evildoor self-assigned this Oct 28, 2019
@Evildoor Evildoor changed the title [WIP] 019 minor fixes 019 minor fixes Nov 21, 2019
Copy link
Collaborator

@mgolosova mgolosova left a comment

Choose a reason for hiding this comment

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

All comments are below, but this one just is not related to any specific piece of code: since this PR adds descriptions to almost all of the PHP functions, would be nice to have one for getAction() as well.

Most of the comments are just suggestions: current version of the PR already makes things better than they were so it makes sence to merge it even as it is right now. So please let me know if you would prefer to leave it as it is or will make some changes.

Thank you for bringing some order to the Chaos! :)

Utils/Dataflow/019_esFormat/esFormat.php Outdated Show resolved Hide resolved
Utils/Dataflow/019_esFormat/esFormat.php Outdated Show resolved Hide resolved
Utils/Dataflow/019_esFormat/esFormat.php Outdated Show resolved Hide resolved
Utils/Dataflow/019_esFormat/esFormat.php Outdated Show resolved Hide resolved
Utils/Dataflow/019_esFormat/run.sh Outdated Show resolved Hide resolved
Utils/Dataflow/019_esFormat/run.sh Outdated Show resolved Hide resolved
Utils/Dataflow/019_esFormat/run.sh Outdated Show resolved Hide resolved
@Evildoor Evildoor force-pushed the 019-minor-fixes branch 2 times, most recently from 9e9a2dc to 7b16c01 Compare December 27, 2019 13:52
@Evildoor
Copy link
Contributor Author

Evildoor commented Dec 27, 2019

would be nice to have description for getAction() as well

Done.

Copy link
Collaborator

@mgolosova mgolosova left a comment

Choose a reason for hiding this comment

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

Few more comments/suggestions.

Utils/Dataflow/019_esFormat/esFormat.php Outdated Show resolved Hide resolved
Utils/Dataflow/019_esFormat/esFormat.php Outdated Show resolved Hide resolved
Utils/Dataflow/019_esFormat/run.sh Show resolved Hide resolved
Utils/Dataflow/019_esFormat/run.sh Outdated Show resolved Hide resolved
@mgolosova
Copy link
Collaborator

@Evildoor
Copy link
Contributor Author

Evildoor commented Mar 23, 2020

Rebased the branch on master to remove the commit that have already been merged separately (#322).

Copy link
Collaborator

@mgolosova mgolosova left a comment

Choose a reason for hiding this comment

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

I am sorry I missed a couple of things during previous review.
I am asking you to change the following things:

  • return value of run.sh when --help option is used;
  • fix description of constructDataJson() (the part related to the "doc_as_upsert");
  • mark -- as required delimiter between arguments of run.sh and esFormat.php.

And, optionally -- add the link to the ES documentation to the constructActionJson function's description.

Utils/Dataflow/019_esFormat/run.sh Outdated Show resolved Hide resolved
Utils/Dataflow/019_esFormat/esFormat.php Show resolved Hide resolved
Utils/Dataflow/019_esFormat/esFormat.php Outdated Show resolved Hide resolved
Utils/Dataflow/019_esFormat/run.sh Outdated Show resolved Hide resolved
Utils/Dataflow/019_esFormat/run.sh Outdated Show resolved Hide resolved
- Separate the definitions into default values (constants) and variables.
- Add descriptions.
Exit shouldn't depend on usage()'s return value.
run.sh is a wrapper around PHP script and even uses it to explain
the meaning of run.sh's ARGS.
Bring the style closer to that of pyDKB/dataflow/stage/AbstractStage.py.
Having whole message on the same level of indent makes it easier to read
and edit.
Details about passing arguments to esFormat.php and getting help for it
are unnecessary when the script is called from run.sh.
- Reword the description: 'Elasticsearch config' can be understood in
  different ways.
- Display the default value of the config.
- Move the definition of two variables before the usage(): previous point
  requires one of them.
It is not really important whether a document will be processed alone or
in bulk.
The variable's value gets overwritten later in code, so it shouldn't
be initialized here to avoid confusion.
It is not changed through the script, so it's actually a 'constant'.
To avoid confusion with DEFAULT_ACTION being changed during the script
execution, a new variable is added, while DEFAULT_ACTION's value remains
constant and is used, if necessary, to define the new variable.
Remove the lengthy comment about DEFAULT_ACTION as it is no longer necessary.
This separator is used in many bash commands - while its role may be
obvious to some, others may be unaware of it.
Copy link
Collaborator

@mgolosova mgolosova left a comment

Choose a reason for hiding this comment

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

That's the last change request here, this time's (almost) for sure.

Commit message of the fe29851 ilooks very confusing: 0 is rarely referred to as a error status, so when I see error status 0 I stumble for a moment and not sure what to think about. Exit status, satus code, exit code, return code, maybe exit value or something?

If you don't mind, please change this commit message -- and let me know what's your decision concerning the getAction() description.

Comment on lines 98 to 99
Action is 'update' if {'_update': true} key-value pair is
present in the document. Otherwise, default value is returned.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm afraid that after 67a80d8 (#320) this description is incomplete.
I can merge this PR to immediately fix it in the next one, or you can merge master here and update the description accordingly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, 3a078d4.

Evildoor and others added 5 commits April 13, 2020 17:29
Non-zero exit status usually signals that some kind of error occured.

Co-Authored-By: Marina Golosova <golosova.marina@gmail.com>
-- is supposed to separate arguments for run.sh and PHP script.
The fact that everything works without it is, actually, a bug
that would be dealt with later.
@Evildoor
Copy link
Contributor Author

Comment about "error status" is valid, I probably made a mistake while typing. Fixed.

@mgolosova mgolosova merged commit b3e551d into master Apr 14, 2020
@mgolosova
Copy link
Collaborator

@Evildoor, thank you!
Approved and merged now. If you do not need this branch for the further work, please remove it.

@Evildoor Evildoor deleted the 019-minor-fixes branch April 14, 2020 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants