Skip to content

Commit 7969010

Browse files
committed
Move spinner init in load_data_to_hdfs.py to avoid error if /data is not populated
1 parent 48c8b66 commit 7969010

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

scripts/spark/setup/load_data_to_hdfs.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,14 @@ def get_schema(self):
7070
return self.parse_schema_file()
7171

7272
def transfer_data(self):
73+
spinner = Halo(text=f"Reading and writing data from /data/output.csv to {self.hdfs_path}")
74+
spinner.start()
7375
try:
7476
self.start_spark_session()
7577
schema = self.get_schema()
7678

7779
logging.info(f"Reading and writing data from /data/output.csv to {self.hdfs_path}")
78-
spinner = Halo(text=f"Reading and writing data from /data/output.csv to {self.hdfs_path}")
79-
spinner.start()
80+
8081
df = (self.spark.read.option("header", "true")
8182
.option("mode", "DROPMALFORMED")
8283
.option("overwrite", "true")

0 commit comments

Comments
 (0)