Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. #
# No SciPy, but that's okay, we'll skip those tests # No NumPy, but that's okay, we'll skip those tests
""" Wait a given amount of time for a condition to pass, else fail with an error. This is a helper utility for PySpark tests.
Parameters ---------- condition : function Function that checks for termination conditions. condition() can return: - True: Conditions met. Return without error. - other value: Conditions not met yet. Continue. Upon timeout, include last such value in error message. Note that this method may be called at any time during streaming execution (e.g., even before any results have been created). timeout : int Number of seconds to wait. Default 30 seconds. catch_assertions : bool If False (default), do not catch AssertionErrors. If True, catch AssertionErrors; continue, but save error to throw upon timeout. """ else: if isinstance(lastValue, AssertionError): raise lastValue else: raise AssertionError( "Test failed due to timeout after %g sec, with last condition returning: %s" % (timeout, lastValue))
def conf(cls): """ Override this in subclasses to supply a more specific conf """
def setUpClass(cls):
def tearDownClass(cls):
# Note that 'sbt_jar_name_prefix' and 'mvn_jar_name_prefix' are used since the prefix can # vary for SBT or Maven specifically. See also SPARK-26856 os.environ["SPARK_HOME"], project_relative_path)
# We should ignore the following jars
# Search jar in the project dir using the jar name_prefix for both sbt build and maven # build because the artifact jars are in different directories. project_full_path, "target/scala-*/%s*.jar" % sbt_jar_name_prefix)) project_full_path, "target/%s*.jar" % mvn_jar_name_prefix))
return None raise RuntimeError("Found multiple JARs: %s; please remove all but one" % (", ".join(jars))) else: |