Closed JasonCTang closed 1 year ago
student_assessment
records are created. Triggering a workflow will be a responsibility of a new scheduler.student_assessment
records will be associated with the application's current assessment alongside its creation, which means that the current assessment will always point to the most recent assessment record.student_assessment
records can be created and all will be executed in the creation order. student_assessment
records for the same application should be executed in order, but different applications for the same students can be executed in parallel.start-application-assessment
cancel-application-assessment
student_assessment
table to allow its control by the schedulers.
sims.applications.application_status_updated_on
to track the date that the status was updated (e.g. student_assessment_status_updated_on
).current_processing_assessment_id
to the sims.applications
to be updated by the scheduler. Every time that a record is queued for execution this new column will also be updated.Created
: when the student_assessment is created.
Queued
: when the student_assessment is queued to be executed on Camunda. Change the status to Queued
and call the queue after, in this way, if the Camunda call fails it will retry later because the status is already set.
Assessment workflow execution
.In progress
: when the workflow id is associated with the student_assessment.
associate-workflow-instance-task
).Completed
: at the end by a dedicated worker.
Cancellation requested
: when a workflow needs to be canceled, for instance, when the student cancels the application or the "Bulk offering update" happens and the application is in progress. The student_assessment can have the status updated to Cancellation requested
to be selected by the specific queue and then have its status finally updated to Cancelled
.
Cancellation queued
: create a new item in the queue cancel-application-assessment
. This queue should also be changed to update the student_assessment
to Cancelled
.
Assessment workflow execution
.Cancelled
: when the workflow is canceled or a call to Camunda to cancel the workflow returns a "Not found".
cancel-application-assessment
.For a single workflow execution, the assessments will progress as shown below.
The student_assessment record is saved to the database with the default Created
status.
The record with Created
status:
assessment-workflow-execution-queue
scheduler.Queued
.current_processing_assessment_id
column.start-application-assessment
queue.associate-workflow-instance
worker, besides setting the workflow_id in DB (already happening), also sets the workflow status to In progress
.During this stage, alongside the associate-workflow-instance
execution, if another workflow was already set to process the student_assessment
, use the job.cancelWorkflow();
to terminate its execution.
A new workflow worker is created at the end of the workflow to have the student_assessment
record changed to completed.
On the occasion when more than one student_assessment
record is created, a scheduler will coordinate their ordered execution.
At any given time, assessments for one particular application can have 0 to 1 "Queued" records and 1 to n created records waiting to be processed.
Every time that a student_assessment
record is queued its id is also set in the application's current_processing_assessment_id
column.
The cancellation of a workflow is currently executed by the queue cancel-application-assessment
. The Offering bulk change, for instance, executes also the bulk cancellation of any In progress
application.
To allow the cancellation to also be handled by the schedulers, we can use the assessment status Cancellation requested
to update any student-assessment
to be canceled. The scheduler can then look for these records and try to execute the process and set the student-assessment
as canceled.
The workflow cancellation process happen immediately and right now it is processed by cancel-application-assessment.processor.ts.
assessment-workflow-execution-queue
)Coordinate the execution of all the student_assessments
to ensure its execution. Allow multiple student_assessments
to be created and ensures their ordered execution and its association with the application's current assessment.
Executed every minute or some short interval to be discussed.
Created
status.Completed
status and there is 1 to n Created
assessment (waiting to be executed). Only the oldest assessment record in Created
status will be selected for each application.Created
status.
1 - Change the status to Queued
.
2 - Queue the assessment for execution (already existing start-application-assessment
).Created
status.
1 - Change the status to Queued
.
2 - Update the application's current assessment to point to this record.
3 - Queue the assessment for execution (already existing start-application-assessment
).assessment-workflow-execution-queue-retry
)Checks for any stalled Queued
student_assessments
that did not start after a long period.
Executed every few hours or some long interval to be discussed.
Any application where the current assessment is in Queued
status for some long period of time (e.g. 6 hours).
Queue the assessment for execution (already existing start-application-assessment
).
Stop triggering the start-application-assessment
and the cancel-application-assessment
from the applications. Only the new schedulers would be responsible for triggering the Camunda workflows and canceling them. We can consider maybe letting the "Original Assessment" trigger the assessment for a better user experience once the application is submitted.
Current points triggering the assessment workflow:
Current points for canceling the assessment workflow:
Some assessment creations, like Scholastic Standing, also create notifications for the students. We should consider triggering these notifications when the specific assessment becomes the application's current assessment.
start-application-assessment
queue.
Describe the task Analysis to trigger Camunda assessment workflows using queues. Right now, most of the time, the assessment/reassessment records are created and the call to the queue happens right away. If the queue call fails or the queue is cleared there is no other attempt to start the workflow again.
Acceptance Criteria