flyteplugins-spark 2.0.0b17__py3-none-any.whl → 2.0.0b19__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of flyteplugins-spark might be problematic. Click here for more details.

@@ -11,6 +11,8 @@ from flyte.models import SerializationContext
11
11
  from flyteidl.plugins.spark_pb2 import SparkApplication, SparkJob
12
12
  from google.protobuf.json_format import MessageToDict
13
13
 
14
+ DEFAULT_SPARK_CONTEXT_NAME = "FlyteSpark"
15
+
14
16
 
15
17
  @dataclass
16
18
  class Spark(object):
@@ -54,7 +56,7 @@ class PysparkFunctionTask(AsyncFunctionTaskTemplate):
54
56
  async def pre(self, *args, **kwargs) -> Dict[str, Any]:
55
57
  import pyspark as _pyspark
56
58
 
57
- sess = _pyspark.sql.SparkSession.builder.appName("FlyteSpark").getOrCreate()
59
+ sess = _pyspark.sql.SparkSession.builder.appName(DEFAULT_SPARK_CONTEXT_NAME).getOrCreate()
58
60
 
59
61
  if flyte.ctx().is_in_cluster():
60
62
  base_dir = tempfile.mkdtemp()
@@ -72,8 +74,8 @@ class PysparkFunctionTask(AsyncFunctionTaskTemplate):
72
74
  job = SparkJob(
73
75
  sparkConf=self.plugin_config.spark_conf,
74
76
  hadoopConf=self.plugin_config.hadoop_conf,
75
- mainApplicationFile=self.plugin_config.applications_path,
76
- executorPath=self.plugin_config.executor_path,
77
+ mainApplicationFile=self.plugin_config.applications_path or "local://" + sctx.get_entrypoint_path(),
78
+ executorPath=self.plugin_config.executor_path or sctx.interpreter_path,
77
79
  mainClass="",
78
80
  applicationType=SparkApplication.PYTHON,
79
81
  driverPod=driver_pod,
@@ -82,5 +84,11 @@ class PysparkFunctionTask(AsyncFunctionTaskTemplate):
82
84
 
83
85
  return MessageToDict(job)
84
86
 
87
+ async def post(self, return_vals: Any) -> Any:
88
+ import pyspark as _pyspark
89
+
90
+ sess = _pyspark.sql.SparkSession.builder.appName(DEFAULT_SPARK_CONTEXT_NAME).getOrCreate()
91
+ sess.stop()
92
+
85
93
 
86
94
  TaskPluginRegistry.register(Spark, PysparkFunctionTask)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flyteplugins-spark
3
- Version: 2.0.0b17
3
+ Version: 2.0.0b19
4
4
  Summary: Spark plugin for flyte
5
5
  Author-email: Kevin Su <pingsutw@users.noreply.github.com>
6
6
  Requires-Python: >=3.10
@@ -0,0 +1,6 @@
1
+ flyteplugins/spark/__init__.py,sha256=7q06oXtVhOuNW4Nv-YhJvt8ORqhXmMPNYa-m4IkougI,63
2
+ flyteplugins/spark/task.py,sha256=wHRH-Llw9wOUY_5Mic5IOCe2uIdqy2axxE_Dp-Yd4nU,3485
3
+ flyteplugins_spark-2.0.0b19.dist-info/METADATA,sha256=mBAUMR7KRm2owe7GhG5fWR0Cq5Y-6qvzY_b-T8Y4e5o,763
4
+ flyteplugins_spark-2.0.0b19.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
5
+ flyteplugins_spark-2.0.0b19.dist-info/top_level.txt,sha256=cgd779rPu9EsvdtuYgUxNHHgElaQvPn74KhB5XSeMBE,13
6
+ flyteplugins_spark-2.0.0b19.dist-info/RECORD,,
@@ -1,6 +0,0 @@
1
- flyteplugins/spark/__init__.py,sha256=7q06oXtVhOuNW4Nv-YhJvt8ORqhXmMPNYa-m4IkougI,63
2
- flyteplugins/spark/task.py,sha256=A3u0uEsY-Aw3UUYaiasFKjGLZ3NnrYDXrrDtOxXxuwc,3153
3
- flyteplugins_spark-2.0.0b17.dist-info/METADATA,sha256=cMYUtVjXm807EYjI6Ec3RMOR4t-RL8nl79tNUCO2hIc,763
4
- flyteplugins_spark-2.0.0b17.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
5
- flyteplugins_spark-2.0.0b17.dist-info/top_level.txt,sha256=cgd779rPu9EsvdtuYgUxNHHgElaQvPn74KhB5XSeMBE,13
6
- flyteplugins_spark-2.0.0b17.dist-info/RECORD,,