Skip to content

Commit 566d5fc

Browse files
authored
Merge pull request #167 from Yelp/timma/pass_config_required_for_some_of_the_services
Added code to pass the spark config required for some of the services
2 parents b9f8a34 + 687606e commit 566d5fc

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

service_configuration_lib/spark_config.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,7 @@ def _append_event_log_conf(
920920
spark_opts['spark.eventLog.enabled'] = 'false'
921921
return spark_opts
922922

923+
spark_opts['aws_account_id'] = account_id
923924
for conf in self.spark_srv_conf.get('environments', {}).values():
924925
if account_id == conf['account_id']:
925926
spark_opts['spark.eventLog.enabled'] = 'true'
@@ -1262,6 +1263,27 @@ def get_spark_conf(
12621263
if aws_creds:
12631264
spark_conf = _append_aws_credentials_conf(spark_conf, *aws_creds, aws_region)
12641265

1266+
# gather all data needed by our internal Spark configuration service
1267+
scs_args = {
1268+
'cluster_manager': cluster_manager,
1269+
'spark_app_base_name': spark_app_base_name,
1270+
'docker_image': docker_img,
1271+
'user_spark_opts': user_spark_opts,
1272+
'paasta_cluster': paasta_cluster,
1273+
'paasta_pool': paasta_pool,
1274+
'paasta_service': paasta_service,
1275+
'paasta_instance': paasta_instance,
1276+
'extra_volumes': extra_volumes,
1277+
'force_spark_resource_configs': force_spark_resource_configs,
1278+
'k8s_server_address': k8s_server_address,
1279+
'jira_ticket': jira_ticket,
1280+
'service_account_name': service_account_name,
1281+
'ui_port': int(ui_port),
1282+
'user': os.environ.get('USER'),
1283+
'aws_account_id': spark_conf.pop('aws_account_id', None),
1284+
}
1285+
spark_conf['scs_conf'] = json.dumps(scs_args, indent=4)
1286+
12651287
return spark_conf
12661288

12671289

tests/spark_config_test.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,7 +1333,8 @@ def test_leaders_get_spark_conf_kubernetes(
13331333
list(mock_append_spark_prometheus_conf.return_value.keys()) +
13341334
list(mock_append_event_log_conf.return_value.keys()) +
13351335
list(mock_append_aws_credentials_conf.return_value.keys()) +
1336-
list(mock_append_sql_partitions_conf.return_value.keys()),
1336+
list(mock_append_sql_partitions_conf.return_value.keys()) +
1337+
['scs_conf'], # services config key
13371338
)
13381339
assert set(output.keys()) == verified_keys
13391340
mock_adjust_spark_requested_resources_kubernetes.mocker.assert_called_once_with(
@@ -1464,7 +1465,8 @@ def test_local_spark(
14641465
list(mock_adjust_spark_requested_resources_kubernetes.return_value.keys()) +
14651466
list(mock_get_dra_configs.return_value.keys()) +
14661467
list(mock_append_aws_credentials_conf.return_value.keys()) +
1467-
list(mock_append_sql_partitions_conf.return_value.keys()),
1468+
list(mock_append_sql_partitions_conf.return_value.keys()) +
1469+
['scs_conf'], # services config key
14681470
)
14691471
assert set(output.keys()) == verified_keys
14701472
mock_append_event_log_conf.mocker.assert_called_once_with(

0 commit comments

Comments
 (0)