Skip to content
This repository was archived by the owner on Jul 23, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion tools/bin/hawqextract
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Options:
-o output file: the output metadata file, if not set, will output to terminal.
-W: force password authentication
-v: verbose
-l: sets the directory for log files
-?: help

hawq extract output YAML file format:
Expand Down Expand Up @@ -105,7 +106,6 @@ except ImportError, e:
# setup logging
logger = get_default_logger()
EXECNAME = os.path.split(__file__)[-1]
setup_tool_logging(EXECNAME,getLocalHostname(),getUserName())

class GpExtractError(Exception): pass

Expand Down Expand Up @@ -558,13 +558,15 @@ def create_opt_parser(version):
parser.add_option('-o', '--output', help="the output metadata file, defaults to stdout", metavar='FILE')
parser.add_option('-W', action='store_true', dest='use_getpass', help="force password authentication")
parser.add_option('-v', '--verbose', action='store_true')
parser.add_option('-l', '--logdir', dest='logDir', help="Sets the directory for log files")
return parser


def main(args=None):
parser = create_opt_parser('%prog version $Revision: #1 $')

options, args = parser.parse_args(args)
setup_tool_logging(EXECNAME, getLocalHostname(), getUserName(), logdir=options.logDir)
Copy link
Member

Choose a reason for hiding this comment

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

If user doesn't give a logdir, the default value of options.logDir is?
Anyway, just make sure there is no problem.

Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@interma - setup_tool_logging defaults the value of logdir to None and handles it inside the function as seen from here. I tested it locally and it works fine.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks!

LGTM.

if len(args) != 1:
sys.stderr.write('Incorrect number of arguments: missing <tablename>.\n\n')
parser.print_help(sys.stderr)
Expand Down
6 changes: 5 additions & 1 deletion tools/doc/hawqextract_help
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Extract table's metadata into a YAML file.
SYNOPSIS
*****************************************************

hawq extract [-h hostname] [-p port] [-U username] [-d database] [-o output_file] [-W] <tablename>
hawq extract [-h hostname] [-p port] [-U username] [-d database] [-o output_file] [-W] [-l log_directory] <tablename>

hawq extract help
hawq extract -?
Expand Down Expand Up @@ -49,6 +49,10 @@ Specifies the name of a file that hawq extract will write the table's metadata t

Optional. Show verbose output of the extract steps as they are executed.

-l log_directory

Specifies the name of the directory where hawq extract log files will be stored

-? (help)

Displays the online help.
Expand Down