[
https://issues.apache.org/jira/browse/HCATALOG-514?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13470460#comment-13470460
]
Travis Crawford commented on HCATALOG-514:
------------------------------------------
Hey [~daijy] - can you post this to review board?
A few high-level comments:
* Python has a pretty good option parsers in the standard library:
[optparse|http://docs.python.org/library/optparse.html] or
[argparse|http://docs.python.org/library/argparse.html], depending on the
version of Python you want to support. Adding an option parser debug option is
much nicer than the following for example:
{code}
# See if any debug flags have been turned on
debug = 0
try:
sys.argv.remove('-secretDebugCmd')
debug = 1
except ValueError:
pass
{code}
* The [cmd|http://docs.python.org/library/cmd.html] module is perfect for this
type of start/stop tool, like hcat_server.py is.
* {{hcat.py}} looks like it will be challenging to maintain, since its not
importable, has a strictly linear flow, etc.
* Style issues: some methods are {{python_style}}, while others are
{{javaStyle}}; we should always use {{python_style}}.
* Really long lines: let's limit to 80 characters wide. For example, instead of
this:
{code}
os.environ['HADOOP_OPTS'] += " -server -XX:+UseConcMarkSweepGC -XX:ErrorFile="
+ os.path.join(os.environ['HCAT_LOG_DIR'], 'hcat_err_pid%p.log') + " -Xloggc:"
+ os.path.join(os.environ['HCAT_LOG_DIR'], 'hcat_gc.log-') +
strftime("%Y%m%d%H%M") + " -verbose:gc -XX:+PrintGCDetails
-XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps"
{code}
we can say:
{code}
os.environ['HADOOP_OPTS'] += ' '.join(
'-server',
'-XX:+UseConcMarkSweepGC',
'-XX:ErrorFile=' + os.path.join(os.environ['HCAT_LOG_DIR'],
'hcat_err_pid%p.log'),
'-Xloggc:' + os.path.join(os.environ['HCAT_LOG_DIR'], 'hcat_gc.log-'),
'strftime("%Y%m%d%H%M")',
'-verbose:gc',
'-XX:+PrintGCDetails',
'-XX:+PrintGCTimeStamps',
'-XX:+PrintGCDateStamps')
{code}
Which I think is much easier to read.
* Can we merge {{hcatcfg.py}} into {{hcat.py}}, and refactor the latter so it
can be imported. Seems like we could keep the number of files small until we
really need to refactor out a library.
> Create hcat.py, hcat_server.py to make HCat work on Windows
> -----------------------------------------------------------
>
> Key: HCATALOG-514
> URL: https://issues.apache.org/jira/browse/HCATALOG-514
> Project: HCatalog
> Issue Type: Sub-task
> Affects Versions: 0.5
> Reporter: Daniel Dai
> Assignee: Daniel Dai
> Fix For: 0.5
>
> Attachments: HCATALOG-514-1.patch
>
>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira