Skip to content

Commit

Permalink
Merge pull request #37 from mindprince/reports-api-all-commands
Browse files Browse the repository at this point in the history
Add support for all_commands report.
  • Loading branch information
rohitagarwal003 committed Apr 25, 2014
2 parents b97e3cb + 835cbc5 commit c4ca598
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions qds_sdk/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,31 @@ def parsers():
default = frequency""")
chc.set_defaults(func=ReportCmdLine.canonical_hive_commands)


# All Commands Report
ac = subparsers.add_parser("all_commands",
description="Show report for all commands")
ac.add_argument("--start-date", default=argparse.SUPPRESS,
help="""The date from which you want the report (inclusive)
api default = 7 days before the end date.""")
ac.add_argument("--end-date", default=argparse.SUPPRESS,
help="""The date till which you want the report (exclusive)
api default = today""")
ac.add_argument("--offset", type=int, default=argparse.SUPPRESS,
help="""The starting point of the results. api default = 0""")
ac.add_argument("--limit", type=int, default=argparse.SUPPRESS,
help="""The number of results to fetch. api default = 10""")
ac.add_argument("--sort", dest="sort_column",
default=argparse.SUPPRESS, choices=["cpu", "fs_bytes_read",
"fs_bytes_written", "time"], help="""The column used to sort the
report. api default = time (chronological order)""")
ac.add_argument("--by-user", default=argparse.SUPPRESS,
action="store_true", help="""Report only those queries which
are created by the current user. By default, all queries from
the current account are reported.""")
ac.set_defaults(func=ReportCmdLine.all_commands)


# Foo Bar Report
#fb = subparsers.add_parser("foo_bar",
# description="Show report for foo bar")
Expand Down Expand Up @@ -89,6 +114,13 @@ def canonical_hive_commands(args):
result = Report.show("canonical_hive_commands", data)
return json.dumps(result, indent=4)

@staticmethod
def all_commands(args):
data = vars(args)
data.pop("func") # We don't want to send this to the api
result = Report.show("all_commands", data)
return json.dumps(result, indent=4)

#@staticmethod
#def foo_bar(args):
# data = vars(args)
Expand Down

0 comments on commit c4ca598

Please sign in to comment.