From 63e61ef12d55ab41192ca979b8e3e6f368d40b2e Mon Sep 17 00:00:00 2001 From: Luis Belloch Date: Thu, 13 Feb 2020 22:23:35 +0100 Subject: [PATCH] Autorefresh of live.html, changed file name in server to solve caching issues --- spark/_template_rdd | 2 +- spark/hello1.py | 2 +- spark/hello2.py | 2 +- spark/live/live.sh | 3 ++- spark/live/live_template.html | 1 + 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/spark/_template_rdd b/spark/_template_rdd index b6ae1ef..04fbb73 100644 --- a/spark/_template_rdd +++ b/spark/_template_rdd @@ -7,5 +7,5 @@ no_header = txt.filter(lambda s: not s.startswith(item_fields[0])) parsed = no_header.map(lambda s: parse_item(s)).cache() print(parsed.take(1)) -print(parsed.toDebugString()) +print(parsed.toDebugString().decode('utf-8')) diff --git a/spark/hello1.py b/spark/hello1.py index d79e8aa..fa03ae1 100644 --- a/spark/hello1.py +++ b/spark/hello1.py @@ -6,5 +6,5 @@ print(rdd.count()) # Also spark-submit hello1.py --conf spark.logLineage=true -print(rdd.toDebugString()) +print(rdd.toDebugString().decode('utf-8')) diff --git a/spark/hello2.py b/spark/hello2.py index 0c50ec6..8a077ee 100644 --- a/spark/hello2.py +++ b/spark/hello2.py @@ -5,7 +5,7 @@ solo_en_euros = rdd.filter(lambda fila: 'EUR' in fila) -print(solo_en_euros.toDebugString()) +print(solo_en_euros.toDebugString().decode('utf-8')) print(solo_en_euros.count()) print(solo_en_euros.take(10)) diff --git a/spark/live/live.sh b/spark/live/live.sh index 2eb7d7b..258d84a 100755 --- a/spark/live/live.sh +++ b/spark/live/live.sh @@ -5,7 +5,8 @@ fswatch ../live.py | while read -r fpath; do \ echo -e "\033[0;36mRELOAD\033[0m $fpath $(date +"%H%M%S")" echo -e "# $(date +"%H:%M:%S")\n" | cat - ../live.py > live_mod.py sed -e '/-python">/r./live_mod.py' live_template.html > live.html - gsutil cp live.html gs://bigdata.luisbelloch.es/live.html + gsutil -h "Cache-Control:no-cache,max-age=0" \ + cp live.html gs://bigdata.luisbelloch.es/en_directo.html # echo -e "# $(date +"%H:%M:%S")\n" | cat - live.py | pygmentize -f html -O full,linenos=1 -o live.html # scp live.html root@live.luisbelloch.es:/var/www/html/index.html diff --git a/spark/live/live_template.html b/spark/live/live_template.html index 038e96a..7362ae2 100644 --- a/spark/live/live_template.html +++ b/spark/live/live_template.html @@ -4,6 +4,7 @@ + #bidataupv - live