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

last access field in workflow runs updates properly #357

Merged
merged 3 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changes/fix_last_accessed_property.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fix vidarr run last_accessed field
* Change so field is set when run is submit (not only on inital loading)
* Field is now exported at the api/run/<hash> endpoint
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public static DatabaseWorkflow create(
LongFunction<AtomicBoolean> liveness,
DSLContext dsl)
throws SQLException {

final var record =
dsl.insertInto(WORKFLOW_RUN)
.columns(
Expand All @@ -56,15 +57,17 @@ final var record =
WORKFLOW_RUN.WORKFLOW_VERSION_ID,
WORKFLOW_RUN.HASH_ID,
WORKFLOW_RUN.LABELS,
WORKFLOW_RUN.INPUT_FILE_IDS)
WORKFLOW_RUN.INPUT_FILE_IDS,
WORKFLOW_RUN.LAST_ACCESSED)
.values(
arguments,
metadata,
engineParameters,
workflowVersionId,
vidarrId,
labelsToJson(labels),
fileIds.toArray(String[]::new))
fileIds.toArray(String[]::new),
OffsetDateTime.now())
.returningResult(WORKFLOW_RUN.ID, WORKFLOW_RUN.CREATED)
.fetchOptional()
.orElseThrow();
Expand Down Expand Up @@ -217,6 +220,7 @@ public static DatabaseWorkflow reinitialise(
.set(WORKFLOW_RUN.ARGUMENTS, arguments)
.set(WORKFLOW_RUN.ENGINE_PARAMETERS, engineParameters)
.set(WORKFLOW_RUN.METADATA, metadata)
.set(WORKFLOW_RUN.LAST_ACCESSED, OffsetDateTime.now())
.set(WORKFLOW_RUN.WORKFLOW_VERSION_ID, workflowVersionId)
.where(WORKFLOW_RUN.ID.eq(dbId))
.execute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,7 @@ private void createAnalysisRecords(
fields.add(literalJsonEntry("labels", WORKFLOW_RUN.LABELS));
fields.add(literalJsonEntry("modified", WORKFLOW_RUN.MODIFIED));
fields.add(literalJsonEntry("started", WORKFLOW_RUN.STARTED));
fields.add(literalJsonEntry("lastAccessed", WORKFLOW_RUN.LAST_ACCESSED));

if (includeParameters) {
fields.add(literalJsonEntry("arguments", WORKFLOW_RUN.ARGUMENTS));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1540,6 +1540,7 @@ private void removeCreatedAndModifiedFieldsForBetterComparisons(JsonNode unload)
.forEach(
wfr -> {
((ObjectNode) wfr).remove("modified");
((ObjectNode) wfr).remove("lastAccessed");
wfr.get("externalKeys")
.forEach(
ek -> {
Expand Down
Loading