forked from openwebwork/webwork2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a page to manage jobs in the job queue.
All jobs for a course are listed on this page. The table displays the job id (this is used to reference specific jobs in action messages, otherwise it would not be shown), task name, created time, started time, finished time, and state. Also a button that opens a popover containing the job result is in the state column if the job has completed. Note that the Minion job queue automatically removes jobs from the job queue after two days (that is the default at least which we don't change). So the real importance of this page is to allow the instructor to see the status of recently completed or in progress jobs. At this point the actions available on the page are filter, sort, and delete. Jobs can be filtered by id, task name, or state. Jobs can be sorted by clicking on the headers, or by using the sort form. Jobs that are not active can be deleted. Minion does not allow deletion of active jobs. Note that an active job means a job that is currently running. Also note that active jobs can not be stopped (at least not immediately). As such they can not be selected to be deleted on this page. An inactive job (i.e., a job that has been queued but has not started running yet) can be selected and deleted. However, it is possible that the inactive job could start before the form is submitted. In that case the job can not be deleted, and so an alert will show that. In order to reliably associate a course with a job there is a new rule for tasks. The job must pass the course id via the "notes" option of the Minion enqueue method. The existing tasks have been updated to do this. There is also a backwards compatibility check to find jobs that passed it one of the ways the two jobs did it before in the job arguments. Since the job fail/finish messages are now displayed in the UI, those messages are now translated. That is all except the first few messages in each task before the course environment is established, since a course environment is required to perform translations. The send_instructor_email task no longer sends an email to the instructor after sending the emails to the students. Instead the job result contains all of the information that would have been in that email. This is a far more reliable way of getting that information to the instructor sending the email. The instructor just needs to go to the "Job Manager" page to see the result. The message on the "Email" page tells the instructor this. This page is also available for the admin course. In the admin course all jobs for all courses are shown. There is an additional column in the jobs table that shows the course id for the course the job was enqueued by. The errors that are reported when sending emails are made less verbose by calling the `message` method of the Mojo::Exception which does not include the traceback.
- Loading branch information
Showing
19 changed files
with
701 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
(() => { | ||
// Show/hide the filter elements depending on if the field matching option is selected. | ||
const filter_select = document.getElementById('filter_select'); | ||
const filter_elements = document.getElementById('filter_elements'); | ||
if (filter_select && filter_elements) { | ||
const toggle_filter_elements = () => { | ||
if (filter_select.value === 'match_regex') filter_elements.style.display = 'block'; | ||
else filter_elements.style.display = 'none'; | ||
}; | ||
filter_select.addEventListener('change', toggle_filter_elements); | ||
toggle_filter_elements(); | ||
} | ||
|
||
// Submit the job list form when a sort header is clicked or enter or space is pressed when it has focus. | ||
const jobListForm = document.forms['joblist']; | ||
const currentAction = document.getElementById('current_action'); | ||
|
||
if (jobListForm && currentAction) { | ||
for (const header of document.querySelectorAll('.sort-header')) { | ||
const submitSortMethod = (e) => { | ||
e.preventDefault(); | ||
|
||
currentAction.value = 'sort'; | ||
|
||
const sortInput = document.createElement('input'); | ||
sortInput.name = 'labelSortMethod'; | ||
sortInput.value = header.dataset.sortField; | ||
sortInput.type = 'hidden'; | ||
jobListForm.append(sortInput); | ||
|
||
jobListForm.submit(); | ||
}; | ||
|
||
header.addEventListener('click', submitSortMethod); | ||
header.addEventListener('keydown', (e) => { | ||
if (e.key === ' ' || e.key === 'Enter') submitSortMethod(e); | ||
}); | ||
} | ||
} | ||
|
||
// Activate the results popovers. | ||
document.querySelectorAll('.result-popover-btn').forEach((popover) => { | ||
new bootstrap.Popover(popover, { trigger: 'hover focus', customClass: 'job-queue-result-popover', html: true }); | ||
}); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.job-queue-result-popover { | ||
--bs-popover-max-width: 500px; | ||
|
||
.popover-body { | ||
overflow-y: auto; | ||
max-height: 25vh; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.