Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Commit

Permalink
fix a bug in pig_submit, add parameter fLOG
Browse files Browse the repository at this point in the history
  • Loading branch information
sdpython committed Nov 28, 2014
1 parent be97eb1 commit cc1bc84
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion _unittests/ut_remote/test_cloudera.py
Expand Up @@ -183,7 +183,8 @@ def test_script_pig(self) :
# we test the syntax
out, err = self.client.pig_submit(pigfile, dependencies = [pyfile], check=True,
no_exception = True,
params=dict(UTT="unittest2"))
params=dict(UTT="unittest2"),
fLOG = fLOG)
if "pystream.pig syntax OK" not in err:
raise Exception("OUT:\n{0}\nERR:\n{1}".format(out,err))

Expand Down
9 changes: 7 additions & 2 deletions src/pyensae/remote/ssh_remote_connection.py
Expand Up @@ -5,6 +5,8 @@

import time, socket, os, io

from pyquickhelper import noLOG

class ASSHClient():
"""
A simple class to access to remote machine through SSH.
Expand Down Expand Up @@ -479,7 +481,8 @@ def pig_submit(self, pig_file,
local = False,
stop_on_failure = False,
check = False,
no_exception = True) :
no_exception = True,
fLOG = noLOG) :
"""
submits a PIG script, it first upload the script
to the default folder and submit it
Expand All @@ -492,6 +495,7 @@ def pig_submit(self, pig_file,
@param stop_on_failure if True, add option ``-stop_on_failure`` on the command line
@param check if True, add option ``-check`` (in that case, redirection will be empty)
@param no_exception sent to @see me execute_command
@param fLOG logging function
@return out, err from @see me execute_command
If *redirection* is not empty, the job is submitted but
Expand Down Expand Up @@ -535,14 +539,15 @@ def pig_submit(self, pig_file,
sparams = ""

if redirection is None:
cmd = "pig{0}{1}{2} -execute -f{3}".format(slocal, sstop_on_failure, scheck, sparams) + dest
cmd = "pig{0}{1}{2} -execute -f {3}{4}".format(slocal, sstop_on_failure, scheck, dest, sparams)
else:
cmd = "pig{2}{3}{4} -execute -f {0}{5} 2> {1}.err 1> {1}.out &".format(dest,
redirection, slocal, sstop_on_failure, scheck, sparams)

if isinstance(cmd, list):
raise TypeError("this should not happen:" + str(cmd))

fLOG("[pig_submit]:", cmd)
out, err = self.execute_command(cmd, no_exception = no_exception)
return out, err

Expand Down

0 comments on commit cc1bc84

Please sign in to comment.