Skip to content

Commit 7cd95e3

Browse files
committed
Support for Spark Submit added in Data Flow
1 parent 3eb2648 commit 7cd95e3

14 files changed

+788
-20
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
### Added
44
- Support for `OPSI` service
5+
- Support for Spark Submit added in Data Flow
56

67
## 4.26.0 (May 12, 2021)
78

examples/dataflow/main.tf

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,34 @@ resource "oci_dataflow_invoke_run" "test_invoke_run" {
200200
display_name = "test_run_name"
201201
}
202202

203+
resource "oci_dataflow_application" "test_application_submit" {
204+
#Required
205+
compartment_id = var.compartment_id
206+
execute = "--conf spark.shuffle.io.maxRetries=10 ${var.application_file_uri} arguments"
207+
display_name = "test_wordcount_app_submit"
208+
driver_shape = "VM.Standard2.1"
209+
executor_shape = "VM.Standard2.1"
210+
file_uri = var.application_file_uri
211+
language = "PYTHON"
212+
num_executors = "1"
213+
spark_version = "2.4"
214+
#Optional
215+
archive_uri = var.application_archive_uri
216+
private_endpoint_id = oci_dataflow_private_endpoint.test_private_endpoint.id
217+
218+
}
219+
220+
resource "oci_dataflow_invoke_run" "test_invokey_run_submit" {
221+
#Required
222+
compartment_id = var.compartment_id
223+
execute = "--conf spark.shuffle.io.maxRetries=10 ${var.application_file_uri} arguments"
224+
#Optional
225+
application_id = oci_dataflow_application.test_application_submit.id
226+
archive_uri = var.application_archive_uri
227+
display_name = "test_wordcount_run_submit"
228+
spark_version = "2.4"
229+
}
230+
203231
data "oci_dataflow_private_endpoints" "test_private_endpoints" {
204232
compartment_id = var.compartment_id
205233

oci/dataflow_application_data_source.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ func (s *DataflowApplicationDataSourceCrud) SetData() error {
9999
s.D.Set("driver_shape", *s.Res.DriverShape)
100100
}
101101

102+
if s.Res.Execute != nil {
103+
s.D.Set("execute", *s.Res.Execute)
104+
}
105+
102106
if s.Res.ExecutorShape != nil {
103107
s.D.Set("executor_shape", *s.Res.ExecutorShape)
104108
}

oci/dataflow_application_resource.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ func DataflowApplicationResource() *schema.Resource {
9696
Optional: true,
9797
Computed: true,
9898
},
99+
"execute": {
100+
Type: schema.TypeString,
101+
Optional: true,
102+
Computed: true,
103+
},
99104
"freeform_tags": {
100105
Type: schema.TypeMap,
101106
Optional: true,
@@ -287,6 +292,11 @@ func (s *DataflowApplicationResourceCrud) Create() error {
287292
request.DriverShape = &tmp
288293
}
289294

295+
if execute, ok := s.D.GetOkExists("execute"); ok {
296+
tmp := execute.(string)
297+
request.Execute = &tmp
298+
}
299+
290300
if executorShape, ok := s.D.GetOkExists("executor_shape"); ok {
291301
tmp := executorShape.(string)
292302
request.ExecutorShape = &tmp
@@ -440,6 +450,11 @@ func (s *DataflowApplicationResourceCrud) Update() error {
440450
request.DriverShape = &tmp
441451
}
442452

453+
if execute, ok := s.D.GetOkExists("execute"); ok {
454+
tmp := execute.(string)
455+
request.Execute = &tmp
456+
}
457+
443458
if executorShape, ok := s.D.GetOkExists("executor_shape"); ok {
444459
tmp := executorShape.(string)
445460
request.ExecutorShape = &tmp
@@ -556,6 +571,10 @@ func (s *DataflowApplicationResourceCrud) SetData() error {
556571
s.D.Set("driver_shape", *s.Res.DriverShape)
557572
}
558573

574+
if s.Res.Execute != nil {
575+
s.D.Set("execute", *s.Res.Execute)
576+
}
577+
559578
if s.Res.ExecutorShape != nil {
560579
s.D.Set("executor_shape", *s.Res.ExecutorShape)
561580
}

oci/dataflow_application_submit_test.go

Lines changed: 335 additions & 0 deletions
Large diffs are not rendered by default.

oci/dataflow_invoke_run_data_source.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ func (s *DataflowInvokeRunDataSourceCrud) SetData() error {
108108
s.D.Set("driver_shape", *s.Res.DriverShape)
109109
}
110110

111+
if s.Res.Execute != nil {
112+
s.D.Set("execute", *s.Res.Execute)
113+
}
114+
111115
if s.Res.ExecutorShape != nil {
112116
s.D.Set("executor_shape", *s.Res.ExecutorShape)
113117
}

oci/dataflow_invoke_run_resource.go

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,24 @@ func DataflowInvokeRunResource() *schema.Resource {
2929
Delete: deleteDataflowInvokeRun,
3030
Schema: map[string]*schema.Schema{
3131
// Required
32-
"application_id": {
32+
"compartment_id": {
3333
Type: schema.TypeString,
3434
Required: true,
35-
ForceNew: true,
3635
},
37-
"compartment_id": {
36+
37+
// Optional
38+
"application_id": {
3839
Type: schema.TypeString,
39-
Required: true,
40+
Optional: true,
41+
Computed: true,
42+
ForceNew: true,
4043
},
41-
"display_name": {
44+
"archive_uri": {
4245
Type: schema.TypeString,
43-
Required: true,
46+
Optional: true,
47+
Computed: true,
4448
ForceNew: true,
4549
},
46-
47-
// Optional
4850
"arguments": {
4951
Type: schema.TypeList,
5052
Optional: true,
@@ -68,12 +70,24 @@ func DataflowInvokeRunResource() *schema.Resource {
6870
DiffSuppressFunc: definedTagsDiffSuppressFunction,
6971
Elem: schema.TypeString,
7072
},
73+
"display_name": {
74+
Type: schema.TypeString,
75+
Optional: true,
76+
Computed: true,
77+
ForceNew: true,
78+
},
7179
"driver_shape": {
7280
Type: schema.TypeString,
7381
Optional: true,
7482
Computed: true,
7583
ForceNew: true,
7684
},
85+
"execute": {
86+
Type: schema.TypeString,
87+
Optional: true,
88+
Computed: true,
89+
ForceNew: true,
90+
},
7791
"executor_shape": {
7892
Type: schema.TypeString,
7993
Optional: true,
@@ -123,6 +137,12 @@ func DataflowInvokeRunResource() *schema.Resource {
123137
},
124138
},
125139
},
140+
"spark_version": {
141+
Type: schema.TypeString,
142+
Optional: true,
143+
Computed: true,
144+
ForceNew: true,
145+
},
126146
"warehouse_bucket_uri": {
127147
Type: schema.TypeString,
128148
Optional: true,
@@ -137,10 +157,6 @@ func DataflowInvokeRunResource() *schema.Resource {
137157
},
138158

139159
// Computed
140-
"archive_uri": {
141-
Type: schema.TypeString,
142-
Computed: true,
143-
},
144160
"class_name": {
145161
Type: schema.TypeString,
146162
Computed: true,
@@ -207,10 +223,6 @@ func DataflowInvokeRunResource() *schema.Resource {
207223
Type: schema.TypeString,
208224
Computed: true,
209225
},
210-
"spark_version": {
211-
Type: schema.TypeString,
212-
Computed: true,
213-
},
214226
"state": {
215227
Type: schema.TypeString,
216228
Computed: true,
@@ -332,6 +344,11 @@ func (s *DataflowInvokeRunResourceCrud) Create() error {
332344
request.ApplicationId = &tmp
333345
}
334346

347+
if archiveUri, ok := s.D.GetOkExists("archive_uri"); ok {
348+
tmp := archiveUri.(string)
349+
request.ArchiveUri = &tmp
350+
}
351+
335352
if arguments, ok := s.D.GetOkExists("arguments"); ok {
336353
interfaces := arguments.([]interface{})
337354
tmp := make([]string, len(interfaces))
@@ -372,6 +389,11 @@ func (s *DataflowInvokeRunResourceCrud) Create() error {
372389
request.DriverShape = &tmp
373390
}
374391

392+
if execute, ok := s.D.GetOkExists("execute"); ok {
393+
tmp := execute.(string)
394+
request.Execute = &tmp
395+
}
396+
375397
if executorShape, ok := s.D.GetOkExists("executor_shape"); ok {
376398
tmp := executorShape.(string)
377399
request.ExecutorShape = &tmp
@@ -408,6 +430,11 @@ func (s *DataflowInvokeRunResourceCrud) Create() error {
408430
}
409431
}
410432

433+
if sparkVersion, ok := s.D.GetOkExists("spark_version"); ok {
434+
tmp := sparkVersion.(string)
435+
request.SparkVersion = &tmp
436+
}
437+
411438
if warehouseBucketUri, ok := s.D.GetOkExists("warehouse_bucket_uri"); ok {
412439
tmp := warehouseBucketUri.(string)
413440
request.WarehouseBucketUri = &tmp
@@ -547,6 +574,10 @@ func (s *DataflowInvokeRunResourceCrud) SetData() error {
547574
s.D.Set("driver_shape", *s.Res.DriverShape)
548575
}
549576

577+
if s.Res.Execute != nil {
578+
s.D.Set("execute", *s.Res.Execute)
579+
}
580+
550581
if s.Res.ExecutorShape != nil {
551582
s.D.Set("executor_shape", *s.Res.ExecutorShape)
552583
}

0 commit comments

Comments
 (0)