Skip to content

Commit

Permalink
yow
Browse files Browse the repository at this point in the history
  • Loading branch information
wwcohen committed Jul 7, 2016
1 parent 2157451 commit 638b42e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
7 changes: 4 additions & 3 deletions gpextras.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
9 changes: 5 additions & 4 deletions mrs_gp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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()
Expand All @@ -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)
Expand Down

0 comments on commit 638b42e

Please sign in to comment.