Skip to content

Commit

Permalink
add processing tasks in workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
OriHoch committed Aug 5, 2024
1 parent 7c0dffd commit 3236fd1
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 0 deletions.
6 changes: 6 additions & 0 deletions workflows/templates/argo-workflows-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: argo-workflows
data:
datacity-concurrency: {{ .Values.concurrency | quote }}
56 changes: 56 additions & 0 deletions workflows/templates/continuous-processing-tasks-workflows.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{{- range $instance, $config := .Values.continuousProcessingTasksInstanceWorkflows }}
{{- range $task := $.Values.continuousProcessingTasks }}
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: cntprct-{{ $instance }}-{{ $task }}
labels:
datacity-workflow: continuous-processing-task
datacity-instance: {{ $instance | quote }}
datacity-cntprct-task: {{ $task | quote }}
spec:
entrypoint: continuous-processing-task
synchronization:
semaphore:
configMapKeyRef:
name: argo-workflows
key: datacity-concurrency
templates:
- name: continuous-processing-task
synchronization:
mutex:
name: instance-{{ $instance }}
steps:
- - name: call-template
templateRef:
name: dgp-operator-runner
template: dgp-operator-runner
arguments:
parameters:
- name: operator
value: packages_processing
- name: config_json
value: |
{
"instance": {{ $instance | quote }},
"task": {{ $task | quote }}
}
---
apiVersion: argoproj.io/v1alpha1
kind: CronWorkflow
metadata:
name: cntprct-{{ $instance }}-{{ $task }}
labels:
datacity-workflow: continuous-processing-task
datacity-instance: {{ $instance | quote }}
datacity-cntprct-task: {{ $task | quote }}
spec:
schedule: "@hourly"
concurrencyPolicy: Forbid
suspend: true
workflowSpec:
workflowTemplateRef:
name: cntprct-{{ $instance }}-{{ $task }}
---
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,21 @@ kind: WorkflowTemplate
metadata:
name: generic-fetcher-{{ $workflow.name_suffix }}
labels:
datacity-workflow: generic-fetcher
datacity-instance: {{ $instance | quote }}
datacity-organization: {{ $organization | quote }}
spec:
entrypoint: generic-fetcher
synchronization:
semaphore:
configMapKeyRef:
name: argo-workflows
key: datacity-concurrency
templates:
- name: generic-fetcher
synchronization:
mutex:
name: instance-{{ $instance }}
steps:
- - name: call-template
templateRef:
Expand All @@ -36,6 +45,7 @@ kind: CronWorkflow
metadata:
name: generic-fetcher-{{ $workflow.name_suffix }}
labels:
datacity-workflow: generic-fetcher
datacity-instance: {{ $instance | quote }}
datacity-organization: {{ $organization | quote }}
spec:
Expand Down
18 changes: 18 additions & 0 deletions workflows/values.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# The maximum concurrency for all datacity workflows
# this is important because all workflows run on the dgp server
concurrency: 4

genericFetcherInstanceOrganizationWorkflows:
haifa:
israel-gov:
Expand Down Expand Up @@ -91,3 +95,17 @@ genericFetcherInstanceOrganizationWorkflows:
target_package_id: bus-stops
source_filter:
MetropolinName: חיפה

continuousProcessingTasks:
- xlsx
- geojson

continuousProcessingTasksInstanceWorkflows:
haifa: {}
jaljulia: {}
jerusalem: {}
maale-adummim: {}
netanya: {}
rishonlezion: {}
kfar-saba: {}
test: {}

0 comments on commit 3236fd1

Please sign in to comment.