Skip to content

Commit 98f5acf

Browse files
ED-2087: Add OCI support for LernDataproducts (#52) (#61)
Co-authored-by: Deepak Devadathan <[email protected]>
1 parent 30edd8b commit 98f5acf

21 files changed

+212
-35
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ lern-data-products/src/test/resources.csv
2121
lern-data-products/src/test/resources/tpd_metrics/
2222
**.csv.crc
2323
**/bin/*
24+
.vscode

ansible/artifacts-download.yml

+12
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,15 @@
4141
aws_secret_access_key: "{{ cloud_artifact_storage_secret }}"
4242
when: cloud_service_provider == "aws"
4343

44+
- name: download artifact from oci oss
45+
include_role:
46+
name: oci-cloud-storage
47+
apply:
48+
environment:
49+
OCI_CLI_AUTH: "instance_principal"
50+
tasks_from: download.yml
51+
vars:
52+
local_file_or_folder_path: "{{ artifact_path }}"
53+
oss_bucket_name: "{{ cloud_storage_artifacts_bucketname }}"
54+
oss_path: "{{ artifact }}"
55+
when: cloud_service_provider == "oci"

ansible/artifacts-upload.yml

+13
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,16 @@
4141
aws_access_key_id: "{{ cloud_artifact_storage_accountname }}"
4242
aws_secret_access_key: "{{ cloud_artifact_storage_secret }}"
4343
when: cloud_service_provider == "aws"
44+
45+
- name: upload artifact to oci oss
46+
include_role:
47+
name: oci-cloud-storage
48+
apply:
49+
environment:
50+
OCI_CLI_AUTH: "instance_principal"
51+
tasks_from: upload.yml
52+
vars:
53+
local_file_or_folder_path: "{{ artifact_path }}"
54+
oss_bucket_name: "{{ cloud_storage_artifacts_bucketname }}"
55+
oss_path: "{{ artifact }}"
56+
when: cloud_service_provider == "oci"

ansible/lpa_lern-data-products_deploy.yml

+1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
environment:
88
AZURE_STORAGE_ACCOUNT: "{{sunbird_private_storage_account_name}}"
99
AZURE_STORAGE_KEY: "{{sunbird_private_storage_account_key}}"
10+
OCI_CLI_AUTH: "instance_principal"
1011
roles:
1112
- lern-data-products-deploy

ansible/roles/lern-data-products-deploy/tasks/main.yml

+59
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,19 @@
55
tags:
66
- always
77

8+
- name: Ensure oci oss bucket exists
9+
command: "/home/{{analytics_user}}/bin/oci os bucket get --name {{ bucket }}"
10+
register: check_bucket
11+
when: dp_object_store_type == "oci"
12+
tags:
13+
- always
14+
15+
- name: Create oci oss bucket
16+
command: "/home/{{analytics_user}}/bin/oci os bucket create -c {{oci_bucket_compartment}} --name {{bucket}}"
17+
when: dp_object_store_type == "oci" and check_bucket.rc !=0
18+
tags:
19+
- always
20+
821
- name: Copy Core Data Products
922
copy: src={{ analytics_batch_module_artifact }} dest={{ analytics.home }}/models-{{ model_version }}
1023
tags:
@@ -14,9 +27,19 @@
1427
command: az storage blob upload --overwrite -c {{ bucket }} --name models-{{ model_version }}/{{ analytics_batch_module_artifact }} -f {{ analytics.home }}/models-{{ model_version }}/{{ analytics_batch_module_artifact }}
1528
async: 3600
1629
poll: 10
30+
when: dp_object_store_type == "azure"
31+
tags:
32+
- dataproducts-spark-cluster
33+
34+
- name: Copy Core Data Products to oci oss
35+
command: /home/{{analytics_user}}/bin/oci os object put -bn {{ bucket }} --name models-{{ model_version }}/{{ analytics_batch_module_artifact }} --file {{ analytics.home }}/models-{{ model_version }}/{{ analytics_batch_module_artifact }} --force
36+
async: 3600
37+
poll: 10
38+
when: dp_object_store_type == "oci"
1739
tags:
1840
- dataproducts-spark-cluster
1941

42+
2043
- name: Unarchive Ed Data Products
2144
become: yes
2245
unarchive: src={{ playbook_dir}}/{{ analytics_ed_dataporducts_artifact }} dest={{ analytics.home }}/models-{{ model_version }} copy=yes group={{ analytics_group }} owner={{ analytics_user }}
@@ -27,9 +50,18 @@
2750
command: az storage blob upload --overwrite -c {{ bucket }} --name models-{{ model_version }}/lern-data-products-1.0.jar -f {{ analytics.home }}/models-{{ model_version }}/lern-data-products-1.0/lern-data-products-1.0.jar
2851
async: 3600
2952
poll: 10
53+
when: dp_object_store_type == "azure"
3054
tags:
3155
- lern-dataproducts-spark-cluster
3256

57+
- name: Copy Ed Data Products to oci oss
58+
command: /home/{{analytics_user}}/bin/oci os object put -bn {{ bucket }} --name models-{{ model_version }}/data-products-1.0.jar --file {{ analytics.home }}/models-{{ model_version }}/data-products-1.0/data-products-1.0.jar --force
59+
async: 3600
60+
poll: 10
61+
when: dp_object_store_type == "oci"
62+
tags:
63+
- lern-dataproducts-spark-cluster
64+
3365
- name: Copy Framework Library
3466
copy: src={{ analytics_core_artifact }} dest={{ analytics.home }}/models-{{ model_version }}
3567
tags:
@@ -39,6 +71,15 @@
3971
command: az storage blob upload --overwrite --debug -c {{ bucket }} --name models-{{ model_version }}/{{ analytics_core_artifact }} -f {{ analytics.home }}/models-{{ model_version }}/{{ analytics_core_artifact }}
4072
async: 3600
4173
poll: 10
74+
when: dp_object_store_type == "azure"
75+
tags:
76+
- framework-spark-cluster
77+
78+
- name: Copy Framework Library to oci oss
79+
command: /home/{{analytics_user}}/bin/oci os object put -bn {{ bucket }} --name models-{{ model_version }}/{{ analytics_core_artifact }} --file {{ analytics.home }}/models-{{ model_version }}/{{ analytics_core_artifact }} --force
80+
async: 3600
81+
poll: 10
82+
when: dp_object_store_type == "oci"
4283
tags:
4384
- framework-spark-cluster
4485

@@ -51,9 +92,18 @@
5192
command: az storage blob upload --overwrite -c {{ bucket }} --name models-{{ model_version }}/{{ scruid_artifact }} -f {{ analytics.home }}/models-{{ model_version }}/{{ scruid_artifact }}
5293
async: 3600
5394
poll: 10
95+
when: dp_object_store_type == "azure"
5496
tags:
5597
- framework-spark-cluster
5698

99+
- name: Copy Scruid Library to oci oss
100+
command: /home/{{analytics_user}}/bin/oci os object put -bn {{ bucket }} --name models-{{ model_version }}/{{ scruid_artifact }} --file {{ analytics.home }}/models-{{ model_version }}/{{ scruid_artifact }} --force
101+
async: 3600
102+
poll: 10
103+
when: dp_object_store_type == "oci"
104+
tags:
105+
- framework-spark-cluster
106+
57107
- name: Copy Job Manager
58108
copy: src={{ analytics_job_manager_artifact }} dest={{ analytics.home }}/models-{{ model_version }}
59109
tags:
@@ -92,9 +142,18 @@
92142
command: az storage blob upload --overwrite -c {{ bucket }} -f {{ analytics.home }}/models-{{ model_version }}/lernapplication.conf --name models-{{ model_version }}/lernapplication.conf
93143
async: 3600
94144
poll: 10
145+
when: dp_object_store_type == "azure"
95146
tags:
96147
- framework-spark-cluster
97148

149+
- name: Copy configuration file to oci oss
150+
command: /home/{{analytics_user}}/bin/oci os object put -bn {{ bucket }} --file {{ analytics.home }}/models-{{ model_version }}/application.conf --name models-{{ model_version }}/application.conf --force
151+
async: 3600
152+
poll: 10
153+
when: dp_object_store_type == "oci"
154+
tags:
155+
- framework-spark-cluster
156+
98157
- name: Copy log4j2 xml file
99158
template: src=log4j2.xml.j2 dest={{ analytics.home }}/models-{{ model_version }}/log4j2.xml mode=755 owner={{ analytics_user }} group={{ analytics_group }}
100159
tags: [ dataproducts, framework, lern-dataproducts ]

ansible/roles/lern-data-products-deploy/templates/common.conf.j2

+16-6
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,24 @@ reports.storage.key.config="{{ dp_reports_storage_key_config }}"
1616
reports.storage.secret.config="{{ dp_reports_storage_secret_config }}"
1717
{% if dp_object_store_type == "azure" %}
1818
cloud_storage_type="azure"
19-
{% elif (dp_object_store_type == "cephs3" or dp_object_store_type == "s3") %}
20-
cloud_storage_type="s3"
21-
cloud_storage_endpoint="{{ s3_storage_endpoint | regex_replace('^[a-z]+://(.*)$', '\\1') }}"
19+
{% elif (dp_object_store_type == "cephs3" or dp_object_store_type == "s3" or dp_object_store_type == "oci") %}
20+
21+
cloud_storage_endpoint="{{ s3_storage_endpoint | regex_replace('^[a-z]+://(.*)$', '\1') }}"
2222
cloud_storage_endpoint_with_protocol="{{ s3_storage_endpoint }}"
23+
24+
{% if cloud_service_provider == "oci" %}
25+
cloud_storage_type="oci"
26+
storage.endpoint.config="{{ dp_storage_endpoint_config }}"
27+
oci_storage_key="{{ s3_storage_key }}"
28+
oci_storage_secret="{{ s3_storage_secret }}"
29+
{% else %}
30+
cloud_storage_type="s3"
2331
aws_storage_key="{{ s3_storage_key }}"
2432
aws_storage_secret="{{ s3_storage_secret }}"
2533
{% endif %}
2634

35+
{% endif %}
36+
2737
lp.contentmodel.versionkey="jd5ECm/o0BXwQCe8PfZY1NoUkB9HN41QjA80p22MKyRIcP5RW4qHw8sZztCzv87M"
2838

2939
# Joblog Kafka appender config for cluster execution
@@ -112,7 +122,7 @@ azure {
112122
}
113123

114124
## Reports - Global config
115-
cloud.container.reports="reports"
125+
cloud.container.reports="{{reports_container}}"
116126

117127
# course metrics container in azure
118128
course.metrics.cassandra.sunbirdKeyspace="sunbird"
@@ -252,9 +262,9 @@ etbtextbook.filename="ETB_textbook_data.csv"
252262
etb.dialcode.druid.length={{ etb_dialcode_list_druid_length }}
253263

254264

255-
druid.report.default.storage="azure"
265+
druid.report.default.storage="{{druid_storage_type}}"
256266
druid.report.date.format="yyyy-MM-dd"
257-
druid.report.default.container="report-verification"
267+
druid.report.default.container="{{cloud_storage_report_verfication_bucketname}}"
258268

259269
## Collection Exhaust Jobs Configuration -- Start ##
260270

0 commit comments

Comments
 (0)