import os
import glob

def findspark():
	
	sparkhome = os.getenv("SPARK_HOME")
	if sparkhome is None:
		raise Exception("The environment variable SPARK_HOME must be set to the Spark installation directory")
	else:
		return sparkhome

def findjar():
	
	calldir = os.path.dirname(os.path.realpath(__file__))
	jardir = os.path.join(calldir, '..', 'lib', '*.jar')
	jar = glob.glob(jardir)
	if len(jar) == 0 or not os.path.exists(jar[0]):
		raise Exception("Cannot find jar, looking at %s" % jar)
	else:
		return jar[0]

def baseargs(parser):

	parser.add_argument('path', type=str, 
		help='Temporary location to store outputs')
	parser.add_argument('-o', '--overwrite', type=bool, default=True, required=False,
		help='Whether to overwrite the temporary location if it already exists')
	parser.add_argument('-lgn', '--lightning', type=str, default=None, required=False,
		help='Lightning server for visualization')
	parser.add_argument('-bt', '--batchtime', type=int, default=1, required=False,
		help='Frequency of updates')
	parser.add_argument('-np', '--npoints', type=int, default=50, required=False,
		help='Number of data points per batch')
	parser.add_argument('-nb', '--nbatches', type=int, default=40, required=False,
		help='Number of batches')
	parser.add_argument('-hl', '--halflife', type=float, default=5, required=False,
		help='Half life for streaming updates')
	parser.add_argument('-tu', '--timeunit', type=str, default='batches', choices=('batches', 'points'), required=False, 
		help='Time unit for streaming updates')
	return parser
@@ -16,16 +16,43 @@
 t glob%0A%0A
+from numpy import loadtxt%0A%0A
 def find
@@ -536,16 +536,549 @@
 jar%5B0%5D%0A%0A
+def loadrecent(filename, oldtime, oldoutput):%0A%0A%09try:%0A%09%09fname = max(glob.iglob(filename), key=os.path.getctime)%0A%09except:%0A%09%09print('No file found')%0A%09%09return %5B%5D, oldtime%0A%0A%09newtime = os.path.getctime(fname)%0A%09if not (newtime %3E oldtime):%0A%09%09print('File is not new')%0A%09%09return oldoutput, oldtime%09%0A%0A%09try:%0A%09%09f = open(fname)%0A%09%09if os.fstat(f.fileno()).st_size == 0:%0A%09%09%09print('File is empty')%0A%09%09%09return %5B%5D, oldtime%0A%0A%09except:%0A%09%09print('Cannot load file')%0A%09%09return %5B%5D, oldtime%0A%0A%09prediction = loadtxt(fname, delimiter=',')%0A%09return prediction, newtime%0A%0A
 def base

Add loading util