uranusjr commented on code in PR #35665:
URL: https://github.com/apache/airflow/pull/35665#discussion_r1395225916
##########
airflow/providers/apache/spark/decorators/pyspark.py:
##########
@@ -73,34 +74,45 @@ def execute(self, context: Context):
from pyspark import SparkConf
from pyspark.sql import SparkSession
- conf = SparkConf().setAppName(f"{self.dag_id}-{self.task_id}")
+ conf = SparkConf()
+ conf.set("spark.app.name", f"{self.dag_id}-{self.task_id}")
- master = "local[*]"
+ url = "local[*]"
if self.conn_id:
+ # we handle both spark connect and spark standalone
conn = BaseHook.get_connection(self.conn_id)
- if conn.port:
- master = f"{conn.host}:{conn.port}"
- elif conn.host:
- master = conn.host
+ if conn.conn_type == SparkConnectHook.conn_type:
+ url = SparkConnectHook(self.conn_id).get_connection_url()
+ else:
+ if conn.port:
+ url = f"{conn.host}:{conn.port}"
+ elif conn.host:
+ url = conn.host
Review Comment:
```suggestion
elif conn.port:
url = f"{conn.host}:{conn.port}"
elif conn.host:
url = conn.host
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]