<#3630 [BUG] Single Container Spark: No FileSyste...
# flyte-github
c
#3630 [BUG] Single Container Spark: No FileSystem for scheme "s3" Issue created by peridotml ### Describe the bug A few people (including me) have run into the following error when trying to save a DataFrame from a spark task when using inputs / outputs that require pyspark using s3. I believe the cause is running a spark task without setting up the spark plugin. This is an edge-case where someone thinks the spark plugin is setup, but actually isn't. Why do I believe this? My theory is that a couple important setting get set in the plugin that still apply to running spark jobs running in local mode. https://github.com/flyteorg/flyte/blob/master/charts/flyte-core/values.yaml#L834. These are the exact settings that I need to add to get the spark job running in local model. Why do I care? It was confusing to debug.
Copy code
error <class 'py4j.protocol.Py4JJavaError'>: An error occurred while calling o42.parquet.
: org.apache.hadoop.fs.UnsupportedFileSystemException: No FileSystem for scheme "s3"
• https://discuss.flyte.org/t/5158547/Hello-I-was-exploring-on-Kubernetes-Spark-job-and-i-tried-to. • https://discuss.flyte.org/t/39240/U03CZJFCT7T-you-should-be-able-to-find-pods-in-the-flytesnac ### Expected behavior If we want to support spark tasks running in local model then they should 1. Work out of the box 2. Explicitly tell users the task is running local or the plugin is not setup and the job is falling back. The spark tasks run local mode after including the following config. ### Additional context to reproduce import pandas as pd from flytekit import task, workflow, StructuredDataset from flytekitplugins.spark import Spark import flytekit def configure_s3(spark): hadoop_conf = spark._jsc.hadoopConfiguration() hadoop_conf.set("fs.s3.impl", "org.apache.hadoop.fs.s3a.S3AFileSystem") hadoop_conf.set("fs.s3a.aws.credentials.provider", "com.amazonaws.auth.WebIdentityTokenCredentialsProvider") @task(container_image="ghcr.io/flyteorg/flytecookbook:k8s_spark-latest", task_config=Spark( spark_conf={ "spark.driver.memory": "1000M", "spark.executor.memory": "1000M", "spark.executor.instances": "3", "spark.driver.cores": "1", "spark.executor.cores": "1", }), ) def t1() -> StructuredDataset: spark = flytekit.current_context().spark_session # The task fails without these settings. # configure_s3(spark) df = pd.DataFrame({"a": [1,2,3]}) df = spark.createDataFrame(df) return StructuredDataset(dataframe=df) @workflow def wf() -> StructuredDataset: sd = t1() return sd ### Screenshots No response ### Are you sure this issue hasn't been raised already? • Yes ### Have you read the Code of Conduct? • Yes flyteorg/flyte