-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
wangqi
committed
Jan 24, 2025
1 parent
0104845
commit 8dd1c8c
Showing
22 changed files
with
859 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
.../java/cn/sliew/carp/module/orca/core/persistence/sql/service/CarpOrcaPipelineService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package cn.sliew.carp.module.orca.core.persistence.sql.service; | ||
|
||
import cn.sliew.carp.module.orca.spinnaker.api.model.ExecutionType; | ||
import cn.sliew.carp.module.orca.spinnaker.api.model.pipeline.PipelineExecution; | ||
|
||
public interface CarpOrcaPipelineService { | ||
|
||
PipelineExecution get(ExecutionType type, Long id); | ||
} |
78 changes: 78 additions & 0 deletions
78
...rp/module/orca/core/persistence/sql/service/convert/CarpDagOrcaPipelineConfigConvert.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package cn.sliew.carp.module.orca.core.persistence.sql.service.convert; | ||
|
||
import cn.sliew.carp.framework.common.convert.BaseConvert; | ||
import cn.sliew.carp.framework.dag.algorithm.DAG; | ||
import cn.sliew.carp.framework.dag.service.dto.DagConfigComplexDTO; | ||
import cn.sliew.carp.framework.dag.service.dto.DagConfigLinkDTO; | ||
import cn.sliew.carp.framework.dag.service.dto.DagConfigStepDTO; | ||
import cn.sliew.carp.module.orca.core.persistence.sql.service.dto.CarpDagOrcaPipelineConfigDTO; | ||
import cn.sliew.carp.module.orca.core.persistence.sql.service.dto.CarpDagOrcaPipelineStageConfigDTO; | ||
import cn.sliew.milky.common.util.JacksonUtil; | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.ReportingPolicy; | ||
import org.mapstruct.factory.Mappers; | ||
import org.springframework.beans.BeanUtils; | ||
import org.springframework.util.CollectionUtils; | ||
|
||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE) | ||
public interface CarpDagOrcaPipelineConfigConvert extends BaseConvert<DagConfigComplexDTO, CarpDagOrcaPipelineConfigDTO> { | ||
CarpDagOrcaPipelineConfigConvert INSTANCE = Mappers.getMapper(CarpDagOrcaPipelineConfigConvert.class); | ||
|
||
@Override | ||
default DagConfigComplexDTO toDo(CarpDagOrcaPipelineConfigDTO dto) { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
@Override | ||
default CarpDagOrcaPipelineConfigDTO toDto(DagConfigComplexDTO entity) { | ||
CarpDagOrcaPipelineConfigDTO dto = new CarpDagOrcaPipelineConfigDTO(); | ||
BeanUtils.copyProperties(entity, dto); | ||
if (entity.getDagMeta() != null) { | ||
dto.setMeta( | ||
JacksonUtil.toObject(entity.getDagMeta(), | ||
CarpDagOrcaPipelineConfigDTO.CarpDagOrcaPipelineConfigMeta.class)); | ||
} | ||
if (entity.getDagAttrs() != null) { | ||
dto.setAttrs( | ||
JacksonUtil.toObject(entity.getDagMeta(), | ||
CarpDagOrcaPipelineConfigDTO.CarpDagOrcaPipelineConfigAttrs.class)); | ||
} | ||
|
||
DAG<CarpDagOrcaPipelineStageConfigDTO> dag = new DAG<>(); | ||
List<DagConfigStepDTO> steps = entity.getSteps(); | ||
List<DagConfigLinkDTO> links = entity.getLinks(); | ||
if (CollectionUtils.isEmpty(steps) == false) { | ||
Map<String, CarpDagOrcaPipelineStageConfigDTO> stepMap = new HashMap<>(); | ||
for (DagConfigStepDTO step : steps) { | ||
CarpDagOrcaPipelineStageConfigDTO stageConfigDTO = CarpDagOrcaPipelineStageConfigConvert.INSTANCE.toDto(step); | ||
stepMap.put(stageConfigDTO.getUuid(), stageConfigDTO); | ||
dag.addNode(stageConfigDTO); | ||
} | ||
links.forEach(link -> dag.addEdge(stepMap.get(link.getFromStepId()), stepMap.get(link.getToStepId()))); | ||
} | ||
dto.setStages(dag); | ||
return dto; | ||
} | ||
|
||
} |
76 changes: 76 additions & 0 deletions
76
...iew/carp/module/orca/core/persistence/sql/service/convert/CarpDagOrcaPipelineConvert.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package cn.sliew.carp.module.orca.core.persistence.sql.service.convert; | ||
|
||
import cn.sliew.carp.framework.common.convert.BaseConvert; | ||
import cn.sliew.carp.framework.dag.algorithm.DAG; | ||
import cn.sliew.carp.framework.dag.service.dto.DagInstanceComplexDTO; | ||
import cn.sliew.carp.framework.dag.service.dto.DagLinkDTO; | ||
import cn.sliew.carp.framework.dag.service.dto.DagStepDTO; | ||
import cn.sliew.carp.module.orca.core.persistence.sql.service.dto.CarpDagOrcaPipelineDTO; | ||
import cn.sliew.carp.module.orca.core.persistence.sql.service.dto.CarpDagOrcaPipelineStageDTO; | ||
import cn.sliew.milky.common.util.JacksonUtil; | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.ReportingPolicy; | ||
import org.mapstruct.factory.Mappers; | ||
import org.springframework.beans.BeanUtils; | ||
import org.springframework.util.CollectionUtils; | ||
|
||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE) | ||
public interface CarpDagOrcaPipelineConvert extends BaseConvert<DagInstanceComplexDTO, CarpDagOrcaPipelineDTO> { | ||
CarpDagOrcaPipelineConvert INSTANCE = Mappers.getMapper(CarpDagOrcaPipelineConvert.class); | ||
|
||
@Override | ||
default DagInstanceComplexDTO toDo(CarpDagOrcaPipelineDTO dto) { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
@Override | ||
default CarpDagOrcaPipelineDTO toDto(DagInstanceComplexDTO entity) { | ||
CarpDagOrcaPipelineDTO dto = new CarpDagOrcaPipelineDTO(); | ||
BeanUtils.copyProperties(entity, dto); | ||
if (entity.getStartTime() != null) { | ||
dto.setStartTime(entity.getStartTime().toInstant()); | ||
} | ||
if (entity.getEndTime() != null) { | ||
dto.setEndTime(entity.getEndTime().toInstant()); | ||
} | ||
if (entity.getBody() != null) { | ||
dto.setBody(JacksonUtil.toObject(entity.getBody(), CarpDagOrcaPipelineDTO.CarpDagOrcaPipelineBody.class)); | ||
} | ||
DAG<CarpDagOrcaPipelineStageDTO> dag = new DAG<>(); | ||
List<DagStepDTO> steps = entity.getSteps(); | ||
List<DagLinkDTO> links = entity.getLinks(); | ||
if (CollectionUtils.isEmpty(steps) == false) { | ||
Map<String, CarpDagOrcaPipelineStageDTO> stepMap = new HashMap<>(); | ||
for (DagStepDTO step : steps) { | ||
CarpDagOrcaPipelineStageDTO stageDTO = CarpDagOrcaPipelineStageConvert.INSTANCE.toDto(step); | ||
stepMap.put(step.getDagConfigStep().getStepId(), stageDTO); | ||
dag.addNode(stageDTO); | ||
} | ||
links.forEach(link -> dag.addEdge(stepMap.get(link.getDagConfigLink().getFromStepId()), stepMap.get(link.getDagConfigLink().getToStepId()))); | ||
} | ||
dto.setStages(dag); | ||
return dto; | ||
} | ||
|
||
} |
53 changes: 53 additions & 0 deletions
53
...dule/orca/core/persistence/sql/service/convert/CarpDagOrcaPipelineStageConfigConvert.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package cn.sliew.carp.module.orca.core.persistence.sql.service.convert; | ||
|
||
import cn.sliew.carp.framework.common.convert.BaseConvert; | ||
import cn.sliew.carp.framework.dag.service.dto.DagConfigStepDTO; | ||
import cn.sliew.carp.module.orca.core.persistence.sql.service.dto.CarpDagOrcaPipelineStageConfigDTO; | ||
import cn.sliew.milky.common.util.JacksonUtil; | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.ReportingPolicy; | ||
import org.mapstruct.factory.Mappers; | ||
import org.springframework.beans.BeanUtils; | ||
|
||
@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE) | ||
public interface CarpDagOrcaPipelineStageConfigConvert extends BaseConvert<DagConfigStepDTO, CarpDagOrcaPipelineStageConfigDTO> { | ||
CarpDagOrcaPipelineStageConfigConvert INSTANCE = Mappers.getMapper(CarpDagOrcaPipelineStageConfigConvert.class); | ||
|
||
@Override | ||
default DagConfigStepDTO toDo(CarpDagOrcaPipelineStageConfigDTO dto) { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
@Override | ||
default CarpDagOrcaPipelineStageConfigDTO toDto(DagConfigStepDTO entity) { | ||
CarpDagOrcaPipelineStageConfigDTO dto = new CarpDagOrcaPipelineStageConfigDTO(); | ||
BeanUtils.copyProperties(entity, dto); | ||
dto.setUuid(entity.getStepId()); | ||
dto.setName(entity.getStepName()); | ||
if (entity.getStepMeta() != null) { | ||
dto.setMeta(JacksonUtil.toObject(entity.getStepMeta(), CarpDagOrcaPipelineStageConfigDTO.CarpDagOrcaPipelineStageConfigMeta.class)); | ||
} | ||
if (entity.getStepAttrs() != null) { | ||
dto.setAttrs(JacksonUtil.toObject(entity.getStepAttrs(), CarpDagOrcaPipelineStageConfigDTO.CarpDagOrcaPipelineStageConfigAttrs.class)); | ||
} | ||
return dto; | ||
} | ||
|
||
} |
54 changes: 54 additions & 0 deletions
54
...arp/module/orca/core/persistence/sql/service/convert/CarpDagOrcaPipelineStageConvert.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package cn.sliew.carp.module.orca.core.persistence.sql.service.convert; | ||
|
||
import cn.sliew.carp.framework.common.convert.BaseConvert; | ||
import cn.sliew.carp.framework.dag.service.dto.DagStepDTO; | ||
import cn.sliew.carp.module.orca.core.persistence.sql.service.dto.CarpDagOrcaPipelineStageDTO; | ||
import cn.sliew.milky.common.util.JacksonUtil; | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.ReportingPolicy; | ||
import org.mapstruct.factory.Mappers; | ||
import org.springframework.beans.BeanUtils; | ||
|
||
@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE) | ||
public interface CarpDagOrcaPipelineStageConvert extends BaseConvert<DagStepDTO, CarpDagOrcaPipelineStageDTO> { | ||
CarpDagOrcaPipelineStageConvert INSTANCE = Mappers.getMapper(CarpDagOrcaPipelineStageConvert.class); | ||
|
||
@Override | ||
default DagStepDTO toDo(CarpDagOrcaPipelineStageDTO dto) { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
@Override | ||
default CarpDagOrcaPipelineStageDTO toDto(DagStepDTO entity) { | ||
CarpDagOrcaPipelineStageDTO dto = new CarpDagOrcaPipelineStageDTO(); | ||
BeanUtils.copyProperties(entity, dto); | ||
if (entity.getStartTime() != null) { | ||
dto.setStartTime(entity.getStartTime().toInstant()); | ||
} | ||
if (entity.getEndTime() != null) { | ||
dto.setEndTime(entity.getEndTime().toInstant()); | ||
} | ||
if (entity.getBody() != null) { | ||
dto.setBody(JacksonUtil.toObject(entity.getBody(), CarpDagOrcaPipelineStageDTO.CarpDagOrcaPipelineStageBody.class)); | ||
} | ||
return dto; | ||
} | ||
|
||
} |
Oops, something went wrong.