You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Daniel Dai (Updated) (JIRA)" <ji...@apache.org> on 2012/03/02 00:00:57 UTC
[jira] [Updated] (PIG-2559) Embedded pig in python; invoking
sys.exit(0) causes script failure
[ https://issues.apache.org/jira/browse/PIG-2559?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Daniel Dai updated PIG-2559:
----------------------------
Resolution: Fixed
Fix Version/s: 0.11
0.10
Assignee: Vivek Padmanabhan
Hadoop Flags: Reviewed
Status: Resolved (was: Patch Available)
Unit test pass. test-patch:
[exec] -1 overall.
[exec]
[exec] +1 @author. The patch does not contain any @author tags.
[exec]
[exec] +1 tests included. The patch appears to include 3 new or modified tests.
[exec]
[exec] -1 javadoc. The javadoc tool appears to have generated 1 warning messages.
[exec]
[exec] +1 javac. The applied patch does not increase the total number of javac compiler warnings.
[exec]
[exec] +1 findbugs. The patch does not introduce any new Findbugs warnings.
[exec]
[exec] -1 release audit. The applied patch generated 533 release audit warnings (more than the trunk's current 530 warnings).
javadoc and release audit warning is unrelated.
Patch committed to 0.10/trunk. Thanks Vivek!
> Embedded pig in python; invoking sys.exit(0) causes script failure
> ------------------------------------------------------------------
>
> Key: PIG-2559
> URL: https://issues.apache.org/jira/browse/PIG-2559
> Project: Pig
> Issue Type: Bug
> Affects Versions: 0.9.1, 0.10
> Reporter: Vivek Padmanabhan
> Assignee: Vivek Padmanabhan
> Fix For: 0.10, 0.11
>
> Attachments: PIG-2559_1.patch
>
>
> In embedded pig in python, if I have a sys.exit (0) the script always fails and returns exit code as 6.
> While it is agreeable that Pig will reinterpret the exit code from Python, sys.exit(0) should be considered as a normal termination.
> A sample code;
> {code}
> #!/usr/bin/python
> from org.apache.pig.scripting import Pig
> import sys
> if 1 == 2:
> sys.exit(1)
> else:
> sys.exit(0)
> {code}
> Exception from Pig
> {code}
> org.apache.pig.backend.executionengine.ExecException: ERROR 1121: Python Error. Traceback (most recent call last):
> File "a.py", line 9, in <module>
> sys.exit(0)
> SystemExit: 0
> at org.apache.pig.scripting.jython.JythonScriptEngine$Interpreter.execfile(JythonScriptEngine.java:107)
> at org.apache.pig.scripting.jython.JythonScriptEngine.load(JythonScriptEngine.java:210)
> at org.apache.pig.scripting.jython.JythonScriptEngine.main(JythonScriptEngine.java:202)
> at org.apache.pig.scripting.ScriptEngine.run(ScriptEngine.java:275)
> at org.apache.pig.Main.runEmbeddedScript(Main.java:925)
> at org.apache.pig.Main.run(Main.java:516)
> at org.apache.pig.Main.main(Main.java:111)
> Caused by: Traceback (most recent call last):
> File "a.py", line 9, in <module>
> sys.exit(0)
> SystemExit: 0
> at org.python.core.PyException.fillInStackTrace(PyException.java:70)
> at java.lang.Throwable.<init>(Throwable.java:181)
> at java.lang.Exception.<init>(Exception.java:29)
> at java.lang.RuntimeException.<init>(RuntimeException.java:32)
> at org.python.core.PyException.<init>(PyException.java:46)
> at org.python.core.PyException.<init>(PyException.java:43)
> at org.python.core.PySystemState.exit(PySystemState.java:1206)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:175)
> at org.python.core.PyObject.__call__(PyObject.java:355)
> at org.python.core.PyMethod.__call__(PyMethod.java:215)
> at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:221)
> at org.python.core.PyMethod.__call__(PyMethod.java:206)
> at org.python.core.PyObject.__call__(PyObject.java:397)
> at org.python.core.PyObject.__call__(PyObject.java:401)
> at org.python.pycode._pyx0.f$0(a.py:9)
> at org.python.pycode._pyx0.call_function(a.py)
> at org.python.core.PyTableCode.call(PyTableCode.java:165)
> at org.python.core.PyCode.call(PyCode.java:18)
> at org.python.core.Py.runCode(Py.java:1197)
> at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:166)
> at org.apache.pig.scripting.jython.JythonScriptEngine$Interpreter.execfile(JythonScriptEngine.java:104)
> ... 6 more
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira