-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Task action processor #5657
Task action processor #5657
Conversation
…o-production into step-state-processor
Kitodo-DataManagement/src/main/java/org/kitodo/data/database/persistence/CommentDAO.java
Show resolved
Hide resolved
@henning-gerhardt would you mind reviewing this pull request? As I am not very familiar with ActiveMQ, I am not very well suited for this review, I think. |
@solth , @markusweigelt : I can review this pull but reviewing it will take some time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the first round of reviewing this pull request and did only contain a read code review. Testing and getting experience with this pull request is next.
But I'm unsure about the setting task state to 'lock' as this is dangerous and was a sign of a big error in the workflow in the past. I will talk to you in next days.
Kitodo/src/main/java/org/kitodo/production/interfaces/activemq/TaskActionProcessor.java
Outdated
Show resolved
Hide resolved
Kitodo/src/main/java/org/kitodo/production/services/workflow/WorkflowControllerService.java
Show resolved
Hide resolved
Kitodo/src/main/java/org/kitodo/production/interfaces/activemq/TaskActionProcessor.java
Outdated
Show resolved
Hide resolved
…k to state INWORK when correction id is not set
@henning-gerhardt I have added your comments from the review and hints from our conversation. Task Action
Task Action
The tests and the documentation linked above is adapted too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now a functional review. I tested a few use scenarios but I did not test the usage of the correction id! Without a correction id the new functionality is working even I'm not convinced by setting a task to "LOCKED" (red) as this is in my current experience world wrong: after a "DONE" (green) task only a "OPEN" (yellow) or "INPROCESS" (orange) task state an follow and never a "LOCKED" (red) state.
One bigger issue is that if a task is set to "INPROCESS" a second time the state is not saved to the database and the new processing time is even not updated.
I did even read your documentation in the wiki (thumbs up for this) but is was for me at least at two places confusing or not understandable to read:
ERROR_OPEN (documentation at https://github.com/kitodo/kitodo-production/wiki/Developer_3.x-Active-MQ#error_open)
Some kind of confusing to read "This action set the processing status of a task to LOCKED when correctionTaskId is set and creates an error comment." and later "When correctionTaskId is set the correction task is set to OPEN."
ERROR_CLOSE (documentation at https://github.com/kitodo/kitodo-production/wiki/Developer_3.x-Active-MQ#error_close)
It is difficult to understand or confusion to read (at least for me): Name of the action ingest that the task got closed. But first sentence says "OPEN". Next sentence says "LOCKED" (kind of close), except under some conditions is set or stay "INWORK" and last sentence says "DONE" (kind of close).
Maybe you can explain this two actions in a better or other way. Maybe even renaming the action names to more meaning and understandable names.
Kitodo/src/main/java/org/kitodo/production/interfaces/activemq/TaskActionProcessor.java
Outdated
Show resolved
Hide resolved
Kitodo/src/main/java/org/kitodo/production/interfaces/activemq/TaskActionProcessor.java
Outdated
Show resolved
Hide resolved
…x is already call, set processing date all the time
@henning-gerhardt have incorporated your comments and hints in the implemenation. If you are satisfied with it, then please approve. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me in my usage scenarios without using a correction id.
@markusweigelt please rebase against current master. |
@solth Merged against the current master. |
import org.kitodo.data.database.enums.TaskEditType; | ||
import org.kitodo.data.database.enums.TaskStatus; | ||
import org.kitodo.data.database.exceptions.DAOException; | ||
import org.kitodo.data.elasticsearch.exceptions.CustomResponseException; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import org.kitodo.data.elasticsearch.exceptions.CustomResponseException; |
Unused import
currentTask.getProcessingStatus())) || (mapMessageObjectReader.hasField( | ||
KEY_CORRECTION_TASK_ID) && !TaskStatus.LOCKED.equals(currentTask.getProcessingStatus()))) { | ||
throw new ProcessorException( | ||
"Status of task is not INWORK if there is a no corrected task ID or LOCKED if there is a corrected task ID."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious: shouldn't this be "correction task ID" instead of "corrected task ID"? It is not yet corrected at this moment, is it?
@markusweigelt I am not sure but I think the following line in https://github.com/markusweigelt/kitodo-production/blob/edfe9b1176d973a193d8fee99376db9c6e073321/Kitodo/src/main/java/org/kitodo/production/forms/CommentForm.java#L243 can potentially throw a NullPointerException that needs to be handled because now
|
@solth I resolved a potential null pointer exception and checked if there were more occurrences with 'getCorrectionTask,' but I didn't find any. |
This pr add the new TaskActionProcessor and following TaskActions to process.
COMMENT
action adds a comment to the taskERROR_OPEN
action lock the task and add an error comment when task status is OPEN or INWORKERROR_CLOSE
action set the task status of logged task to OPENPROCESS
action set task status of open task to INWORKCLOSE
action close a taskPlease consider the updated documentation https://github.com/kitodo/kitodo-production/wiki/Developer_3.x-Active-MQ#processors and for simplified use of ActiveMQ testing, the Docker image and the Java client https://github.com/slub/kitodo-production-activemq.