MCPcopy
hub / github.com/dask/dask / optimize_until

Function optimize_until

dask/_expr.py:923–954  ·  view source on GitHub ↗
(expr: Expr, stage: OptimizerStage)

Source from the content-addressed store, hash-verified

921
922
923def optimize_until(expr: Expr, stage: OptimizerStage) -> Expr:
924 result = expr
925 if stage == "logical":
926 return result
927
928 # Simplify
929 expr = result.simplify()
930 if stage == "simplified-logical":
931 return expr
932
933 # Manipulate Expression to make it more efficient
934 if dask.config.get("optimization.tune.active", True):
935 expr = expr.rewrite(kind="tune", rewritten={})
936 if stage == "tuned-logical":
937 return expr
938
939 # Lower
940 expr = expr.lower_completely()
941 if stage == "physical":
942 return expr
943
944 # Simplify again
945 expr = expr.simplify()
946 if stage == "simplified-physical":
947 return expr
948
949 # Final graph-specific optimizations
950 expr = expr.fuse()
951 if stage == "fused":
952 return expr
953
954 raise ValueError(f"Stage {stage!r} not supported.")
955
956
957class LLGExpr(Expr):

Callers 3

explainFunction · 0.90
optimizeMethod · 0.85
optimizeFunction · 0.85

Calls 5

lower_completelyMethod · 0.80
simplifyMethod · 0.45
getMethod · 0.45
rewriteMethod · 0.45
fuseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…