Skip to content

Commit 166a248

Browse files
committed
Merge remote-tracking branch 'origin/release/6.0' into release/7.0
2 parents feafa0a + 544f165 commit 166a248

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

dataikuapi/dss/project.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,6 +1030,53 @@ def get_raw(self):
10301030
"""
10311031
return self.settings
10321032

1033+
def set_python_code_env(self, code_env_name):
1034+
"""Sets the default Python code env used by this project
1035+
1036+
:param str code_env_name: Identifier of the code env to use. If None, sets the project to use the builtin Python env
1037+
"""
1038+
if code_env_name is None:
1039+
self.settings["settings"]["codeEnvs"]["python"]["useBuiltinEnv"] = True
1040+
else:
1041+
self.settings["settings"]["codeEnvs"]["python"]["useBuiltinEnv"] = False
1042+
self.settings["settings"]["codeEnvs"]["python"]["envName"] = code_env_name
1043+
1044+
def set_r_code_env(self, code_env_name):
1045+
"""Sets the default R code env used by this project
1046+
1047+
:param str code_env_name: Identifier of the code env to use. If None, sets the project to use the builtin R env
1048+
"""
1049+
if code_env_name is None:
1050+
self.settings["settings"]["codeEnvs"]["r"]["useBuiltinEnv"] = True
1051+
else:
1052+
self.settings["settings"]["codeEnvs"]["r"]["useBuiltinEnv"] = False
1053+
self.settings["settings"]["codeEnvs"]["r"]["envName"] = code_env_name
1054+
1055+
def set_container_exec_config(self, config_name):
1056+
"""Sets the default containerized execution config used by this project
1057+
1058+
:param str config_name: Identifier of the containerized execution config to use. If None, sets the project to use local execution
1059+
"""
1060+
if config_name is None:
1061+
self.settings["settings"]["container"]["containerMode"] = "NONE"
1062+
else:
1063+
self.settings["settings"]["container"]["containerMode"] = "EXPLICIT_CONTAINER"
1064+
self.settings["settings"]["container"]["containerConf"] = config_name
1065+
1066+
def set_k8s_cluster(self, cluster, fallback_cluster=None):
1067+
"""Sets the Kubernetes cluster used by this project
1068+
1069+
:param str cluster: Identifier of the cluster to use. May use variables expansion. If None, sets the project
1070+
to use the globally-defined cluster
1071+
:param str fallback_cluster: Identifier of the cluster to use if the variable used for "cluster" does not exist
1072+
"""
1073+
if cluster is None:
1074+
self.settings["settings"]["k8sCluster"]["clusterMode"] = "INHERIT"
1075+
else:
1076+
self.settings["settings"]["k8sCluster"]["clusterMode"] = "EXPLICIT_CLUSTER"
1077+
self.settings["settings"]["k8sCluster"]["clusterId"] = cluster
1078+
self.settings["settings"]["k8sCluster"]["defaultClusterId"] = fallback_cluster
1079+
10331080
def set_cluster(self, cluster, fallback_cluster=None):
10341081
"""Sets the Hadoop/Spark cluster used by this project
10351082

0 commit comments

Comments
 (0)