Skip to content

Instantly share code, notes, and snippets.

@dimastatz
Last active September 28, 2020 19:20
Show Gist options
  • Save dimastatz/da731bede54ecbb5bc6f297cd430d38d to your computer and use it in GitHub Desktop.
Save dimastatz/da731bede54ecbb5bc6f297cd430d38d to your computer and use it in GitHub Desktop.
def run_spark_app(config_name, dag):
eks_namespace = config.dim_value(config_name, 'eks_namespace')
eks_in_cluster = bool(config.dim_value(config_name, 'eks_in_cluster'))
eks_service_account_name = config.dim_value(config_name, 'eks_service_account_name')
eks_context = None if eks_in_cluster else config.dim_value(config_name, 'eks_context')
eks_commands = format_spark_submit(config_name, config.dim_value(config_name, 'eks_commands'))
return KubernetesPodOperator(
dag=dag,
cmds=eks_commands,
namespace=eks_namespace,
in_cluster=eks_in_cluster,
cluster_context=eks_context,
task_id='livy_sensor_log_ingest',
service_account_name=eks_service_account_name,
image=config.dim_value(config_name, 'eks_image_spark'),
name='spark_job_{}_{}'.format('vpa_ingest', uuid.uuid4())
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment