All Downloads are FREE. Search and download functionalities are using the official Maven repository.

fi.evolver.ai.spring.provider.replicate.response.RStatus Maven / Gradle / Ivy

package fi.evolver.ai.spring.provider.replicate.response;

import java.net.URI;
import java.time.LocalDateTime;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

@JsonIgnoreProperties(ignoreUnknown = true)
public record RStatus(
		String id,
		String model,
		String version,
		String logs,
		T output,
		String error,
		String status,
		@JsonProperty("started_at") LocalDateTime startedAt,
		@JsonProperty("completed_at") LocalDateTime completedAt,
		RUris urls,
		RMetrics metrics) {
			
	@JsonIgnoreProperties(ignoreUnknown = true)
	public static record RUris(
			URI cancel,
			URI get) {
	}

	@JsonIgnoreProperties(ignoreUnknown = true)
	public static record RMetrics(
			@JsonProperty("predict_time") Double hardwareTimeS) {
	}

	public boolean isInProgress() {
		return "processing".equals(status) || "starting".equals(status);
	}

	public boolean isSuccess() {
		return "succeeded".equals(status);
	}

	public boolean isFailed() {
		return "failed".equals(status) || "canceled".equals(status);
	}

	public boolean isCancelled() {
		return "canceled".equals(status);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy