Exec env
Module to take care of creating a singleton of the execution environment class.
ExecEnv
¶
Bases: object
Represents the basic resources regarding the engine execution environment.
Currently, it is used to encapsulate both the logic to get the Spark session and the engine configurations.
Source code in mkdocs/lakehouse_engine/packages/core/exec_env.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
|
get_environment()
classmethod
¶
Get the environment where the process is running.
Returns:
Type | Description |
---|---|
str
|
Name of the environment. |
Source code in mkdocs/lakehouse_engine/packages/core/exec_env.py
get_or_create(session=None, enable_hive_support=True, app_name=None, config=None)
classmethod
¶
Get or create an execution environment session (currently Spark).
It instantiates a singleton session that can be accessed anywhere from the lakehouse engine. By default, if there is an existing Spark Session in the environment (getActiveSession()), this function re-uses it. It can be further extended in the future to support forcing the creation of new isolated sessions even when a Spark Session is already active.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session |
SparkSession
|
spark session. |
None
|
enable_hive_support |
bool
|
whether to enable hive support or not. |
True
|
app_name |
str
|
application name. |
None
|
config |
dict
|
extra spark configs to supply to the spark session. |
None
|
Source code in mkdocs/lakehouse_engine/packages/core/exec_env.py
set_default_engine_config(package='lakehouse_engine.configs', custom_configs_dict=None, custom_configs_file_path=None)
classmethod
¶
Set default engine configurations.
The function set the default engine configurations by reading them from a specified package and overwrite them if the user pass a dictionary or a file path with new configurations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
package |
str
|
package where the engine default configurations can be found. |
'lakehouse_engine.configs'
|
custom_configs_dict |
dict
|
a dictionary with custom configurations |
None
|
custom_configs_file_path |
str
|
path for the file with custom |
None
|