Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-63452

For every kernel, the plug-in tries to run Python code, which could fail if language is not Python

    XMLWordPrintable

Details

    Description

      Hi loghijiaha,

      I'm debugging the plug-in just to have one final look at the code as we are near the end of GSoC.

      While doing so, I found what seems to be a bug.

      My job has several build steps, one for JS, one for Python, etc. The one for JS triggers the following pre-command, which I think is being used to change the working directory.

      import os
      os.chdir('/home/kinow/Development/java/jenkins/machine-learning-plugin/work/workspace/e2e-1') 

      That results in an error, that is logged as "ERROR'. I tested using `%%python` in a notebook cell, while using the same javascript kernel, but it still failed to run. This command only works when I select the Python kernel.

      I wonder if there is no way to tell Zeppelin what is the working directory we want to use, before starting the kernel?

      Attachments

        Issue Links

          Activity

            I think Zeppelin moves some Python files to a newly created temporary directory. Then executes the Kernel over there. Might be an option too. Instead of trying to tell the Kernel to use the workspace as working directory, copy the files over to where the Kernel is running? That would probably require more time investigating and testing.

            https://github.com/apache/zeppelin/blob/51a23801b38eb76f4e72c21304136c6090d4b808/zeppelin-jupyter-interpreter/src/main/java/org/apache/zeppelin/jupyter/JupyterKernelInterpreter.java#L182

            kinow Bruno P. Kinoshita added a comment - I think Zeppelin moves some Python files to a newly created temporary directory. Then executes the Kernel over there. Might be an option too. Instead of trying to tell the Kernel to use the workspace as working directory, copy the files over to where the Kernel is running? That would probably require more time investigating and testing. https://github.com/apache/zeppelin/blob/51a23801b38eb76f4e72c21304136c6090d4b808/zeppelin-jupyter-interpreter/src/main/java/org/apache/zeppelin/jupyter/JupyterKernelInterpreter.java#L182

            That is correct. The default working directory without changing with python code is where we initiate the  JupyterInterpreter. Eg:
            /home/kinow/Development/java/jenkins/machine-learning-plugin
            Users should be careful (about file paths)  while saving the artifacts, if we do not change the working directory.

            loghijiaha Loghi Perinpanayagam added a comment - That is correct. The default working directory without changing with python code is where we initiate the  JupyterInterpreter . Eg: /home/kinow/Development/java/jenkins/machine-learning-plugin Users should be careful (about file paths)  while saving the artifacts, if we do not change the working directory.

            Yup, the issue is that when my build step uses the `javascript` kernel, that command fails. So in practice, we are not changing the working directory, except if the build step supports Python.

            kinow Bruno P. Kinoshita added a comment - Yup, the issue is that when my build step uses the `javascript` kernel, that command fails. So in practice, we are not changing the working directory, except if the build step supports Python.

            I think we can remove that line and let the directory as default.

            loghijiaha Loghi Perinpanayagam added a comment - I think we can remove that line and let the directory as default.

            People

              loghijiaha Loghi Perinpanayagam
              kinow Bruno P. Kinoshita
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: