diff --git a/autograder/api/admin/fetchlogs.py b/autograder/api/admin/fetchlogs.py index 7b7a2f12..33d7a49a 100644 --- a/autograder/api/admin/fetchlogs.py +++ b/autograder/api/admin/fetchlogs.py @@ -20,7 +20,7 @@ + ' (using "h", "m", or "s" suffixes) (e.g., "24h", "10m", or "1h10m10s").'), required = False), - autograder.api.config.APIParam('assignment-id', + autograder.api.config.APIParam('target-assignment', 'If supplied, only return log records for this assignment.', required = False), diff --git a/autograder/cli/admin/fetch-logs.py b/autograder/cli/admin/fetch-logs.py index 151467d6..784f6e82 100644 --- a/autograder/cli/admin/fetch-logs.py +++ b/autograder/cli/admin/fetch-logs.py @@ -37,7 +37,7 @@ def _log_record_str(record): if (record['level'] in LEVEL_TO_STRING): level = LEVEL_TO_STRING[record['level']] - timestamp = autograder.util.timestamp.get(record['unix-time'] / 1000000, pretty = True) + timestamp = autograder.util.timestamp.get(record['timestamp'], pretty = True) message = record['message'] diff --git a/tests/api/test_api.py b/tests/api/test_api.py index 38faa33e..fc8ac824 100644 --- a/tests/api/test_api.py +++ b/tests/api/test_api.py @@ -104,7 +104,7 @@ def clean_token(output): def clean_output_logs(output): record_set_values = { - 'unix-time': 0, + 'timestamp': 0, } attribute_set_values = { diff --git a/tests/api/testdata/admin_fetch_logs_base.json b/tests/api/testdata/admin_fetch_logs_base.json index d00348e2..9c64ecaa 100644 --- a/tests/api/testdata/admin_fetch_logs_base.json +++ b/tests/api/testdata/admin_fetch_logs_base.json @@ -12,7 +12,7 @@ { "level": -10, "message": "Loaded course.", - "unix-time": 0, + "timestamp": 0, "course": "course-without-source", "attributes": { "num-assignments": 0, @@ -22,7 +22,7 @@ { "level": -10, "message": "Loaded course.", - "unix-time": 0, + "timestamp": 0, "course": "course-without-source", "attributes": { "num-assignments": 0, diff --git a/tests/api/testdata/admin_fetch_logs_empty_assignment.json b/tests/api/testdata/admin_fetch_logs_empty_assignment.json index a506918f..482543b8 100644 --- a/tests/api/testdata/admin_fetch_logs_empty_assignment.json +++ b/tests/api/testdata/admin_fetch_logs_empty_assignment.json @@ -3,7 +3,7 @@ "arguments": { "course": "course101", "level": "INFO", - "assignment-id": "HW0" + "target-assignment": "HW0" }, "output-modifier": "clean_output_logs", "output": { diff --git a/tests/api/testdata/admin_fetch_logs_missing_assignment.json b/tests/api/testdata/admin_fetch_logs_missing_assignment.json deleted file mode 100644 index 28d5476f..00000000 --- a/tests/api/testdata/admin_fetch_logs_missing_assignment.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "module": "autograder.api.admin.fetchlogs", - "arguments": { - "course": "course-without-source", - "level": "DEBUG", - "assignment-id": "ZZZ" - }, - "output-modifier": "clean_output_logs", - "output": { - "success": false, - "error-messages": [ - "Unknown assignment given for 'assignment' component of log query ('ZZZ')." - ], - "results": null - } -} diff --git a/tests/api/testdata/admin_fetch_logs_time_early.json b/tests/api/testdata/admin_fetch_logs_time_early.json index ceb6bccb..2a3ecc6a 100644 --- a/tests/api/testdata/admin_fetch_logs_time_early.json +++ b/tests/api/testdata/admin_fetch_logs_time_early.json @@ -13,7 +13,7 @@ { "level": -10, "message": "Loaded course.", - "unix-time": 0, + "timestamp": 0, "course": "course-without-source", "attributes": { "num-assignments": 0, @@ -23,7 +23,7 @@ { "level": -10, "message": "Loaded course.", - "unix-time": 0, + "timestamp": 0, "course": "course-without-source", "attributes": { "num-assignments": 0, diff --git a/tests/api/testdata/courses_assignments_submissions_fetch_course_attempts_base.json b/tests/api/testdata/courses_assignments_submissions_fetch_course_attempts_base.json index 9468a27b..662ad71b 100644 --- a/tests/api/testdata/courses_assignments_submissions_fetch_course_attempts_base.json +++ b/tests/api/testdata/courses_assignments_submissions_fetch_course_attempts_base.json @@ -54,7 +54,7 @@ "submission.py": "H4sICAAAAAAA/3N1Ym1pc3Npb24ucHkASklNU0grzUsuyczPM9TQtOJSUFBQKEotKS3KUwgpKk3l4kJWYaRRlpiDqqgsMUdBW8GQCxAAAP//PpwmbkkAAAA=" }, "output-files-gzip": { - "result.json": "H4sICAAAAAAA/3Jlc3VsdC5qc29uAMyTUUvDMBDH3/0UZ17d5O6ypC6fwFdR8EGkhC2UwJpqE0EZ++6yrBZXnaP0xT4d/+N+/fODbC8AAESwtRMGxO0jitkhen1zMfkmRGHgKUf7b9tPR3d31J31m9q+ly+ND2l/T4NlXDWt+yWvXYy2ysQhr2rt2oeqjMm2qUz+8F9GlnOiOdEDsyFpFnytliylukI0iKcoLqzPMgrqGD1iNzvrgf+TB8XTPSjWxXgP9+lj4/5UgSdUDPNvKjIUfITVxtlwOcXMDSuaZkZzoRX+MJOn5+4JjWmEtDhuNKLJkjV/Ndl9BgAA///7xmbx0gMAAA==" + "result.json": "H4sICAAAAAAA/3Jlc3VsdC5qc29uAMSSvQqDMBSFd5/iNrNDDPUnPkHX0qFDKRI0SEBja1JoEd+9mIptg1YyNdPl3HPO5YN0HgAAkqzmKAW0O2Lkv6TrjSstGqlQCicjDa+bpq/cPhhj06Zm9+zSCKmHfGAtVd60fEavuVKsNI12X9myQsgyU5q1OtPC3A0iSuMtTggJKVkIcFnM2id376/Skb/ThW50oQPdQT8q/hMQLwDa+gegKQWhIK84kxtn3sSFNyLxm9dM5/ETr97BlnGhn3q99wwAAP//PProBisDAAA=" }, "stdout": "", "stderr": "" diff --git a/tests/api/testdata/courses_assignments_submissions_fetch_course_attempts_student.json b/tests/api/testdata/courses_assignments_submissions_fetch_course_attempts_student.json index f1157cb1..641edde9 100644 --- a/tests/api/testdata/courses_assignments_submissions_fetch_course_attempts_student.json +++ b/tests/api/testdata/courses_assignments_submissions_fetch_course_attempts_student.json @@ -50,7 +50,7 @@ "submission.py": "H4sICAAAAAAA/3N1Ym1pc3Npb24ucHkASklNU0grzUsuyczPM9TQtOJSUFBQKEotKS3KUwgpKk3l4kJWYaRRlpiDqqgsMUdBW8GQCxAAAP//PpwmbkkAAAA=" }, "output-files-gzip": { - "result.json": "H4sICAAAAAAA/3Jlc3VsdC5qc29uAMyTUUvDMBDH3/0UZ17d5O6ypC6fwFdR8EGkhC2UwJpqE0EZ++6yrBZXnaP0xT4d/+N+/fODbC8AAESwtRMGxO0jitkhen1zMfkmRGHgKUf7b9tPR3d31J31m9q+ly+ND2l/T4NlXDWt+yWvXYy2ysQhr2rt2oeqjMm2qUz+8F9GlnOiOdEDsyFpFnytliylukI0iKcoLqzPMgrqGD1iNzvrgf+TB8XTPSjWxXgP9+lj4/5UgSdUDPNvKjIUfITVxtlwOcXMDSuaZkZzoRX+MJOn5+4JjWmEtDhuNKLJkjV/Ndl9BgAA///7xmbx0gMAAA==" + "result.json": "H4sICAAAAAAA/3Jlc3VsdC5qc29uAMSSvQqDMBSFd5/iNrNDDPUnPkHX0qFDKRI0SEBja1JoEd+9mIptg1YyNdPl3HPO5YN0HgAAkqzmKAW0O2Lkv6TrjSstGqlQCicjDa+bpq/cPhhj06Zm9+zSCKmHfGAtVd60fEavuVKsNI12X9myQsgyU5q1OtPC3A0iSuMtTggJKVkIcFnM2id376/Skb/ThW50oQPdQT8q/hMQLwDa+gegKQWhIK84kxtn3sSFNyLxm9dM5/ETr97BlnGhn3q99wwAAP//PProBisDAAA=" }, "stdout": "", "stderr": "" diff --git a/tests/api/testdata/courses_assignments_submissions_fetch_user_attempt_other_recent.json b/tests/api/testdata/courses_assignments_submissions_fetch_user_attempt_other_recent.json index 54887f18..236b3501 100644 --- a/tests/api/testdata/courses_assignments_submissions_fetch_user_attempt_other_recent.json +++ b/tests/api/testdata/courses_assignments_submissions_fetch_user_attempt_other_recent.json @@ -51,7 +51,7 @@ "submission.py": "H4sICAAAAAAA/3N1Ym1pc3Npb24ucHkASklNU0grzUsuyczPM9TQtOJSUFBQKEotKS3KUwgpKk3l4kJWYaRRlpiDqqgsMUdBW8GQCxAAAP//PpwmbkkAAAA=" }, "output-files-gzip": { - "result.json": "H4sICAAAAAAA/3Jlc3VsdC5qc29uAMyTUUvDMBDH3/0UZ17d5O6ypC6fwFdR8EGkhC2UwJpqE0EZ++6yrBZXnaP0xT4d/+N+/fODbC8AAESwtRMGxO0jitkhen1zMfkmRGHgKUf7b9tPR3d31J31m9q+ly+ND2l/T4NlXDWt+yWvXYy2ysQhr2rt2oeqjMm2qUz+8F9GlnOiOdEDsyFpFnytliylukI0iKcoLqzPMgrqGD1iNzvrgf+TB8XTPSjWxXgP9+lj4/5UgSdUDPNvKjIUfITVxtlwOcXMDSuaZkZzoRX+MJOn5+4JjWmEtDhuNKLJkjV/Ndl9BgAA///7xmbx0gMAAA==" + "result.json": "H4sICAAAAAAA/3Jlc3VsdC5qc29uAMSSvQqDMBSFd5/iNrNDDPUnPkHX0qFDKRI0SEBja1JoEd+9mIptg1YyNdPl3HPO5YN0HgAAkqzmKAW0O2Lkv6TrjSstGqlQCicjDa+bpq/cPhhj06Zm9+zSCKmHfGAtVd60fEavuVKsNI12X9myQsgyU5q1OtPC3A0iSuMtTggJKVkIcFnM2id376/Skb/ThW50oQPdQT8q/hMQLwDa+gegKQWhIK84kxtn3sSFNyLxm9dM5/ETr97BlnGhn3q99wwAAP//PProBisDAAA=" }, "stdout": "", "stderr": "" diff --git a/tests/api/testdata/courses_assignments_submissions_fetch_user_attempt_other_specific.json b/tests/api/testdata/courses_assignments_submissions_fetch_user_attempt_other_specific.json index 252463d5..b81cf749 100644 --- a/tests/api/testdata/courses_assignments_submissions_fetch_user_attempt_other_specific.json +++ b/tests/api/testdata/courses_assignments_submissions_fetch_user_attempt_other_specific.json @@ -52,7 +52,7 @@ "submission.py": "H4sICAAAAAAA/3N1Ym1pc3Npb24ucHkASklNU0grzUsuyczPM9TQtOJSUFBQKEotKS3KUwgpKk3l4kJWYaRRlpiDqsgvv8QztyAnNTc1ryQ1hQsQAAD//6rUxttQAAAA" }, "output-files-gzip": { - "result.json": "H4sICAAAAAAA/3Jlc3VsdC5qc29uAKSTwUrDQBCG7z7FmqttmJk0MckT6EUQBQ8iYWmGsJDd1N0tKKXvLk1jpNHaJs1pmGG+/HzDbq6EECIwUnOQi+DuBYLZvvW+ZudVY1yQi9e2tfs2fXWw94jdWj/R8qNYNcr43T4Ohm7ZWP6jr9k5WbXEIa+yslSmKpyX1hde7f9LQNEccY74TJRjlC8wzLI4pvQGIAc4RmFTnmQk1DF6xHZ20gNN8gDHPTw0/l6vatZsPJfCsl9bw2V4iZ80vqVL/aQJJuP9PPnPmv9VNFRxhqIWKpQTy5qluZ5qhkIA/Ln6JDMUQgSE8MtMW711T2vMrSLKFgeJRiTBDKLvJNuvAAAA///yxSnK6gMAAA==" + "result.json": "H4sICAAAAAAA/3Jlc3VsdC5qc29uAJySzWrDMBCE736Krc6hSE5/7DxBeymUHnooxYhoMQJrlUobaAl59xI1uFTEcRWfltmZMd+iXQUAIEg7FCsQD69SLH6kjy1Gtp6iWMFbkg7fbpz+5J7VMTZunP7sNt4SH/IqW8a1D3hCdxij7lNj3tcHbSz1XWQduGOb/qvu2vb+Rja1atvbiQCSOWkf3fvFLF19EZ2cpnvy/Og2AzokRgMBeRsIzXUxdVNG3RRQv/DXgGfBc8B/gKdSsBHWA2q6KuOtpcxvfY63lkv5y5um9+Pjnr3rMjNO9KtqX30HAAD//xSSgptDAwAA" }, "stdout": "", "stderr": "" diff --git a/tests/api/testdata/courses_assignments_submissions_fetch_user_attempts_other_nonempty.json b/tests/api/testdata/courses_assignments_submissions_fetch_user_attempts_other_nonempty.json index deb00a37..e9b13154 100644 --- a/tests/api/testdata/courses_assignments_submissions_fetch_user_attempts_other_nonempty.json +++ b/tests/api/testdata/courses_assignments_submissions_fetch_user_attempts_other_nonempty.json @@ -51,7 +51,7 @@ "submission.py": "H4sICAAAAAAA/3N1Ym1pc3Npb24ucHkASklNU0grzUsuyczPM9TQtOJSUFBQKEotKS3KU/DLL/HMLchJzU3NK0lN4eJCVmukUZaYg1c5IAAA//8hrjgTWgAAAA==" }, "output-files-gzip": { - "result.json": "H4sICAAAAAAA/3Jlc3VsdC5qc29uANST0UrDMBSG732KmFu3cU6StV2eQG8EUfBCpIT1UAJtOpMMlLF3l3a1sIrO0it7dTiH/+vPBzlcMcYYd6Ymrhm/fQa+OK3e9hSibVzgmr10q/Y7DNNZ7gH72HCpzXu+a6yLbR5Hx7BtfJuDcYhCMGVHvG/iXb2rqCYXqWCe4t47Klbj/5TeFNaVeYjGxzzaUx8BQi4Rl4hPQmiUWuFKbkApdQOgAX6ikCsuMtKsZwyI4+KiH/Ef/EiJm7l+pFwn0/08xo+KflU0VvEHRR2U2cC2FRl3PcdMAgnOM6PEep3hNzPd9No/uQmNskwCnDWa0CQVKv1qcvwMAAD//9IHggUCBAAA" + "result.json": "H4sICAAAAAAA/3Jlc3VsdC5qc29uAMySwWrDMAyG73kKzecy4rRrkz7BdhmMHXYYI5haBEMsd7YKG6XvPuIlGTFsWW7NSUj/J+UDnzMAAEHKotiDuH/Jxeq79X7CwMZREHt4ja3uO4/VhHuSPTZOrPqoj84Qd7xMhuHgfMflKYQhqCZufHT8YI8tWiRGDR755An1bXqn8UobaurAynPNJv6P3FbVbpOXhVxX6Y0BQNJDXEzyYsxfVrPexdV6r+e9J/EF1s/82eKf4qngP8TjUjABDi0qulnsu13iuynufnxj9dY/+7k7ZZkEf9m/yy7ZVwAAAP//do3jyV0DAAA=" }, "stdout": "", "stderr": "" @@ -101,7 +101,7 @@ "submission.py": "H4sICAAAAAAA/3N1Ym1pc3Npb24ucHkASklNU0grzUsuyczPM9TQtOJSUFBQKEotKS3KUwgpKk3l4kJWYaRRlpiDqsgvv8QztyAnNTc1ryQ1hQsQAAD//6rUxttQAAAA" }, "output-files-gzip": { - "result.json": "H4sICAAAAAAA/3Jlc3VsdC5qc29uAKSTwUrDQBCG7z7FmqttmJk0MckT6EUQBQ8iYWmGsJDd1N0tKKXvLk1jpNHaJs1pmGG+/HzDbq6EECIwUnOQi+DuBYLZvvW+ZudVY1yQi9e2tfs2fXWw94jdWj/R8qNYNcr43T4Ohm7ZWP6jr9k5WbXEIa+yslSmKpyX1hde7f9LQNEccY74TJRjlC8wzLI4pvQGIAc4RmFTnmQk1DF6xHZ20gNN8gDHPTw0/l6vatZsPJfCsl9bw2V4iZ80vqVL/aQJJuP9PPnPmv9VNFRxhqIWKpQTy5qluZ5qhkIA/Ln6JDMUQgSE8MtMW711T2vMrSLKFgeJRiTBDKLvJNuvAAAA///yxSnK6gMAAA==" + "result.json": "H4sICAAAAAAA/3Jlc3VsdC5qc29uAJySzWrDMBCE736Krc6hSE5/7DxBeymUHnooxYhoMQJrlUobaAl59xI1uFTEcRWfltmZMd+iXQUAIEg7FCsQD69SLH6kjy1Gtp6iWMFbkg7fbpz+5J7VMTZunP7sNt4SH/IqW8a1D3hCdxij7lNj3tcHbSz1XWQduGOb/qvu2vb+Rja1atvbiQCSOWkf3fvFLF19EZ2cpnvy/Og2AzokRgMBeRsIzXUxdVNG3RRQv/DXgGfBc8B/gKdSsBHWA2q6KuOtpcxvfY63lkv5y5um9+Pjnr3rMjNO9KtqX30HAAD//xSSgptDAwAA" }, "stdout": "", "stderr": "" @@ -151,7 +151,7 @@ "submission.py": "H4sICAAAAAAA/3N1Ym1pc3Npb24ucHkASklNU0grzUsuyczPM9TQtOJSUFBQKEotKS3KUwgpKk3l4kJWYaRRlpiDqqgsMUdBW8GQCxAAAP//PpwmbkkAAAA=" }, "output-files-gzip": { - "result.json": "H4sICAAAAAAA/3Jlc3VsdC5qc29uAMyTUUvDMBDH3/0UZ17d5O6ypC6fwFdR8EGkhC2UwJpqE0EZ++6yrBZXnaP0xT4d/+N+/fODbC8AAESwtRMGxO0jitkhen1zMfkmRGHgKUf7b9tPR3d31J31m9q+ly+ND2l/T4NlXDWt+yWvXYy2ysQhr2rt2oeqjMm2qUz+8F9GlnOiOdEDsyFpFnytliylukI0iKcoLqzPMgrqGD1iNzvrgf+TB8XTPSjWxXgP9+lj4/5UgSdUDPNvKjIUfITVxtlwOcXMDSuaZkZzoRX+MJOn5+4JjWmEtDhuNKLJkjV/Ndl9BgAA///7xmbx0gMAAA==" + "result.json": "H4sICAAAAAAA/3Jlc3VsdC5qc29uAMSSvQqDMBSFd5/iNrNDDPUnPkHX0qFDKRI0SEBja1JoEd+9mIptg1YyNdPl3HPO5YN0HgAAkqzmKAW0O2Lkv6TrjSstGqlQCicjDa+bpq/cPhhj06Zm9+zSCKmHfGAtVd60fEavuVKsNI12X9myQsgyU5q1OtPC3A0iSuMtTggJKVkIcFnM2id376/Skb/ThW50oQPdQT8q/hMQLwDa+gegKQWhIK84kxtn3sSFNyLxm9dM5/ETr97BlnGhn3q99wwAAP//PProBisDAAA=" }, "stdout": "", "stderr": "" diff --git a/tests/cli/test_cli.py b/tests/cli/test_cli.py index b13bc838..2bd2e488 100644 --- a/tests/cli/test_cli.py +++ b/tests/cli/test_cli.py @@ -230,7 +230,7 @@ def json_logs_equal(test_case, expected, actual, **kwargs): for records in [expected, actual]: for record in records: - record['unix-time'] = -1 + record['timestamp'] = 0 test_case.assertListEqual(expected, actual) diff --git a/tests/cli/testdata/admin/admin_fetch_logs_base_json.txt b/tests/cli/testdata/admin/admin_fetch_logs_base_json.txt index 0182beb5..694e4369 100644 --- a/tests/cli/testdata/admin/admin_fetch_logs_base_json.txt +++ b/tests/cli/testdata/admin/admin_fetch_logs_base_json.txt @@ -12,7 +12,7 @@ { "level": -10, "message": "Loaded course.", - "unix-time": 0, + "timestamp": 0, "course": "course-without-source", "attributes": { "num-assignments": 0, @@ -22,7 +22,7 @@ { "level": -10, "message": "Loaded course.", - "unix-time": 0, + "timestamp": 0, "course": "course-without-source", "attributes": { "num-assignments": 0, diff --git a/tests/cli/testdata/admin/admin_fetch_logs_empty_assignment.txt b/tests/cli/testdata/admin/admin_fetch_logs_empty_assignment.txt index 4166f44c..3dc3a060 100644 --- a/tests/cli/testdata/admin/admin_fetch_logs_empty_assignment.txt +++ b/tests/cli/testdata/admin/admin_fetch_logs_empty_assignment.txt @@ -3,7 +3,7 @@ "output_check": "json_logs_equal", "arguments": [ "--course", "course101", - "--assignment", "HW0", + "--target-assignment", "HW0", "--level", "INFO", "--json" ] diff --git a/tests/cli/testdata/admin/admin_fetch_logs_missing_assignment.txt b/tests/cli/testdata/admin/admin_fetch_logs_missing_assignment.txt deleted file mode 100644 index 7bad8de8..00000000 --- a/tests/cli/testdata/admin/admin_fetch_logs_missing_assignment.txt +++ /dev/null @@ -1,13 +0,0 @@ -{ - "cli": "autograder.cli.admin.fetch-logs", - "arguments": [ - "--course", "course-without-source", - "--assignment", "ZZZ", - "--level", "DEBUG", - "--json" - ], - "exit-status": 1 -} ---- -Error fetching logs: - Unknown assignment given for 'assignment' component of log query ('ZZZ'). diff --git a/tests/cli/testdata/admin/admin_fetch_logs_time_early.txt b/tests/cli/testdata/admin/admin_fetch_logs_time_early.txt index a4adb10a..db658ac9 100644 --- a/tests/cli/testdata/admin/admin_fetch_logs_time_early.txt +++ b/tests/cli/testdata/admin/admin_fetch_logs_time_early.txt @@ -13,7 +13,7 @@ { "level": -10, "message": "Loaded course.", - "unix-time": 0, + "timestamp": 0, "course": "course-without-source", "attributes": { "num-assignments": 0, @@ -23,7 +23,7 @@ { "level": -10, "message": "Loaded course.", - "unix-time": 0, + "timestamp": 0, "course": "course-without-source", "attributes": { "num-assignments": 0,