Skip to content

Commit

Permalink
Fix cost (for methods cromwell), add explicit example
Browse files Browse the repository at this point in the history
  • Loading branch information
sjfleming committed Jan 19, 2024
1 parent d6727df commit a08eaaa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,15 @@ Cromshell is a CLI for submitting workflows to a Cromwell server and monitoring/
* Requires the `bq_cost_table` key to exist in the cromshell
configuration file and have a value equal to the BigQuery cost table
for your GCP billing project.
* For example, using the Methods cromwell server, your `~/.cromshell/cromshell_config.json`
should be as follows:
```json
{
"cromwell_server": "https://cromwell-v77.dsde-methods.broadinstitute.org/",
"requests_timeout": 5,
"bq_cost_table": "Methods_billing_dump.gcp_billing_export_v1_009C7D_923007_219A6F"
}
```
* `-c/--color` Color outliers in task level cost results.
* `-d/--detailed` Get the cost for a workflow at the task level.

Expand Down
4 changes: 2 additions & 2 deletions src/cromshell/cost/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,15 @@ def create_bq_query(detailed: bool, bq_cost_table: str) -> str:
AND task.key LIKE "wdl-task-name"
AND wfid.key LIKE "cromwell-workflow-id"
AND wfid.value like @workflow_id
AND partition_time BETWEEN @start_date AND @end_date
AND export_time BETWEEN @start_date AND @end_date
GROUP BY 1,2,3
ORDER BY 4 DESC
"""
else:
return f"""
SELECT sum(cost) as cost
FROM {bq_cost_table}, UNNEST(labels)
WHERE value LIKE @workflow_id AND partition_time BETWEEN @start_date AND @end_date
WHERE value LIKE @workflow_id AND export_time BETWEEN @start_date AND @end_date
"""


Expand Down

0 comments on commit a08eaaa

Please sign in to comment.