autograder .cli .courses .stats .query
Query stats for this course.
usage: python3 -m autograder.cli.courses.stats.query [-h] [--version]
[--server SERVER]
[--user USER]
[--pass PASS]
[--course COURSE]
--metric-type
{api-request,code-analysis-time,grading-time,cpu-usage,mem-usage,net-in,net-out,task-time}
[--limit LIMIT]
[--after QUERY_AFTER]
[--before QUERY_BEFORE]
[--sort QUERY_SORT]
[--where KEY=VALUE [KEY=VALUE ...]]
[--testing-mode]
Query stats for this course.
options:
-h, --help show this help message and exit
--version show program's version number and exit
command-specific options:
--server SERVER The URL of the autograder server to communicate with.
--user USER The email of the user making this request.
--pass PASS The password of the user making this request.
--course COURSE The ID of the course to make this request to.
--metric-type {api-request,code-analysis-time,grading-time,cpu-usage,mem-usage,net-in,net-out,task-time}
The type of metric to query for. See:
https://github.com/edulinq/autograder-
server/blob/main/internal/stats/metrics.go#L29
--limit LIMIT The maximum number of records to return. (default:
None)
--after QUERY_AFTER
If supplied, only return records after this timestamp.
(default: None)
--before QUERY_BEFORE
If supplied, only return records before this
timestamp. (default: None)
--sort QUERY_SORT Sort the results. -1 for ascending, 0 for no sorting,
1 for descending. (default: None)
--where KEY=VALUE [KEY=VALUE ...]
Only includes records with a patching key/value pair.
(default: None)
testing options:
--testing-mode Run as if a test is being run (default: False).
1""" 2Query stats for this course. 3""" 4 5import argparse 6import sys 7 8import edq.util.json 9 10import autograder.api.courses.stats.query 11import autograder.cli.parser 12 13def run_cli(args: argparse.Namespace) -> int: 14 """ Run the CLI. """ 15 16 config = args._config_info.application_config 17 18 result = autograder.api.courses.stats.query.send(config, exit_on_error = True) 19 print(edq.util.json.dumps(result, indent = 4)) 20 21 return 0 22 23def main() -> int: 24 """ Get a parser, parse the args, and call run. """ 25 26 return run_cli(_get_parser().parse_args()) 27 28def _get_parser() -> argparse.ArgumentParser: 29 """ Get a parser for this operation. """ 30 31 parser = autograder.cli.parser.get_parser( 32 __doc__.strip(), 33 autograder.api.courses.stats.query.API_PARAMS) 34 35 return parser 36 37if (__name__ == '__main__'): 38 sys.exit(main())
def
run_cli(args: argparse.Namespace) -> int:
14def run_cli(args: argparse.Namespace) -> int: 15 """ Run the CLI. """ 16 17 config = args._config_info.application_config 18 19 result = autograder.api.courses.stats.query.send(config, exit_on_error = True) 20 print(edq.util.json.dumps(result, indent = 4)) 21 22 return 0
Run the CLI.
def
main() -> int:
24def main() -> int: 25 """ Get a parser, parse the args, and call run. """ 26 27 return run_cli(_get_parser().parse_args())
Get a parser, parse the args, and call run.