map = new HashMap<>();
- map.putAll(runSpec.toMap());
- taskSpec.toMap().forEach(map::putIfAbsent);
-
- MlrunRunSpec mlrunSpec = new MlrunRunSpec(map);
- //ensure function is not modified
- mlrunSpec.setFunctionSpec(functionSpec);
-
- return mlrunSpec;
- }
-
- private String createTargetImage(String name, String id) {
- return (StringUtils.hasText(imageRegistry) ? imageRegistry + "/" : "") + imagePrefix + "-" + name + ":" + id;
- }
-
- @Override
- public K8sJobRunnable run(Run run) {
- //check run kind
- if (!MlrunRunSpec.KIND.equals(run.getKind())) {
- throw new IllegalArgumentException(
- "Run kind {} unsupported, expecting {}".formatted(String.valueOf(run.getKind()), MlrunRunSpec.KIND)
- );
- }
-
- // Create spec for run
- MlrunRunSpec runSpec = new MlrunRunSpec(run.getSpec());
-
- // Create string run accessor from task
- RunSpecAccessor runAccessor = RunUtils.parseTask(runSpec.getTask());
-
- return switch (runAccessor.getTask()) {
- case MlrunJobTaskSpec.KIND -> {
- MlrunJobTaskSpec taskSpec = runSpec.getJobSpec();
- if (taskSpec == null) {
- throw new CoreRuntimeException("null or empty task definition");
- }
-
- yield new MlrunJobRunner(image, secretService.groupSecrets(run.getProject(), taskSpec.getSecrets()))
- .produce(run);
- }
- case MlrunBuildTaskSpec.KIND -> {
- MlrunBuildTaskSpec taskSpec = runSpec.getBuildSpec();
- TaskSpecAccessor accessor = TaskUtils.parseFunction(taskSpec.getFunction());
- taskSpec.setTargetImage(createTargetImage(accessor.getFunction(), accessor.getVersion()));
-
- if (taskSpec == null) {
- throw new CoreRuntimeException("null or empty task definition");
- }
-
- yield new MlrunBuildRunner(image, secretService.groupSecrets(run.getProject(), taskSpec.getSecrets()))
- .produce(run);
- }
- default -> throw new IllegalArgumentException("Kind not recognized. Cannot retrieve the right Runner");
- };
- }
-}
diff --git a/modules/runtime-mlrun/src/main/java/it/smartcommunitylabdhub/runtime/mlrun/runners/MlrunBuildRunner.java b/modules/runtime-mlrun/src/main/java/it/smartcommunitylabdhub/runtime/mlrun/runners/MlrunBuildRunner.java
deleted file mode 100644
index aba55eea..00000000
--- a/modules/runtime-mlrun/src/main/java/it/smartcommunitylabdhub/runtime/mlrun/runners/MlrunBuildRunner.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package it.smartcommunitylabdhub.runtime.mlrun.runners;
-
-import it.smartcommunitylabdhub.commons.exceptions.CoreRuntimeException;
-import it.smartcommunitylabdhub.commons.infrastructure.Runner;
-import it.smartcommunitylabdhub.commons.models.entities.run.Run;
-import it.smartcommunitylabdhub.commons.models.enums.State;
-import it.smartcommunitylabdhub.framework.k8s.objects.CoreEnv;
-import it.smartcommunitylabdhub.framework.k8s.runnables.K8sJobRunnable;
-import it.smartcommunitylabdhub.runtime.mlrun.MlrunRuntime;
-import it.smartcommunitylabdhub.runtime.mlrun.specs.MlrunBuildTaskSpec;
-import it.smartcommunitylabdhub.runtime.mlrun.specs.MlrunRunSpec;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
-
-/**
- * MlrunMlrunRunner
- *
- * You can use this as a simple class or as a registered bean. If you want to retrieve this as bean from RunnerFactory
- * you have to register it using the following annotation:
- *
- * @RunnerComponent(runtime = "mlrun", task = "build")
- */
-public class MlrunBuildRunner implements Runner {
-
- private final String image;
- private final Map> groupedSecrets;
-
- public MlrunBuildRunner(String image, Map> groupedSecrets) {
- this.image = image;
- this.groupedSecrets = groupedSecrets;
- }
-
- @Override
- public K8sJobRunnable produce(Run run) {
- // Retrieve information about RunMlrunSpec
- MlrunRunSpec runSpec = new MlrunRunSpec(run.getSpec());
- MlrunBuildTaskSpec taskSpec = runSpec.getBuildSpec();
- if (taskSpec == null) {
- throw new CoreRuntimeException("null or empty task definition");
- }
-
- List coreEnvList = new ArrayList<>(
- List.of(new CoreEnv("PROJECT_NAME", run.getProject()), new CoreEnv("RUN_ID", run.getId()))
- );
-
- Optional.ofNullable(taskSpec.getEnvs()).ifPresent(coreEnvList::addAll);
-
- //TODO: Create runnable using information from Run completed spec.
- K8sJobRunnable k8sJobRunnable = K8sJobRunnable
- .builder()
- .runtime(MlrunRuntime.RUNTIME)
- .task(MlrunBuildTaskSpec.KIND)
- .image(image)
- .command("python")
- .args(List.of("wrapper.py").toArray(String[]::new))
- .resources(taskSpec.getResources())
- .nodeSelector(taskSpec.getNodeSelector())
- .volumes(taskSpec.getVolumes())
- .secrets(groupedSecrets)
- .envs(coreEnvList)
- .affinity(taskSpec.getAffinity())
- .tolerations(taskSpec.getTolerations())
- .state(State.READY.name())
- .build();
-
- k8sJobRunnable.setId(run.getId());
- k8sJobRunnable.setProject(run.getProject());
-
- return k8sJobRunnable;
- }
-}
diff --git a/modules/runtime-mlrun/src/main/java/it/smartcommunitylabdhub/runtime/mlrun/runners/MlrunJobRunner.java b/modules/runtime-mlrun/src/main/java/it/smartcommunitylabdhub/runtime/mlrun/runners/MlrunJobRunner.java
deleted file mode 100644
index 002255d8..00000000
--- a/modules/runtime-mlrun/src/main/java/it/smartcommunitylabdhub/runtime/mlrun/runners/MlrunJobRunner.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package it.smartcommunitylabdhub.runtime.mlrun.runners;
-
-import it.smartcommunitylabdhub.commons.exceptions.CoreRuntimeException;
-import it.smartcommunitylabdhub.commons.infrastructure.Runner;
-import it.smartcommunitylabdhub.commons.models.entities.run.Run;
-import it.smartcommunitylabdhub.commons.models.enums.State;
-import it.smartcommunitylabdhub.framework.k8s.objects.CoreEnv;
-import it.smartcommunitylabdhub.framework.k8s.runnables.K8sJobRunnable;
-import it.smartcommunitylabdhub.runtime.mlrun.MlrunRuntime;
-import it.smartcommunitylabdhub.runtime.mlrun.specs.MlrunJobTaskSpec;
-import it.smartcommunitylabdhub.runtime.mlrun.specs.MlrunRunSpec;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
-
-/**
- * MlrunMlrunRunner
- *
- * You can use this as a simple class or as a registered bean. If you want to retrieve this as bean from RunnerFactory
- * you have to register it using the following annotation:
- *
- * @RunnerComponent(runtime = "mlrun", task = "job")
- */
-public class MlrunJobRunner implements Runner {
-
- private final String image;
- private final Map> groupedSecrets;
-
- public MlrunJobRunner(String image, Map> groupedSecrets) {
- this.image = image;
- this.groupedSecrets = groupedSecrets;
- }
-
- @Override
- public K8sJobRunnable produce(Run run) {
- // Retrieve information about RunMlrunSpec
- MlrunRunSpec runSpec = new MlrunRunSpec(run.getSpec());
- MlrunJobTaskSpec taskSpec = runSpec.getJobSpec();
- if (taskSpec == null) {
- throw new CoreRuntimeException("null or empty task definition");
- }
-
- List coreEnvList = new ArrayList<>(
- List.of(new CoreEnv("PROJECT_NAME", run.getProject()), new CoreEnv("RUN_ID", run.getId()))
- );
-
- Optional.ofNullable(taskSpec.getEnvs()).ifPresent(coreEnvList::addAll);
-
- //TODO: Create runnable using information from Run completed spec.
- K8sJobRunnable k8sJobRunnable = K8sJobRunnable
- .builder()
- .runtime(MlrunRuntime.RUNTIME)
- .task(MlrunJobTaskSpec.KIND)
- .image(image)
- .command("python")
- .args(List.of("wrapper.py").toArray(String[]::new))
- .resources(taskSpec.getResources())
- .nodeSelector(taskSpec.getNodeSelector())
- .volumes(taskSpec.getVolumes())
- .secrets(groupedSecrets)
- .envs(coreEnvList)
- .affinity(taskSpec.getAffinity())
- .tolerations(taskSpec.getTolerations())
- .state(State.READY.name())
- .build();
-
- k8sJobRunnable.setId(run.getId());
- k8sJobRunnable.setProject(run.getProject());
-
- return k8sJobRunnable;
- }
-}
diff --git a/modules/runtime-mlrun/src/main/java/it/smartcommunitylabdhub/runtime/mlrun/specs/MlrunBuildTaskSpec.java b/modules/runtime-mlrun/src/main/java/it/smartcommunitylabdhub/runtime/mlrun/specs/MlrunBuildTaskSpec.java
deleted file mode 100644
index f38609c9..00000000
--- a/modules/runtime-mlrun/src/main/java/it/smartcommunitylabdhub/runtime/mlrun/specs/MlrunBuildTaskSpec.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package it.smartcommunitylabdhub.runtime.mlrun.specs;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import it.smartcommunitylabdhub.commons.annotations.common.SpecType;
-import it.smartcommunitylabdhub.commons.models.enums.EntityName;
-import it.smartcommunitylabdhub.framework.k8s.base.K8sTaskBaseSpec;
-import it.smartcommunitylabdhub.runtime.mlrun.MlrunRuntime;
-import java.io.Serializable;
-import java.util.List;
-import java.util.Map;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
-@Getter
-@Setter
-@NoArgsConstructor
-@SpecType(runtime = MlrunRuntime.RUNTIME, kind = MlrunBuildTaskSpec.KIND, entity = EntityName.TASK)
-public class MlrunBuildTaskSpec extends K8sTaskBaseSpec {
-
- public static final String KIND = "mlrun+build";
-
- private List commands;
-
- @JsonProperty("force_build")
- private Boolean forceBuild;
-
- @JsonProperty("target_image")
- private String targetImage;
-
- public MlrunBuildTaskSpec(Map data) {
- configure(data);
- }
-
- @Override
- public void configure(Map data) {
- super.configure(data);
-
- MlrunBuildTaskSpec spec = mapper.convertValue(data, MlrunBuildTaskSpec.class);
-
- this.commands = spec.getCommands();
- this.forceBuild = spec.getForceBuild();
- this.targetImage = spec.getTargetImage();
- }
-}
diff --git a/modules/runtime-mlrun/src/main/java/it/smartcommunitylabdhub/runtime/mlrun/specs/MlrunFunctionSpec.java b/modules/runtime-mlrun/src/main/java/it/smartcommunitylabdhub/runtime/mlrun/specs/MlrunFunctionSpec.java
deleted file mode 100644
index c412002f..00000000
--- a/modules/runtime-mlrun/src/main/java/it/smartcommunitylabdhub/runtime/mlrun/specs/MlrunFunctionSpec.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package it.smartcommunitylabdhub.runtime.mlrun.specs;
-
-import io.swagger.v3.oas.annotations.media.Schema;
-import it.smartcommunitylabdhub.commons.annotations.common.SpecType;
-import it.smartcommunitylabdhub.commons.models.entities.function.FunctionBaseSpec;
-import it.smartcommunitylabdhub.commons.models.enums.EntityName;
-import it.smartcommunitylabdhub.commons.models.objects.SourceCode;
-import it.smartcommunitylabdhub.runtime.mlrun.MlrunRuntime;
-import jakarta.validation.constraints.NotNull;
-import java.io.Serializable;
-import java.util.List;
-import java.util.Map;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
-@Getter
-@Setter
-@NoArgsConstructor
-@SpecType(runtime = MlrunRuntime.RUNTIME, kind = MlrunRuntime.RUNTIME, entity = EntityName.FUNCTION)
-public class MlrunFunctionSpec extends FunctionBaseSpec {
-
- @NotNull
- @Schema(title = "fields.sourceCode.title", description = "fields.sourceCode.description")
- private SourceCode source;
-
- @Schema(title = "fields.container.image.title", description = "fields.container.image.description")
- private String image;
-
- @Schema(title = "fields.container.tag.title", description = "fields.container.tag.description")
- private String tag;
-
- @Schema(title = "fields.sourceCode.handler.title", description = "fields.sourceCode.handler.description")
- private String handler;
-
- @Schema(title = "fields.container.command.title", description = "fields.container.command.description")
- private String command;
-
- @Schema(title = "fields.python.requirements.title", description = "fields.python.requirements.description")
- private List requirements;
-
- public MlrunFunctionSpec(Map data) {
- configure(data);
- }
-
- @Override
- public void configure(Map data) {
- super.configure(data);
-
- MlrunFunctionSpec spec = mapper.convertValue(data, MlrunFunctionSpec.class);
-
- this.source = spec.getSource();
- this.image = spec.getImage();
- this.tag = spec.getTag();
- this.handler = spec.getHandler();
- this.command = spec.getCommand();
- this.requirements = spec.getRequirements();
- }
-
- public enum MlrunSourceCodeLanguages {
- python,
- }
-}
diff --git a/modules/runtime-mlrun/src/main/java/it/smartcommunitylabdhub/runtime/mlrun/specs/MlrunJobTaskSpec.java b/modules/runtime-mlrun/src/main/java/it/smartcommunitylabdhub/runtime/mlrun/specs/MlrunJobTaskSpec.java
deleted file mode 100644
index 8328f03b..00000000
--- a/modules/runtime-mlrun/src/main/java/it/smartcommunitylabdhub/runtime/mlrun/specs/MlrunJobTaskSpec.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package it.smartcommunitylabdhub.runtime.mlrun.specs;
-
-import it.smartcommunitylabdhub.commons.annotations.common.SpecType;
-import it.smartcommunitylabdhub.commons.models.enums.EntityName;
-import it.smartcommunitylabdhub.framework.k8s.base.K8sTaskBaseSpec;
-import it.smartcommunitylabdhub.runtime.mlrun.MlrunRuntime;
-import java.io.Serializable;
-import java.util.Map;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
-@Getter
-@Setter
-@NoArgsConstructor
-@SpecType(runtime = MlrunRuntime.RUNTIME, kind = MlrunJobTaskSpec.KIND, entity = EntityName.TASK)
-public class MlrunJobTaskSpec extends K8sTaskBaseSpec {
-
- public static final String KIND = "mlrun+job";
-
- public MlrunJobTaskSpec(Map data) {
- configure(data);
- }
-
- @Override
- public void configure(Map data) {
- super.configure(data);
-
- MlrunJobTaskSpec spec = mapper.convertValue(data, MlrunJobTaskSpec.class);
- }
-}
diff --git a/modules/runtime-mlrun/src/main/java/it/smartcommunitylabdhub/runtime/mlrun/specs/MlrunRunSpec.java b/modules/runtime-mlrun/src/main/java/it/smartcommunitylabdhub/runtime/mlrun/specs/MlrunRunSpec.java
deleted file mode 100644
index 71d32cbb..00000000
--- a/modules/runtime-mlrun/src/main/java/it/smartcommunitylabdhub/runtime/mlrun/specs/MlrunRunSpec.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package it.smartcommunitylabdhub.runtime.mlrun.specs;
-
-import com.fasterxml.jackson.annotation.JsonUnwrapped;
-import it.smartcommunitylabdhub.commons.annotations.common.SpecType;
-import it.smartcommunitylabdhub.commons.jackson.annotations.JsonSchemaIgnore;
-import it.smartcommunitylabdhub.commons.models.entities.run.RunBaseSpec;
-import it.smartcommunitylabdhub.commons.models.enums.EntityName;
-import it.smartcommunitylabdhub.runtime.mlrun.MlrunRuntime;
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
-@Getter
-@Setter
-@NoArgsConstructor
-@SpecType(runtime = MlrunRuntime.RUNTIME, kind = MlrunRunSpec.KIND, entity = EntityName.RUN)
-public class MlrunRunSpec extends RunBaseSpec {
-
- public static final String KIND = MlrunRuntime.RUNTIME + "+run";
-
- private Map inputs = new HashMap<>();
-
- private Map outputs = new HashMap<>();
-
- private Map parameters = new HashMap<>();
-
- // @JsonProperty("job_spec")
- @JsonUnwrapped
- private MlrunJobTaskSpec jobSpec;
-
- // @JsonProperty("build_spec")
- @JsonUnwrapped
- private MlrunBuildTaskSpec buildSpec;
-
- // @JsonProperty("function_spec")
- @JsonSchemaIgnore
- @JsonUnwrapped
- private MlrunFunctionSpec functionSpec;
-
- public MlrunRunSpec(Map data) {
- configure(data);
- }
-
- @Override
- public void configure(Map data) {
- super.configure(data);
-
- MlrunRunSpec spec = mapper.convertValue(data, MlrunRunSpec.class);
- this.inputs = spec.getInputs();
- this.outputs = spec.getOutputs();
- this.parameters = spec.getParameters();
-
- this.jobSpec = spec.getJobSpec();
- this.buildSpec = spec.getBuildSpec();
- this.functionSpec = spec.getFunctionSpec();
- }
-
- public void setJobSpec(MlrunJobTaskSpec jobSpec) {
- this.jobSpec = jobSpec;
- }
-
- public void setBuildSpec(MlrunBuildTaskSpec buildSpec) {
- this.buildSpec = buildSpec;
- }
-
- public void setFunctionSpec(MlrunFunctionSpec funcSpec) {
- this.functionSpec = funcSpec;
- }
-}
diff --git a/modules/runtime-mlrun/src/main/java/it/smartcommunitylabdhub/runtime/mlrun/status/RunMlrunStatus.java b/modules/runtime-mlrun/src/main/java/it/smartcommunitylabdhub/runtime/mlrun/status/RunMlrunStatus.java
deleted file mode 100644
index 6dfaf00a..00000000
--- a/modules/runtime-mlrun/src/main/java/it/smartcommunitylabdhub/runtime/mlrun/status/RunMlrunStatus.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package it.smartcommunitylabdhub.runtime.mlrun.status;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import it.smartcommunitylabdhub.commons.models.entities.run.RunBaseStatus;
-import java.io.Serializable;
-import java.util.Map;
-import lombok.Getter;
-import lombok.Setter;
-
-@Getter
-@Setter
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class RunMlrunStatus extends RunBaseStatus {
-
- @Override
- public void configure(Map data) {
- super.configure(data);
- }
-}
diff --git a/pom.xml b/pom.xml
index fe53e19b..bd6a7676 100644
--- a/pom.xml
+++ b/pom.xml
@@ -34,7 +34,6 @@
modules/runtime-container
modules/runtime-dbt
modules/runtime-nefertem
- modules/runtime-mlrun
modules/runtime-kfp
modules/runtime-python
modules/runtime-model-serve