snazy commented on code in PR #2180: URL: https://github.com/apache/polaris/pull/2180#discussion_r2637154295
########## tasks/api/src/main/java/org/apache/polaris/tasks/api/TasksConfiguration.java: ########## @@ -0,0 +1,124 @@ +/* + * 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 org.apache.polaris.tasks.api; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import io.smallrye.config.ConfigMapping; +import io.smallrye.config.WithDefault; +import java.time.Duration; +import java.util.Optional; +import java.util.OptionalInt; +import org.apache.polaris.immutables.PolarisImmutable; + +/** Advanced configuration options for distributed and converged task handling. */ +@ConfigMapping(prefix = "polaris.coordinated-tasks") +@PolarisImmutable +@JsonSerialize(as = ImmutableTasksConfiguration.class) +@JsonDeserialize(as = ImmutableTasksConfiguration.class) +@JsonTypeName(TasksConfiguration.TYPE_ID) +public interface TasksConfiguration { + String TYPE_ID = "coordinated-tasks"; + + int DEFAULT_RETAINED_HISTORY_LIMIT = 5; + + /** Number of history entries for task scheduling/submission updates. */ + @WithDefault("" + DEFAULT_RETAINED_HISTORY_LIMIT) + @JsonInclude(JsonInclude.Include.NON_ABSENT) + OptionalInt retainedHistoryLimit(); + + String DEFAULT_UPDATE_STATE_INTERVAL_STRING = "PT1S"; + Duration DEFAULT_UPDATE_STATE_INTERVAL = Duration.parse(DEFAULT_UPDATE_STATE_INTERVAL_STRING); + + /** + * The state of running tasks is regularly updated in the task store. This parameter defines the + * interval of these updates. + */ + @WithDefault(DEFAULT_UPDATE_STATE_INTERVAL_STRING) + @JsonInclude(JsonInclude.Include.NON_ABSENT) + @JsonFormat(shape = JsonFormat.Shape.STRING) + Optional<Duration> updateStateInterval(); + + String DEFAULT_LOST_NOT_BEFORE_STRING = "PT5M"; + Duration DEFAULT_LOST_NOT_BEFORE = Duration.parse(DEFAULT_LOST_NOT_BEFORE_STRING); + + /** + * Tasks in status "running" are considered as "lost" when the last state-update was before the + * duration specified by this parameter. + * + * <p>Running tasks regularly update the task store with their current state (see {@code + * updateStateInterval}). Tasks states with a {@code lostNotBefore} in the past are considered as + * "dead", which means that the task's execution can be resumed by another node. Review Comment: replaced "resumed" w/ "picked up" -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
