Skip to content

Commit

Permalink
feat(controller): add job status to evaluation summary (#1273)
Browse files Browse the repository at this point in the history
feat: add job status to evaluation summary
  • Loading branch information
dreamlandliu authored Sep 22, 2022
1 parent 260257c commit 0819efd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package ai.starwhale.mlops.api.protocol.evaluation;

import ai.starwhale.mlops.domain.job.status.JobStatus;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
Expand Down Expand Up @@ -71,6 +72,9 @@ public class SummaryVo {
@JsonProperty("duration")
public Long duration;

@JsonProperty("jobStatus")
private JobStatus jobStatus;

@JsonProperty("attributes")
private List<AttributeValueVo> attributes;
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import ai.starwhale.mlops.domain.job.converter.JobConvertor;
import ai.starwhale.mlops.domain.job.mapper.JobMapper;
import ai.starwhale.mlops.domain.job.po.JobEntity;
import ai.starwhale.mlops.domain.job.status.JobStatus;
import ai.starwhale.mlops.domain.job.status.JobStatusMachine;
import ai.starwhale.mlops.domain.project.ProjectManager;
import ai.starwhale.mlops.domain.user.UserService;
Expand Down Expand Up @@ -144,17 +143,8 @@ private SummaryVo toSummary(JobEntity entity) {
.owner(jobVo.getOwner().getName())
.duration(jobVo.getDuration())
.attributes(Lists.newArrayList())
.jobStatus(jobVo.getJobStatus())
.build();
// TODO:remove all of these implements
/*Map<String, Object> result = resultQuerier.flattenResultOfJob(entity.getId());
for (Entry<String, Object> entry : result.entrySet()) {
String value = String.valueOf(entry.getValue());
summaryVo.getAttributes().add(AttributeValueVo.builder()
.name(entry.getKey())
.type(getAttributeType(value))
.value(value)
.build());
}*/

// only cache the jobs which have the final status
if (jobStatusMachine.isFinal(entity.getJobStatus())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ public void testListEvaluationSummary() {
.createdTime(10L)
.stopTime(11L)
.owner(UserVo.builder().name("owner" + entity.getId()).build())
.jobStatus(JobStatus.SUCCESS)
.build();
});
var res = service.listEvaluationSummary(
Expand All @@ -167,7 +168,8 @@ public void testListEvaluationSummary() {
hasProperty("device", is("device1")),
hasProperty("datasets", is("1,2,3")),
hasProperty("duration", is(1L)),
hasProperty("owner", is("owner1"))
hasProperty("owner", is("owner1")),
hasProperty("jobStatus", is(JobStatus.SUCCESS))
))
)
)))
Expand Down

0 comments on commit 0819efd

Please sign in to comment.