-
Notifications
You must be signed in to change notification settings - Fork 358
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
WX-1110[risk=low] Added endpoint to fetch failed tasks by workflow id #7165
Conversation
…to json response for calls rather than workflows
…c update(still working on it)
…ssumptions are correct)
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.
Nice job!!! Left a few questions about tests but I think this looks great.
val resultSetColumnNames = s"me.${workflowUuid}, me.${callFqn}, me.${scatterIndex}, me.${retryAttempt}, me.${metadataKey}, me.${metadataValue}, me.${metadataValueType}, me.${metadataTimestamp}, me.${metadataJournalId}" | ||
|
||
val query = sql""" | ||
SELECT #${resultSetColumnNames} |
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.
What's up with these hash signs?
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.
It's Slick's way of handling string interpolation. You would think "Why not use ${}
? It's because Slick is using that notation specifically to bind values in a query.
So something like tableName.colName = ${val}
would work, but `SELECT ${tableName}.${colName} would throw an error since you're declaring an identifier rather than providing a value.
This also caught me off guard and is only briefly covered in the Slick docs.
'/api/workflows/{version}/{id}/metadata/failed-jobs': | ||
get: | ||
operationId: failed-jobs | ||
summary: Get call-level metadata of failed tasks for a specified workflow |
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.
Does this work for subworkflows as well? If not this should probably say "root workflow."
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.
Good point (only works for root workflows). I'll update the description
@@ -95,6 +100,7 @@ class MetadataBuilderActorSpec extends TestKitSuite with AsyncFlatSpecLike with | |||
// We'll use a Query instead of a SingleWorkflowMetadataGet, so we expect the WorkflowID this time: | |||
val expectedRes = | |||
s"""{ | |||
|"${workflowA}": { |
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.
Does this change represent a real change in behavior, or just a change in the structure of the test?
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.
See this comment. TLDR: I updated the wrong test.
engine/src/test/scala/cromwell/webservice/MetadataBuilderActorSpec.scala
Show resolved
Hide resolved
services/src/test/scala/cromwell/services/database/MetadataSlickDatabaseSpec.scala
Outdated
Show resolved
Hide resolved
…unt check on db spec
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.
Looks like this needs a pre-merge merge from develop
, but LGTM!
…sks with multiple retries and no scatters, updated tests
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.
LGTM. Nice job figuring out the slick stuff, some nasty surprises in there.
Addresses WX-1110
PR adds a new endpoint to fetch failed tasks on a workflow via workflow id. For tasks that execute with a scatter and/or multiple attempts this means that the latest attempt and/or latest scatter index with a
Failed
status will be returned. No workflow/sub-workflow specific data (outside of the root workflow id) is returned in the response in an attempt to keep the payload light.Aspects of note: JDBC driver handles
SerialClob
and query syntax differently betweenPostgreSQL
andnon-PostgreSQL
databases. As a result the query used is formatted differently to fit the DB specific expectations.Response is built using the already existing logic contained in
MetadataBuilderActor
(though new event listeners were added for the new endpoint flow).Food for thought (and for documentation purposes): I discovered that currently existing JDBC behavior adds
SerialClob
objects in thepg_largeobject
table and supplies the OID as the value inMETADATA_ENTRY.METADATA_VALUE
. Considering the number of key-value pairs on the metadata json response I'm curious about capacity concerns.