MCPcopy Index your code
hub / github.com/hyperopt/hyperopt / _decide_parallelism

Method _decide_parallelism

hyperopt/spark.py:121–147  ·  view source on GitHub ↗

Given the requested parallelism, return the max parallelism SparkTrials will actually use. See the docstring for `parallelism` in the constructor for expected behavior.

(requested_parallelism, spark_default_parallelism)

Source from the content-addressed store, hash-verified

119
120 @staticmethod
121 def _decide_parallelism(requested_parallelism, spark_default_parallelism):
122 """
123 Given the requested parallelism, return the max parallelism SparkTrials will actually use.
124 See the docstring for `parallelism` in the constructor for expected behavior.
125 """
126 if requested_parallelism is None or requested_parallelism <= 0:
127 parallelism = max(spark_default_parallelism, 1)
128 logger.warning(
129 "Because the requested parallelism was None or a non-positive value, "
130 "parallelism will be set to ({d}), which is Spark's default parallelism ({s}), "
131 "or 1, whichever is greater. "
132 "We recommend setting parallelism explicitly to a positive value because "
133 "the total of Spark task slots is subject to cluster sizing.".format(
134 d=parallelism, s=spark_default_parallelism
135 )
136 )
137 else:
138 parallelism = requested_parallelism
139
140 if parallelism > SparkTrials.MAX_CONCURRENT_JOBS_ALLOWED:
141 logger.warning(
142 "Parallelism ({p}) is capped at SparkTrials.MAX_CONCURRENT_JOBS_ALLOWED ({c}).".format(
143 p=parallelism, c=SparkTrials.MAX_CONCURRENT_JOBS_ALLOWED
144 )
145 )
146 parallelism = SparkTrials.MAX_CONCURRENT_JOBS_ALLOWED
147 return parallelism
148
149 def count_successful_trials(self):
150 """

Callers 2

__init__Method · 0.95
test_parallelism_argMethod · 0.80

Calls

no outgoing calls

Tested by 1

test_parallelism_argMethod · 0.64