launcher.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:spylon 作者: maxpoint 项目源码 文件源码
def with_spark_context(application_name, conf=None):
    """Context manager for a spark context

    Parameters
    ----------
    application_name : string
    conf : string, optional

    Returns
    -------
    sc : SparkContext

    Examples
    --------
    Used within a context manager
    >>> with with_spark_context("MyApplication") as sc:
    ...     # Your Code here
    ...     pass

    """
    if conf is None:
        conf = default_configuration
    assert isinstance(conf, SparkConfiguration)

    sc = conf.spark_context(application_name)
    try:
        yield sc
    finally:
        sc.stop()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号