-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Labels
component/executionIssues or PRs related exclusively to the Execution component (Job, JobConfig)Issues or PRs related exclusively to the Execution component (Job, JobConfig)kind/proposalProposal for new ideas or featuresProposal for new ideas or features
Description
Motivation
Currently, concurrency policies are only supported only on a single JobConfig-level. There could be two JobConfigs that cannot run at the same time, and we want to provide some concurrency control on a controller-level to help with this.
Proposal
It should be simple to extend concurrency policy to support named concurrency groups, such that:
- The default concurrency group is empty, which means to group by JobConfig (predominant behavior).
- If so desired, users can specify an optional
concurrency.group. This group name is namespaced, and two identical names in different namespaces should not contribute to the same concurrency count. - Need to enforce concurrency policies for this group in multiple places:
- ActiveJobStore: Need to use group instead of JobConfig name.
- JobQueueController: Probably need to rewrite to update
PerConfigReconcilertoPerGroupReconciler. - JobValidatingWebhook: Need to index all Jobs by group, instead of looking up JobConfig's status for enforcement.
- JobConfigController: Need to handle new JobConfigStatus.
- Concurrency group name can support context variables for the
jobconfigcontext.- Example: The default concurrency group would be
${jobconfig.uid}, which evaluates to the JobConfig's UID.
- Example: The default concurrency group would be
API Design
JobConfig
-
Update
ConcurrencySpeclike as follows:apiVersion: execution.furiko.io/v1alpha1 kind: JobConfig metadata: name: my-job-config namespace: my-namespace spec: concurrency: policy: Forbid group: my-custom-group
-
JobConfigStatus will have to be updated as well:
apiVersion: execution.furiko.io/v1alpha1 kind: JobConfig metadata: name: my-job-config namespace: my-namespace status: state: JobQueued # Refers to jobs for the JobConfig, not the concurrency group. jobs: # Contains references for JobConfig's actual children jobs. queued: 2 queuedJobs: - namespace: my-namespace name: my-job-config.1 - namespace: my-namespace name: my-job-config.2 concurrencyGroup: # Contains references for all Jobs in the JobConfig's concurrency group. name: my-custom-group # Defaults to JobConfig name queued: 4 queuedJobs: - namespace: my-namespace name: my-job-config.1 - namespace: my-namespace name: my-job-config.2 - namespace: my-namespace name: another-job-config.1 - namespace: my-namespace name: another-job-config.1
Job
-
Update
StartPolicySpecas follows:apiVersion: execution.furiko.io/v1alpha1 kind: Job metadata: name: my-job namespace: my-namespace spec: startPolicy: concurrencyPolicy: Forbid concurrencyGroup: my-custom-group
-
It should be possible for the JobStatus to show a more detailed message about the concurrency group:
apiVersion: execution.furiko.io/v1alpha1 kind: Job metadata: name: my-job namespace: my-namespace status: condition: finished: result: AdmissionError reason: AdmissionError message: Cannot start new Job, concurrency group "my-custom-group" has 2 active Jobs but concurrency policy is Forbid
References
- GitHub Actions: https://docs.github.com/en/actions/using-jobs/using-concurrency
- Argo Workflows: https://argoproj.github.io/argo-workflows/synchronization/
Metadata
Metadata
Assignees
Labels
component/executionIssues or PRs related exclusively to the Execution component (Job, JobConfig)Issues or PRs related exclusively to the Execution component (Job, JobConfig)kind/proposalProposal for new ideas or featuresProposal for new ideas or features