Ejemplo n.º 1
0
Archivo: java.py Proyecto: zscu/hail
 def hc():
     if not Env._hc:
         from hail.context import init
         import sys
         sys.stderr.write("Initializing Spark and Hail with default parameters...\n")
         init()
         assert Env._hc is not None
     return Env._hc
Ejemplo n.º 2
0
 def hc():
     if not Env._hc:
         from hail.context import init
         import sys
         sys.stderr.write("Initializing Spark and Hail with default parameters...\n")
         init()
         assert Env._hc is not None
     return Env._hc
Ejemplo n.º 3
0
    def hc():
        if not Env._hc:
            sys.stderr.write("Initializing Hail with default parameters...\n")

            backend_name = os.environ.get('HAIL_QUERY_BACKEND', 'spark')
            if backend_name == 'service':
                from hail.context import init_service
                init_service()
            elif backend_name == 'spark':
                from hail.context import init
                init()

        assert Env._hc is not None
        return Env._hc
Ejemplo n.º 4
0
    def hc():
        if not Env._hc:
            sys.stderr.write("Initializing Hail with default parameters...\n")

            backend_name = os.environ.get('HAIL_QUERY_BACKEND', 'spark')
            if backend_name == 'service':
                from hail.context import init_service
                init_service()
            elif backend_name == 'spark':
                from hail.context import init
                init()
            elif backend_name == 'local':
                from hail.context import init_local
                init_local()
            else:
                raise ValueError(f'unknown Hail Query backend: {backend_name}')

        assert Env._hc is not None
        return Env._hc
Ejemplo n.º 5
0
    def hc() -> 'hail.context.HailContext':
        if not Env._hc:
            sys.stderr.write("Initializing Hail with default parameters...\n")
            sys.stderr.flush()

            backend_name = os.environ.get('HAIL_QUERY_BACKEND', 'spark')
            if backend_name == 'service':
                from hail.context import init_service
                import asyncio
                warnings.warn(
                    'When using the query service backend, use `await Env._async_hc()\''
                )
                asyncio.get_event_loop().run_until_complete(init_service())
            elif backend_name == 'spark':
                from hail.context import init
                init()
            elif backend_name == 'local':
                from hail.context import init_local
                init_local()
            else:
                raise ValueError(f'unknown Hail Query backend: {backend_name}')

        assert Env._hc is not None
        return Env._hc