-
Notifications
You must be signed in to change notification settings - Fork 8
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
cromwell metadata params [risk: low] #1456
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7735abb
get-workflow-details endpoint now accepts includeKey/excludeKey/expan…
davidangb a544ef5
specify which keys to return for workflow metadata
davidangb 653a2d1
lazy-load the workflow timing diagram
davidangb 7307450
remove debugging artifact
davidangb 1fe4851
fix indentation
davidangb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,13 @@ | |
:link-label link-label)] | ||
(str gcs-uri)))) | ||
|
||
(defonce default-metadata-includes ["backendLogs" "backendStatus" "end" "executionStatus" "callCaching:hit" | ||
"id" "inputs" "jobId" "outputs" "start" "status" "stderr" "stdout" "submission" | ||
"submittedFiles:inputs" "workflowLog" "workflowName" "workflowRoot"]) | ||
|
||
(defonce metadata-timing-includes ["attempt" "description" "end" "endTime" "executionEvents" "executionStatus" | ||
"shardIndex" "start" "startTime" "workflowName"]) | ||
|
||
(defn getTimingDiagramHeight [chartContainer] | ||
(let [e (-> chartContainer (.-childNodes) | ||
(aget 0) (.-childNodes) | ||
|
@@ -82,34 +89,65 @@ | |
:filterable? false} | ||
:columns (if (:call-detail? props) columns (cons task-column columns))}}])])])}) | ||
|
||
(react/defc- WorkflowTiming | ||
(react/defc- WorkflowTimingDiagram | ||
{:render | ||
(fn [{:keys [props state refs]}] | ||
(let [{:keys [error? expanded? metadata-response]} @state | ||
{:keys [workspace-id submission-id workflow]} props | ||
workflow-name (workflow "workflowName") | ||
workflow-id (workflow "id")] | ||
(cond | ||
(nil? metadata-response) | ||
(spinner "Loading timing diagram...") | ||
(not (:success? metadata-response)) | ||
(style/create-inline-error-message (str "Error loading timing data: " (:response metadata-response))) | ||
:else | ||
(let [data (:raw-response metadata-response)] | ||
[:div {} | ||
(if error? | ||
(style/create-inline-error-message "Error loading charts.") | ||
[ScriptLoader | ||
{:on-error #(swap! state assoc :error? true) | ||
:on-load (fn [] | ||
(js/google.charts.load "current" (clj->js {"packages" ["timeline"]})) | ||
(js/google.charts.setOnLoadCallback | ||
(fn [] | ||
(let [chart-container (@refs "chart-container")] | ||
(.timingDiagram js/window chart-container data workflow-name 100) | ||
(let [height (getTimingDiagramHeight chart-container)] | ||
(.timingDiagram js/window chart-container data workflow-name (+ 75 height))))))) | ||
:path "https://www.gstatic.com/charts/loader.js"}]) | ||
[:div {:ref "chart-container" :style {:paddingTop "0.5rem"}}]])))) | ||
:component-did-mount | ||
(fn [{:keys [props state]}] | ||
(let [{:keys [workspace-id submission-id workflow]} props | ||
workflow-name (workflow "name") | ||
workflow-id (workflow "id")] | ||
(endpoints/call-ajax-orch | ||
{:endpoint | ||
(endpoints/get-workflow-details workspace-id submission-id workflow-id metadata-timing-includes) | ||
:on-done (fn [{:keys [success? get-parsed-response status-text raw-response]}] | ||
(swap! state assoc :metadata-response | ||
{:success? success? | ||
:response (if success? (get-parsed-response false) status-text) | ||
:raw-response raw-response}))})))}) | ||
|
||
(react/defc- WorkflowTimingContainer | ||
{:render | ||
(fn [{:keys [props state refs]}] | ||
(let [{:keys [error? expanded?]} @state | ||
{:keys [label data]} props] | ||
(let [{:keys [expanded?]} @state | ||
{:keys [workspace-id submission-id workflow label]} props] | ||
[:div {} | ||
(create-field | ||
label | ||
(if (empty? data) | ||
"Not Available" | ||
(links/create-internal {:onClick #(swap! state update :expanded? not)} | ||
(if expanded? "Hide" "Show")))) | ||
(when expanded? | ||
[:div {} | ||
(if error? | ||
(style/create-server-error-message "Error loading charts.") | ||
[ScriptLoader | ||
{:on-error #(swap! state assoc :error? true) | ||
:on-load (fn [] | ||
(js/google.charts.load "current" (clj->js {"packages" ["timeline"]})) | ||
(js/google.charts.setOnLoadCallback | ||
(fn [] | ||
(let [chart-container (@refs "chart-container")] | ||
(.timingDiagram js/window chart-container data workflow-name 100) | ||
(let [height (getTimingDiagramHeight chart-container)] | ||
(.timingDiagram js/window chart-container data workflow-name (+ 75 height))))))) | ||
:path "https://www.gstatic.com/charts/loader.js"}]) | ||
[:div {:ref "chart-container" :style {:paddingTop "0.5rem"}}]])]))}) | ||
(create-field label | ||
(links/create-internal {:onClick #(swap! state update :expanded? not)} | ||
(if expanded? "Hide" "Show"))) | ||
;; use expanded? to show/hide the WorkflowTimingDiagram component via the DOM | ||
[:div {:myattr "whereami" :style {:display (if expanded? "block" "none")}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. debugging artifact? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hahaha yes thank you for the catch. |
||
(when (some? expanded?) | ||
;; as long as the user has clicked to show the WorkflowTimingDiagram at least once, | ||
;; render it. After the first render, show/hide it via the DOM so we don't trigger | ||
;; its ajax call more than once. | ||
[WorkflowTimingDiagram (utils/restructure workspace-id submission-id workflow)])]]))}) | ||
|
||
(defn- backend-logs [data workspace-id] | ||
(when-let [log-map (data "backendLogs")] | ||
|
@@ -196,7 +234,7 @@ | |
:backgroundColor (:background-light style/colors)}} | ||
(create-field "Subworkflow ID" (links/create-external {:href (render-gcs-path subworkflow-path-components)} (workflow "id"))) | ||
(when (seq (workflow "calls")) | ||
[WorkflowTiming {:label "Workflow Timing" :data raw-data :workflow-name workflow-name}]) | ||
[WorkflowTimingContainer (merge {:label "Workflow Timing"} (utils/restructure workspace-id submission-id workflow))]) | ||
(when-let [failures (workflow "failures")] | ||
[Failures {:data failures}]) | ||
(when (seq (workflow "calls")) | ||
|
@@ -224,7 +262,7 @@ | |
(endpoints/call-ajax-orch | ||
{:endpoint | ||
(endpoints/get-workflow-details | ||
(:workspace-id props) (:submission-id props) (:workflow-id props)) | ||
(:workspace-id props) (:submission-id props) (:workflow-id props) default-metadata-includes) | ||
:on-done (fn [{:keys [success? get-parsed-response status-text raw-response]}] | ||
(swap! state assoc :server-response | ||
{:success? success? | ||
|
@@ -327,7 +365,7 @@ | |
(when-let [workflowLog (workflow "workflowLog")] | ||
(create-field "Workflow Log" (display-value (:namespace workspace-id) workflowLog (str "workflow." (workflow "id") ".log")))) | ||
(when (seq (workflow "calls")) | ||
[WorkflowTiming {:label "Workflow Timing" :data raw-data :workflow-name workflow-name}]) | ||
[WorkflowTimingContainer (merge {:label "Workflow Timing"} (utils/restructure workspace-id submission-id workflow))]) | ||
(when-let [failures (workflow "failures")] | ||
[Failures {:data failures}]) | ||
(when (seq (workflow "calls")) | ||
|
@@ -362,7 +400,7 @@ | |
(endpoints/call-ajax-orch | ||
{:endpoint | ||
(endpoints/get-workflow-details | ||
(:workspace-id props) (:submission-id props) (:workflow-id props)) | ||
(:workspace-id props) (:submission-id props) (:workflow-id props) default-metadata-includes) | ||
:on-done (fn [{:keys [success? get-parsed-response status-text raw-response]}] | ||
(swap! state assoc :metadata-response | ||
{:success? success? | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
reindent