diff --git a/projects/control-service/projects/pipelines_control_service/src/main/java/com/vmware/taurus/service/deploy/SupportedPythonVersions.java b/projects/control-service/projects/pipelines_control_service/src/main/java/com/vmware/taurus/service/deploy/SupportedPythonVersions.java index 8b1727e82e..ae49f5ece0 100644 --- a/projects/control-service/projects/pipelines_control_service/src/main/java/com/vmware/taurus/service/deploy/SupportedPythonVersions.java +++ b/projects/control-service/projects/pipelines_control_service/src/main/java/com/vmware/taurus/service/deploy/SupportedPythonVersions.java @@ -5,7 +5,7 @@ package com.vmware.taurus.service.deploy; -import java.util.HashMap; +import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -14,14 +14,19 @@ import org.springframework.stereotype.Component; import lombok.extern.slf4j.Slf4j; -/** Handles operations related to supported python versions for data job deployments. */ +/** + * Handles operations related to supported python versions for data job deployments. + * The class contains utility methods which provide functionality to read the configuration + * related to the python versions supported by the Control Service. + * These utility methods are meant to be used in other components, as needed. + * */ @Component @RequiredArgsConstructor @Slf4j public class SupportedPythonVersions { @Value("#{${datajobs.deployment.supportedPythonVersions}}") - private HashMap> supportedPythonVersions; + private Map> supportedPythonVersions; @Value("${datajobs.vdk.image}") private String vdkImage; @@ -36,12 +41,12 @@ public class SupportedPythonVersions { /** * Check if the python_version passed by the user is supported by the Control Service. * - * @param python_version python version passed by the user. + * @param pythonVersion python version passed by the user. * @return true if the version is supported, and false otherwise. */ - public boolean isPythonVersionSupported(String python_version) { + public boolean isPythonVersionSupported(String pythonVersion) { if (!supportedPythonVersions.isEmpty()) { - return supportedPythonVersions.containsKey(python_version); + return supportedPythonVersions.containsKey(pythonVersion); } else { return false; } @@ -72,12 +77,12 @@ public String getSupportedPythonVersions() { * according to the configuration, the base image corresponding to the python_version is returned. * Otherwise, the default base image name as set in deploymentDataJobBaseImage is returned. * - * @param python_version a string indicating the python version passed by the user + * @param pythonVersion a string indicating the python version passed by the user * @return a string of the data job base image. */ - public String getJobBaseImage(String python_version) { - if (!supportedPythonVersions.isEmpty() && isPythonVersionSupported(python_version)) { - return supportedPythonVersions.get(python_version).get(BASE_IMAGE); + public String getJobBaseImage(String pythonVersion) { + if (!supportedPythonVersions.isEmpty() && isPythonVersionSupported(pythonVersion)) { + return supportedPythonVersions.get(pythonVersion).get(BASE_IMAGE); } else { return deploymentDataJobBaseImage; } @@ -93,12 +98,12 @@ public String getDefaultJobBaseImage() { * configuration, the vdk image corresponding to the python_version is returned. Otherwise, the * default vdk image name as set in vdkImage is returned. * - * @param python_version a string indicating the python version passed by the user + * @param pythonVersion a string indicating the python version passed by the user * @return a string of the data job base image. */ - public String getVdkImage(String python_version) { - if (!supportedPythonVersions.isEmpty() && isPythonVersionSupported(python_version)) { - return supportedPythonVersions.get(python_version).get(VDK_IMAGE); + public String getVdkImage(String pythonVersion) { + if (!supportedPythonVersions.isEmpty() && isPythonVersionSupported(pythonVersion)) { + return supportedPythonVersions.get(pythonVersion).get(VDK_IMAGE); } else { return vdkImage; } diff --git a/projects/control-service/projects/pipelines_control_service/src/main/resources/application-prod.properties b/projects/control-service/projects/pipelines_control_service/src/main/resources/application-prod.properties index b035da53ee..d952604590 100644 --- a/projects/control-service/projects/pipelines_control_service/src/main/resources/application-prod.properties +++ b/projects/control-service/projects/pipelines_control_service/src/main/resources/application-prod.properties @@ -58,7 +58,6 @@ datajobs.kadmin_password=${KADMIN_PASSWORD} # This is the full image name of the data job builder datajobs.builder.image=registry.hub.docker.com/versatiledatakit/job-builder:1.1 datajobs.deployment.dataJobBaseImage=registry.hub.docker.com/versatiledatakit/data-job-base-python-3.7:latest -datajobs.deployment.supportedPythonVersions=${DATAJOBS_DEPLOYMENT_SUPPORTED_PYTHON_VERSIONS:{}} # Path to an ini config file that contains vdk runtime options datajobs.vdk_options_ini=${VDK_OPTIONS_INI} diff --git a/projects/control-service/projects/pipelines_control_service/src/main/resources/application.properties b/projects/control-service/projects/pipelines_control_service/src/main/resources/application.properties index a792b89528..41f7737d88 100644 --- a/projects/control-service/projects/pipelines_control_service/src/main/resources/application.properties +++ b/projects/control-service/projects/pipelines_control_service/src/main/resources/application.properties @@ -126,7 +126,7 @@ datajobs.deployment.dataJobBaseImage=python:3.9-slim # The map of python version and respective data job base and vdk images that would be # used for data job deployments -datajobs.deployment.supportedPythonVersions={} +datajobs.deployment.supportedPythonVersions=${DATAJOBS_DEPLOYMENT_SUPPORTED_PYTHON_VERSIONS:{}} #Configuration variables used for data job execution cleanup #This is a spring cron expression, used to schedule the clean up job / default is every 3 hours