lentiq.helpers module
from lentiq.lentiq_dict import LentiqDict from lentiq.api import ApplicationPublicApiControllerApi from pyspark.sql import SparkSession def get_applications_api(): """ get the application class will be performing arithmetic on. """ lq_dict = LentiqDict.get_instance() api_client=lq_dict.get_default_api_client() return ApplicationPublicApiControllerApi(api_client) def get_lentiq_config(): return LentiqDict.get_instance() def get_project_name(): return get_lentiq_config().get_default_project_name() def get_datapool_name(): return get_lentiq_config().get_default_data_pool_name() def get_default_auth(): return get_lentiq_config().get_default_auth() def get_all_apps(): return get_applications_api()\ .get_all_applications_for_project( get_default_auth(), get_datapool_name(), get_project_name() ) def get_app(app_name): return get_applications_api()\ .get_application( get_default_auth(), app_name, get_datapool_name(), get_project_name() ) def get_spark_master_url(spark_app_name): app = get_app(spark_app_name) return app.cached_application_status.connection_internal.spark_master_connection_string def get_spark_session(spark_app_name=None, options=None, spark_master="local[1]"): if spark_app_name is not None: spark_master = get_spark_master_url(spark_app_name) builder = SparkSession.builder.master(spark_master) for option in options: builder = builder.option(option) return builder.getOrCreate()
Functions
def get_all_apps(
)
def get_all_apps(): return get_applications_api()\ .get_all_applications_for_project( get_default_auth(), get_datapool_name(), get_project_name() )
def get_app(
app_name)
def get_app(app_name): return get_applications_api()\ .get_application( get_default_auth(), app_name, get_datapool_name(), get_project_name() )
def get_applications_api(
)
get the application class will be performing arithmetic on.
def get_applications_api(): """ get the application class will be performing arithmetic on. """ lq_dict = LentiqDict.get_instance() api_client=lq_dict.get_default_api_client() return ApplicationPublicApiControllerApi(api_client)
def get_datapool_name(
)
def get_datapool_name(): return get_lentiq_config().get_default_data_pool_name()
def get_default_auth(
)
def get_default_auth(): return get_lentiq_config().get_default_auth()
def get_lentiq_config(
)
def get_lentiq_config(): return LentiqDict.get_instance()
def get_project_name(
)
def get_project_name(): return get_lentiq_config().get_default_project_name()
def get_spark_master_url(
spark_app_name)
def get_spark_master_url(spark_app_name): app = get_app(spark_app_name) return app.cached_application_status.connection_internal.spark_master_connection_string
def get_spark_session(
spark_app_name=None, options=None, spark_master='local[1]')
def get_spark_session(spark_app_name=None, options=None, spark_master="local[1]"): if spark_app_name is not None: spark_master = get_spark_master_url(spark_app_name) builder = SparkSession.builder.master(spark_master) for option in options: builder = builder.option(option) return builder.getOrCreate()