Workflow#
The workflow component is responsible for converting a Gordo config into an Argo workflow which then runs the various components in order to build and serve the ML models.
Normalized Config#
- class gordo.workflow.config_elements.normalized_config.NormalizedConfig(config: dict, project_name: str, gordo_version: str | None = None, model_builder_env: dict | None = None, back_compatibles: dict[tuple[Optional[str], str], tuple[Optional[str], str]] | None = None, default_data_provider: str | None = None, json_path: str | None = None)[source]#
Bases:
objectHandles the conversion of a single Machine representation in config format and updates it with any features which are ‘left out’ inside of
globalskey or the default config globals held here.- DEFAULT_CONFIG_GLOBALS: GlobalsConfig = {'evaluation': {'cv_mode': 'full_build', 'metrics': ['explained_variance_score', 'r2_score', 'mean_squared_error', 'mean_absolute_error'], 'scoring_scaler': 'sklearn.preprocessing.MinMaxScaler'}, 'runtime': {'builder': {'remote_logging': {'enable': False}, 'resources': {'limits': {'cpu': 1001, 'memory': 31200}, 'requests': {'cpu': 1001, 'memory': 3900}}}, 'client': {'max_instances': 30, 'resources': {'limits': {'cpu': 2000, 'memory': 4000}, 'requests': {'cpu': 100, 'memory': 3500}}}, 'influx': {'enable': True}, 'prometheus_metrics_server': {'resources': {'limits': {'cpu': 200, 'memory': 1000}, 'requests': {'cpu': 100, 'memory': 200}}}, 'reporters': [], 'server': {'resources': {'limits': {'cpu': 2000, 'memory': 6000}, 'requests': {'cpu': 1000, 'memory': 3000}}}}}#
- SPLITED_DOCKER_IMAGES: GlobalsConfig = {'runtime': {'builder': {'image': 'gordo-model-builder'}, 'client': {'image': 'gordo-client'}, 'deployer': {'image': 'gordo-deploy'}, 'prometheus_metrics_server': {'image': 'gordo-model-server'}, 'server': {'image': 'gordo-model-server'}}}#
- UNIFIED_DOCKER_IMAGES: GlobalsConfig = {'runtime': {'builder': {'image': 'gordo-base'}, 'client': {'image': 'gordo-base'}, 'deployer': {'image': 'gordo-base'}, 'prometheus_metrics_server': {'image': 'gordo-base'}, 'server': {'image': 'gordo-base'}}}#
- classmethod get_default_globals(gordo_version: str) GlobalsConfig[source]#
- classmethod prepare_patched_globals(patched_globals: GlobalsConfig) GlobalsConfig[source]#
Workflow Generator#
Workflow loading/processing functionality to help the CLI ‘workflow’ sub-command.
- gordo.workflow.workflow_generator.workflow_generator.default_image_pull_policy(gordo_version: Version) str[source]#
- gordo.workflow.workflow_generator.workflow_generator.get_dict_from_yaml(config_file: str | StringIO) dict[source]#
Read a config file or file like object of YAML into a dict
Schemas#
- class gordo.workflow.config_elements.schemas.BuilderPodRuntime(*, image: str, resources: ResourceRequirements | None = None, metadata: ObjectMeta | None = None, env: List[EnvVar] | None = None, volumeMounts: List[VolumeMount] | None = None, remote_logging: RemoteLogging)[source]#
Bases:
PodRuntimeCreate a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- remote_logging: RemoteLogging#
- class gordo.workflow.config_elements.schemas.CSIVolumeSource(*, driver: str, readOnly: bool = False, fsType: str | None = None, volumeAttributes: Dict[str, Any] | None = None)[source]#
Bases:
BaseModelCreate a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- class gordo.workflow.config_elements.schemas.Capabilities(*, add: List[str] | None = None, drop: List[str] | None = None)[source]#
Bases:
ModelCreate a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- class gordo.workflow.config_elements.schemas.ConfigMapKeySelector(*, key: str, value: str)[source]#
Bases:
BaseModelCreate a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- class gordo.workflow.config_elements.schemas.EnvVar(*, name: str, value: str | None = None, valueFrom: EnvVarSource | None = None)[source]#
Bases:
BaseModelCreate a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- valueFrom: EnvVarSource | None#
- class gordo.workflow.config_elements.schemas.EnvVarSource(*, configMapKeyRef: ConfigMapKeySelector | None = None, secretKeyRef: SecretKeySelector | None = None)[source]#
Bases:
BaseModelCreate a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- configMapKeyRef: ConfigMapKeySelector | None#
- secretKeyRef: SecretKeySelector | None#
- class gordo.workflow.config_elements.schemas.Model[source]#
Bases:
BaseModelCreate a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- class gordo.workflow.config_elements.schemas.ObjectMeta(*, labels: Dict[str, Any] | None = None)[source]#
Bases:
BaseModelCreate a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- class gordo.workflow.config_elements.schemas.PodRuntime(*, image: str, resources: ResourceRequirements | None = None, metadata: ObjectMeta | None = None, env: List[EnvVar] | None = None, volumeMounts: List[VolumeMount] | None = None)[source]#
Bases:
BaseModelCreate a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- metadata: ObjectMeta | None#
- resources: ResourceRequirements | None#
- volumeMounts: List[VolumeMount] | None#
- class gordo.workflow.config_elements.schemas.PodSecurityContext(*, fsGroup: int | None = None, fsGroupChangePolicy: str | None = None, runAsGroup: int | None = None, runAsNonRoot: bool | None = None, runAsUser: int | None = None, seLinuxOptions: SELinuxOptions | None = None, seccompProfile: SeccompProfile | None = None, supplementalGroups: List[int] | None = None, sysctls: List[Sysctl] | None = None, windowsOptions: WindowsSecurityContextOptions | None = None)[source]#
Bases:
ModelCreate a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- seLinuxOptions: SELinuxOptions | None#
- seccompProfile: SeccompProfile | None#
- windowsOptions: WindowsSecurityContextOptions | None#
- class gordo.workflow.config_elements.schemas.RemoteLogging(*, enable: bool = False)[source]#
Bases:
BaseModelCreate a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- class gordo.workflow.config_elements.schemas.ResourceRequirements(*, requests: Dict[str, Any] | None = None, limits: Dict[str, Any] | None = None)[source]#
Bases:
BaseModelCreate a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- class gordo.workflow.config_elements.schemas.SELinuxOptions(*, level: str | None = None, role: str | None = None, type: str | None = None, user: str | None = None)[source]#
Bases:
ModelCreate a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- class gordo.workflow.config_elements.schemas.SeccompProfile(*, localhostProfile: str | None = None, type: str | None = None)[source]#
Bases:
ModelCreate a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- class gordo.workflow.config_elements.schemas.SecretKeySelector(*, key: str, name: str)[source]#
Bases:
BaseModelCreate a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- class gordo.workflow.config_elements.schemas.SecurityContext(*, allowPrivilegeEscalation: bool | None = None, capabilities: Capabilities | None = None, privileged: bool | None = None, procMount: str | None = None, readOnlyRootFilesystem: bool | None = None, runAsNonRoot: bool | None = None, runAsGroup: bool | None = None, runAsUser: int | None = None, seLinuxOptions: SELinuxOptions | None = None, seccompProfile: SeccompProfile | None = None, windowsOptions: WindowsSecurityContextOptions | None = None)[source]#
Bases:
ModelCreate a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- capabilities: Capabilities | None#
- seLinuxOptions: SELinuxOptions | None#
- seccompProfile: SeccompProfile | None#
- windowsOptions: WindowsSecurityContextOptions | None#
- class gordo.workflow.config_elements.schemas.Sysctl(*, name: str, value: str)[source]#
Bases:
ModelCreate a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- class gordo.workflow.config_elements.schemas.Volume(*, name: str, csi: CSIVolumeSource | None = None)[source]#
Bases:
BaseModelCreate a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- csi: CSIVolumeSource | None#
- class gordo.workflow.config_elements.schemas.VolumeMount(*, name: str, readOnly: bool | None = None, mountPath: str)[source]#
Bases:
BaseModelCreate a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- class gordo.workflow.config_elements.schemas.WindowsSecurityContextOptions(*, gmsaCredentialSpec: str | None = None, gmsaCredentialSpecName: str | None = None, runAsUserName: str | None = None)[source]#
Bases:
ModelCreate a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
Helpers#
- gordo.workflow.workflow_generator.helpers.determine_argo_version(argo_binary: str = 'argo') str[source]#
Check installed Argo CLI version.
- Raises:
ArgoVersionError – If something went wrong.
- Return type:
Version of installed argo version.
- gordo.workflow.workflow_generator.helpers.parse_argo_version(argo_version: str) Version | None[source]#
Try to parse Argo version.
- Parameters:
argo_version –
- Return type:
None if failed to parse.
- gordo.workflow.workflow_generator.helpers.patch_dict(original_dict: dict, patch_dictionary: dict) dict[source]#
Patches a dict with another. Patching means that any path defines in the patch is either added (if it does not exist), or replaces the existing value (if it exists). Nothing is removed from the original dict, only added/replaced.
- Parameters:
original_dict – Base dictionary which will get paths added/changed
patch_dictionary – Dictionary which will be overlaid on top of original_dict
Examples
>>> patch_dict({"highKey":{"lowkey1":1, "lowkey2":2}}, {"highKey":{"lowkey1":10}}) {'highKey': {'lowkey1': 10, 'lowkey2': 2}} >>> patch_dict({"highKey":{"lowkey1":1, "lowkey2":2}}, {"highKey":{"lowkey3":3}}) {'highKey': {'lowkey1': 1, 'lowkey2': 2, 'lowkey3': 3}} >>> patch_dict({"highKey":{"lowkey1":1, "lowkey2":2}}, {"highKey2":4}) {'highKey': {'lowkey1': 1, 'lowkey2': 2}, 'highKey2': 4}
- Returns:
A new dictionary which is the result of overlaying patch_dictionary on top of
original_dict