diff --git a/gpextras.py b/gpextras.py index 4c0de26..51b2afb 100644 --- a/gpextras.py +++ b/gpextras.py @@ -89,15 +89,16 @@ def logprogress(rowValue,rowIndex): class MRSCompiler(MRCompiler): """Compile tasks to commands that are executable on most Unix shells, - with the mrs_gp.py program. + with the mrs_gp.py program. To use this compiler you need to + call planner.registerCompiler('mrs_go',gpextras.MRSCompiler) """ def __init__(self): - self.mrsCommand = os.environ.get('GP_MRS_COMMAND','mrs_gp') + self.mrsCommand = os.environ.get('GP_MRS_COMMAND','python -m mrs_gp') def distributeCommands(self,task,gp,maybeRemoteCopy,localCopy): """Distribute the remote copy to the local directory.""" - return ['cp -f %s %s || echo warning: the copy failed!' % (maybeRemoteCopy,localCopy)] + return ['%s --fs getmerge %s > %s|| echo warning: the copy failed!' % (self.mrsCommand,maybeRemoteCopy,localCopy)] def simpleMapCommands(self,task,gp,mapCom,src,dst): """A map-only job with zero or one inputs.""" diff --git a/mrs_gp.py b/mrs_gp.py index b18c81d..6729758 100644 --- a/mrs_gp.py +++ b/mrs_gp.py @@ -911,7 +911,7 @@ def runServer(): #thid will allow access from anywhere.... server_address = ('0.0.0.0', serverPort) httpd = ThreadingServer(server_address, MRSHandler) - startMsg = 'http server started on http://%s:%d/ls&html=1 at %s' % (httpd.server_name,serverPort,time.strftime('%X %x')) + startMsg = 'http server started on http://%s:%d/ls?html=1 at %s' % (httpd.server_name,serverPort,time.strftime('%X %x')) logging.info(startMsg) print startMsg while keepRunning: @@ -1002,11 +1002,9 @@ def usage(): print "server is",("running" if serverIsResponsive() else "down") elif "--report" in optdict: sendRequest("/report") - elif "--task" in optdict: - del optdict['--task'] - sendRequest("/task?" + urllib.urlencode(optdict)) elif "--help" in optdict: usage() + # put this before --task because I want --task --fs to act like --fs elif "--fs" in optdict: if not args: usage() @@ -1018,6 +1016,9 @@ def usage(): elif len(args)>3: request += "&n="+args[3] #print "request: "+request sendRequest(request) + elif "--task" in optdict: + del optdict['--task'] + sendRequest("/task?" + urllib.urlencode(optdict)) else: if (('--inputs' in optdict) or ('--input' in optdict)) and ('--output' in optdict): performTask(optdict)