-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sort tasks alphabetically within each state, and limit the number of …
…tasks displayed to 5
- Loading branch information
Showing
5 changed files
with
50 additions
and
19 deletions.
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
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* Get a state summary for a given workflow. The returned map has a string with the state name as key. These keys | ||
* are sorted alphabetically. The values are sets, with the task names (<tt>${name}.${cyclepoint}</tt>). These | ||
* names are also sorted alphabetically. | ||
* @param {Object} workflow | ||
* @returns {Map<string, Array>} | ||
* @see https://github.com/cylc/cylc-flow/blob/de7d938496e82dbdfb165938145670dd8e801efd/lib/cylc/state_summary_mgr.py#L204 | ||
*/ | ||
function getWorkflowSummary (workflow) { | ||
const states = new Map() | ||
for (const taskProxy of workflow.taskProxies) { | ||
for (const job of taskProxy.jobs) { | ||
if (!states.has(job.state)) { | ||
states.set(job.state, new Set()) | ||
} | ||
states.get(job.state).add(`${taskProxy.name}.${taskProxy.cyclePoint}`) | ||
} | ||
} | ||
for (const [stateName, tasksSet] of states.entries()) { | ||
states.set(stateName, [...tasksSet].sort()) | ||
} | ||
return new Map([...states.entries()].sort()) | ||
} | ||
|
||
export { | ||
getWorkflowSummary | ||
} |
File renamed without changes.
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