Skip to content
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

Add timestamps to Preservation tasks #842

Merged
merged 1 commit into from
Jan 31, 2024

Conversation

Diogenesoftoronto
Copy link
Contributor

This PR aims to add timestamps to Preservations Tasks and give additional detail to the user in the enduro dashboard about when archivematica jobs started and finished.

Closes #832

@Diogenesoftoronto Diogenesoftoronto force-pushed the dev/add-timestamp-to-job branch 3 times, most recently from 09a3067 to 533b581 Compare January 25, 2024 21:40
@Diogenesoftoronto Diogenesoftoronto marked this pull request as ready for review January 25, 2024 21:41
Copy link
Contributor

@sevein sevein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a few comments. Have you confirmed that the timestamps are being properly recorded? In the savePreservationTasks method, I see the following:

		pt := ConvertJobToPreservationTask(job)
		pt.PreservationActionID = jt.presActionID

		now := sql.NullTime{Time: jt.clock.Now(), Valid: true}
		pt.StartedAt = now
		pt.CompletedAt = now

With your changes, ConvertJobToPreservationTask is populating the timestamps but they're set to now right after. If you tested this PR and observed the timestamps recorded I suppose that'd become apparent.

@Diogenesoftoronto
Copy link
Contributor Author

I've added a few comments. Have you confirmed that the timestamps are being properly recorded? In the savePreservationTasks method, I see the following:

		pt := ConvertJobToPreservationTask(job)
		pt.PreservationActionID = jt.presActionID

		now := sql.NullTime{Time: jt.clock.Now(), Valid: true}
		pt.StartedAt = now
		pt.CompletedAt = now

With your changes, ConvertJobToPreservationTask is populating the timestamps but they're set to now right after. If you tested this PR and observed the timestamps recorded I suppose that'd become apparent.

Only thing I am worried about for this is that the tasks could very well be completed before this current time such that if any task that would have had a different completedAt time would have now as their time. I think this is a problem. Too fix this I could compare to check if the first value in the list is actually after the time completed. If it is then we know the value is both not null and the time that the task actually completed.

@Diogenesoftoronto
Copy link
Contributor Author

Diogenesoftoronto commented Jan 30, 2024

I've added a few comments. Have you confirmed that the timestamps are being properly recorded? In the savePreservationTasks method, I see the following:

		pt := ConvertJobToPreservationTask(job)
		pt.PreservationActionID = jt.presActionID

		now := sql.NullTime{Time: jt.clock.Now(), Valid: true}
		pt.StartedAt = now
		pt.CompletedAt = now

With your changes, ConvertJobToPreservationTask is populating the timestamps but they're set to now right after. If you tested this PR and observed the timestamps recorded I suppose that'd become apparent.

Only thing I am worried about for this is that the tasks could very well be completed before this current time such that if any task that would have had a different completedAt time would have now as their time. I think this is a problem. Too fix this I could compare to check if the first value in the list is actually after the time completed. If it is then we know the value is both not null and the time that the task actually completed.

I fixed this concern. I also added some of the tests. There is better test coverage and I individually tested both of the functions to make sure they return the correct times.

Copy link
Contributor

@sevein sevein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is almost complete but I've included additional comments. I also submitted 9a77eff myself to save you the extra work. Please let me know your thoughts.

Adds timestamps to Preservations Tasks and gives additional details
to the user in the enduro dashboard about when archivematica jobs
started and finished.

Closes #832
@Diogenesoftoronto
Copy link
Contributor Author

Diogenesoftoronto commented Jan 30, 2024

It looks great @sevein, I didn't realize you were suggesting removing the null check here, but I suppose that makes sense. Thanks for implementing the solutions to the tests as well. They look great. I have rebased and formatted the commit. It is ready to merge.

Copy link
Contributor

@sevein sevein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Diogenesoftoronto Diogenesoftoronto merged commit ac3e5cf into main Jan 31, 2024
11 checks passed
@Diogenesoftoronto Diogenesoftoronto deleted the dev/add-timestamp-to-job branch January 31, 2024 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Problem: lack of timestamps for task lifecycle in Archivematica microservices
2 participants