Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ private MetricsType() {}
public static final String WORKER_TASK_SLOTS_AVAILABLE =
TEMPORAL_METRICS_PREFIX + "worker_task_slots_available";

@Experimental
public static final String WORKER_TASK_SLOTS_USED =
TEMPORAL_METRICS_PREFIX + "worker_task_slots_used";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ public Builder setStickyTaskQueueDrainTimeout(Duration stickyTaskQueueDrainTimeo
* Set a {@link WorkerTuner} to determine how slots will be allocated for different types of
* tasks.
*/
@Experimental
public Builder setWorkerTuner(WorkerTuner workerTuner) {
this.workerTuner = workerTuner;
return this;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package io.temporal.worker.tuning;

import io.temporal.activity.ActivityInfo;
import io.temporal.common.Experimental;
import java.util.Objects;

/** Contains information about a slot that is being used to execute an activity task. */
@Experimental
public class ActivitySlotInfo extends SlotInfo {
private final ActivityInfo activityInfo;
private final String workerIdentity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package io.temporal.worker.tuning;

import io.temporal.common.Experimental;
import java.util.Objects;
import javax.annotation.Nonnull;

/**
* Can be used to create a {@link WorkerTuner} which uses specific {@link SlotSupplier}s for each
* type of slot.
*/
@Experimental
public class CompositeTuner implements WorkerTuner {
private final @Nonnull SlotSupplier<WorkflowSlotInfo> workflowTaskSlotSupplier;
private final @Nonnull SlotSupplier<ActivitySlotInfo> activityTaskSlotSupplier;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package io.temporal.worker.tuning;

import com.sun.management.OperatingSystemMXBean;
import io.temporal.common.Experimental;
import java.lang.management.ManagementFactory;
import java.time.Instant;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/** {@link SystemResourceInfo} implementation that uses JVM-specific APIs to get resource usage. */
@Experimental
public class JVMSystemResourceInfo implements SystemResourceInfo {
// As of relatively recent Java versions (including backports), this class will properly deal with
// containerized environments as well as running on bare metal.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package io.temporal.worker.tuning;

import io.temporal.activity.ActivityInfo;
import io.temporal.common.Experimental;
import java.util.Objects;

/** Contains information about a slot that is being used to execute a local activity. */
@Experimental
public class LocalActivitySlotInfo extends SlotInfo {
private final ActivityInfo activityInfo;
private final String workerIdentity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package io.temporal.worker.tuning;

import io.temporal.common.Experimental;
import java.util.Objects;

/** Contains information about a slot that is being used to execute a nexus task. */
@Experimental
public class NexusSlotInfo extends SlotInfo {
private final String service;
private final String operation;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package io.temporal.worker.tuning;

import io.temporal.common.Experimental;

/**
* Defines the behavior of a poller.
*
Expand All @@ -10,5 +8,4 @@
* PollerBehaviorSimpleMaximum}. For all intents and purpose this interface should be considered
* sealed.
*/
@Experimental
public interface PollerBehavior {}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.temporal.worker.tuning;

import io.temporal.common.Experimental;
import java.util.Objects;
import javax.annotation.Nullable;

Expand All @@ -11,7 +10,6 @@
* <p>If the server does not support autoscaling, then the number of pollers will stay at the
* initial number of pollers.
*/
@Experimental
public final class PollerBehaviorAutoscaling implements PollerBehavior {
private final int minConcurrentTaskPollers;
private final int maxConcurrentTaskPollers;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package io.temporal.worker.tuning;

import io.temporal.common.Experimental;
import java.util.Objects;

/**
* A poller behavior that will attempt to poll as long as a slot is available, up to the provided
* maximum. Cannot be less than two for workflow tasks, or one for other tasks.
*/
@Experimental
public class PollerBehaviorSimpleMaximum implements PollerBehavior {
private final int maxConcurrentTaskPollers;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.uber.m3.tally.Gauge;
import com.uber.m3.tally.Scope;
import io.temporal.common.Experimental;
import io.temporal.worker.MetricsType;
import java.time.Instant;
import java.util.concurrent.atomic.AtomicReference;
Expand All @@ -12,7 +11,6 @@
* Is used by {@link ResourceBasedSlotSupplier} and {@link ResourceBasedTuner} to make decisions
* about whether slots should be handed out based on system resource usage.
*/
@Experimental
public class ResourceBasedController {
public final ResourceBasedControllerOptions options;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package io.temporal.worker.tuning;

import com.google.common.base.Preconditions;
import io.temporal.common.Experimental;

/** Options for a {@link ResourceBasedController} */
@Experimental
public class ResourceBasedControllerOptions {

public static ResourceBasedControllerOptions.Builder newBuilder(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package io.temporal.worker.tuning;

import io.temporal.common.Experimental;
import java.time.Duration;
import java.util.Objects;

/** Options resource-based slot suppliers */
@Experimental
public class ResourceBasedSlotOptions {
private final int minimumSlots;
private final int maximumSlots;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package io.temporal.worker.tuning;

import io.temporal.common.Experimental;
import java.time.Duration;
import java.time.Instant;
import java.util.Optional;
import java.util.concurrent.*;

/** Implements a {@link SlotSupplier} based on resource usage for a particular slot type. */
@Experimental
public class ResourceBasedSlotSupplier<SI extends SlotInfo> implements SlotSupplier<SI> {

private final ResourceBasedController resourceController;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package io.temporal.worker.tuning;

import io.temporal.common.Experimental;
import java.time.Duration;
import java.util.concurrent.ScheduledExecutorService;
import javax.annotation.Nonnull;

/** A {@link WorkerTuner} that attempts to allocate slots based on available system resources. */
@Experimental
public class ResourceBasedTuner implements WorkerTuner {
public static final ResourceBasedSlotOptions DEFAULT_WORKFLOW_SLOT_OPTIONS =
ResourceBasedSlotOptions.newBuilder()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package io.temporal.worker.tuning;

import io.temporal.common.Experimental;

/** The base class that all slot info types used by {@link SlotSupplier} extend. */
@Experimental
public abstract class SlotInfo {
SlotInfo() {}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package io.temporal.worker.tuning;

import io.temporal.common.Experimental;

@Experimental
public interface SlotMarkUsedContext<SI extends SlotInfo> {
/**
* @return The information associated with the slot that is being marked as used.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package io.temporal.worker.tuning;

import io.temporal.common.Experimental;

/**
* This class is handed out by implementations of {@link SlotSupplier}. Permits are held until the
* tasks they are associated with (if any) are finished processing, or if the reservation is no
Expand All @@ -10,7 +8,6 @@
* <p>When {@link SlotSupplier#releaseSlot(SlotReleaseContext)} is called, the exact same instance
* of the permit is passed back to the supplier.
*/
@Experimental
public final class SlotPermit {
public final Object userData;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package io.temporal.worker.tuning;

import io.temporal.common.Experimental;
import javax.annotation.Nullable;

@Experimental
public interface SlotReleaseContext<SI extends SlotInfo> {
/**
* @return The reason the slot is being released.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package io.temporal.worker.tuning;

import io.temporal.common.Experimental;
import javax.annotation.Nullable;

@Experimental
public abstract class SlotReleaseReason {
SlotReleaseReason() {}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package io.temporal.worker.tuning;

import io.temporal.common.Experimental;
import java.util.Map;

@Experimental
public interface SlotReserveContext<SI extends SlotInfo> {
/**
* @return the Task Queue for which this reservation request is associated.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.temporal.worker.tuning;

import io.temporal.common.Experimental;
import java.util.Optional;

/**
Expand All @@ -13,7 +12,6 @@
* {@link WorkflowSlotInfo}, {@link ActivitySlotInfo}, {@link LocalActivitySlotInfo}, and {@link
* NexusSlotInfo}.
*/
@Experimental
public interface SlotSupplier<SI extends SlotInfo> {
/**
* This function is called before polling for new tasks. Your implementation should return a
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package io.temporal.worker.tuning;

import io.temporal.common.Experimental;

/** Implementors determine how resource usage is measured. */
@Experimental
public interface SystemResourceInfo {
/**
* @return System-wide CPU usage as a percentage [0.0, 1.0]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package io.temporal.worker.tuning;

import io.temporal.common.Experimental;
import javax.annotation.Nonnull;

/** WorkerTuners allow for the dynamic customization of some aspects of worker configuration. */
@Experimental
public interface WorkerTuner {
/**
* @return A {@link SlotSupplier} for workflow tasks.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
import io.temporal.api.enums.v1.TaskQueueKind;
import io.temporal.api.workflowservice.v1.PollWorkflowTaskQueueRequest;
import io.temporal.api.workflowservice.v1.PollWorkflowTaskQueueResponse;
import io.temporal.common.Experimental;
import java.util.Objects;
import javax.annotation.Nonnull;

/** Contains information about a slot that is being used to execute a workflow task. */
@Experimental
public class WorkflowSlotInfo extends SlotInfo {
private final String workflowType;
private final String taskQueue;
Expand Down
Loading