feat(admin): curator job run report and run log download#801
feat(admin): curator job run report and run log download#801TahaKhan998 wants to merge 1 commit into
Conversation
9de61f4 to
280f3d1
Compare
fa180d4 to
7d750c2
Compare
7d750c2 to
e21c17e
Compare
| @curators_permission.require(http_exception=403) | ||
| def harvester_run_report(run_id): | ||
| ctx, err = ext.harvester_download_resource.report_template_context(str(run_id)) | ||
| if err: |
There was a problem hiding this comment.
to handle errors in more "flask" way please check .register_errror_handler of blueprint (there should be already examples in the code). Can it be applied here?
| return format_datetime(dt, "yyyy-MM-dd HH:mm") | ||
|
|
||
|
|
||
| class HarvesterDownloadResource(Resource): |
There was a problem hiding this comment.
This class needs a little bit untangling as well - you are using the Resource class base, which suggests you will be operating on the resource level (REST API) which you are doing when calling GET download.
However, you are using the same class to build context for UI view (not REST endpoint), which you then assign to a UI blueprint. These approaches have to be disentangled - we separate REST and UI views. Please analyse how invenio-pages module views are written (mainly REST API views, used to be mix of UI and REST) and how invenio-administration is done (mostly UI views). You can also check invenio-app-ils or cds-ils for more low level examples of UI and REST views implementation.
After applying a similar approach to those modules, the code will improve in terms of readability.
Closes #789
when an inspire harvester job finishes we email people. that email again has a “harvester actions” section with two links: one to grab a text log for that run (“download error log”) and one to open harvester reports filtered to that run (“view list of changes”)
removed the old “view full details” button from that email — it pointed at the system jobs admin page and a lot of people on the mailing list don’t have access, so it was confusing
new page: /administration/harvester-reports/<run_id>/report (curators only). shows the same kind of run summary + log lines as the admin job ui, with colours by level so it’s easier to read than raw text
the existing download endpoint still returns a .log file; both that file and the html page use the real invenio jobs log search for the run, not a random audit log export