Skip to content

Commit

Permalink
Add config option for simulation duration
Browse files Browse the repository at this point in the history
  • Loading branch information
nweires committed Mar 26, 2024
1 parent 96d0857 commit f4b3d11
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions buildstockbatch/gcp/gcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,8 +654,9 @@ def start_batch_job(self, batch_info):
boot_disk_mib=job_env_cfg.get("boot_disk_mib", None),
)

# Give three minutes per simulation, plus ten minutes for job overhead
task_duration_secs = 60 * (10 + batch_info.n_sims_per_job * 3)
# Use specified time per simulation, plus ten minutes for job overhead.
minutes_per_sim = job_env_cfg.get("minutes_per_sim", 3)
task_duration_secs = 60 * (10 + batch_info.n_sims_per_job * minutes_per_sim)
task = batch_v1.TaskSpec(
runnables=[bsb_runnable],
compute_resource=resources,
Expand Down
1 change: 1 addition & 0 deletions buildstockbatch/schemas/v0.3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ gcp-job-environment-spec:
boot_disk_mib: int(required=False)
machine_type: str(required=False)
use_spot: bool(required=False)
minutes_per_sim: num(min=0.05, max=480, required=False)

gcp-postprocessing_environment-spec:
# Limits documented at
Expand Down
2 changes: 2 additions & 0 deletions docs/project_defn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@ using `GCP Batch <https://cloud.google.com/batch>`_ and `Cloud Run <https://clou
this is a type from the `E2 series`_. Usually safe to leave unset.
* ``use_spot``: Optional. Whether to use `Spot VMs <https://cloud.google.com/spot-vms>`_
for data simulations, which can reduce costs by up to 91%. Default: false
* ``minutes_per_sim``: Optional. Maximum time per simulation. Default works well for ResStock,
but this should be increased for ComStock. Default: 3 minutes
* ``postprocessing_environment``: Optional. Specifies the Cloud Run computing environment for
postprocessing.

Expand Down

0 comments on commit f4b3d11

Please sign in to comment.