Skip to content

Commit

Permalink
Fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffxy committed Dec 3, 2023
1 parent f453a9c commit 7bb57b1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/brad/config/planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,9 @@ def redshift_scaling_coefs(self) -> npt.NDArray:
def redshift_new_scaling_coefs(self) -> npt.NDArray:
if self._redshift_new_scaling_coefs is None:
coefs = self._raw["redshift_scaling_new"]
self._redshift_new_scaling_coefs = np.array([coefs["coef1"], coefs["coef2"]])
self._redshift_new_scaling_coefs = np.array(
[coefs["coef1"], coefs["coef2"]]
)
return self._redshift_new_scaling_coefs

def redshift_new_scaling_alpha(self) -> float:
Expand Down
8 changes: 6 additions & 2 deletions src/brad/planner/scoring/performance/unified_redshift.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,15 @@ def predict_query_latency_load_resources(

# 2. Compute the impact of system load.
mean_service_time = alone_predicted_latency.mean()
cpu_util = overall_cpu_denorm / (redshift_num_cpus(to_prov) * to_prov.num_nodes())
cpu_util = overall_cpu_denorm / (
redshift_num_cpus(to_prov) * to_prov.num_nodes()
)
denom = max(1e-3, 1.0 - cpu_util) # Want to avoid division by 0.
wait_sf = cpu_util / denom
mean_wait_time = (
mean_service_time * wait_sf * ctx.planner_config.redshift_new_scaling_alpha()
mean_service_time
* wait_sf
* ctx.planner_config.redshift_new_scaling_alpha()
)

# Predicted running time is the query's execution time alone plus the
Expand Down

0 comments on commit 7bb57b1

Please sign in to comment.