syntax = "proto3";

package flyteidl.plugins;

option go_package = "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/plugins";

// Describes a job that can process independent pieces of data concurrently. Multiple copies of the runnable component
// will be executed concurrently.
message ArrayJob {
    // Defines the maximum number of instances to bring up concurrently at any given point. Note that this is an
    // optimistic restriction and that, due to network partitioning or other failures, the actual number of currently
    // running instances might be more. This has to be a positive number if assigned. Default value is size.
    int64 parallelism = 1;

    // Defines the number of instances to launch at most. This number should match the size of the input if the job
    // requires processing of all input data. This has to be a positive number.
    // In the case this is not defined, the back-end will determine the size at run-time by reading the inputs.
    int64 size = 2;

    oneof success_criteria {
        // An absolute number of the minimum number of successful completions of subtasks. As soon as this criteria is met,
        // the array job will be marked as successful and outputs will be computed. This has to be a non-negative number if
        // assigned. Default value is size (if specified).
        int64 min_successes = 3;

        // If the array job size is not known beforehand, the min_success_ratio can instead be used to determine when an array
        // job can be marked successful.
        float min_success_ratio = 4;
    }
}
