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

Added estimate billing script for GCP batch runs #41

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ldhtnp
Copy link

@ldhtnp ldhtnp commented Nov 8, 2024

I added a script gb_estimate_billing.py that can be used for estimating the cost of runs performed with GCP batch. The script is very similar to estimate_billing.py with a few small changes related to the different metadata structure generated with GCP.

@malachig
Copy link
Member

I did a test with preemptible nodes turned on (using Cromwell 87, but the old backend instead of GCP batch). I got this error:

[ERROR] germlineExomeHlaTyping.phlat has not completed running, cost cannot be calculated
Traceback (most recent call last):
  File "/home/mgriffit/git/cloud-workflows/scripts/gb_estimate_billing.py", line 260, in <module>
    cost = get_workflow_cost(args.metadata_dir.rstrip('/'), args.workflow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mgriffit/git/cloud-workflows/scripts/gb_estimate_billing.py", line 225, in get_workflow_cost
    call_costs[ck] = get_workflow_cost(metadata_dir, call[SUBWORKFLOW_KEY])
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mgriffit/git/cloud-workflows/scripts/gb_estimate_billing.py", line 222, in get_workflow_cost
    if is_cached_task(call):
       ^^^^^^^^^^^^^^^^^^^^
  File "/home/mgriffit/git/cloud-workflows/scripts/gb_estimate_billing.py", line 73, in is_cached_task
    return call[CACHED_KEY]["hit"] == True
           ~~~~~~~~~~~~~~~~^^^^^^^
KeyError: 'hit'

To reproduce the error:

cd /storage1/fs1/gillandersw/Active/Project_0001_Clinical_Trials/pancreas_leidos/analysis/TWJF-5120-39/gcp_immuno/final_results/workflow_artifacts/costs/

export WORKFLOW_ID=b033e4be-8d5a-4bc1-9f6b-efa9387bd255

python3 ~/git/cloud-workflows/scripts/gb_estimate_billing.py $WORKFLOW_ID $GCS_BUCKET_PATH/workflow_artifacts/$WORKFLOW_ID/artifacts/metadata/ > costs.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants