Uploaded image for project: 'Red Hat OpenShift Data Science'
  1. Red Hat OpenShift Data Science
  2. RHODS-12075

Cannot call imported functions in pipelines

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • None
    • None
    • None
    • False
    • Hide

      None

      Show
      None
    • False
    • None
    • Testable
    • No
    • No
    • No
    • Pending
    • None
    • Important

      Description of problem:

      If you try to call a function imported from another .py file, the pipeline crashes, even though the module is included in the built container.

      Prerequisites (if any, like setup, operators/versions):

      Steps to Reproduce

      Create a pipeline that has a .py file that imports a function in another .py file located int he same directory.

      main.py

      import test_module as fm
      import time

      def main():
          print("Running  test")
          pi = 3.141592654

          print("Calling print_val()")
           
          fm.print_val(pi)
          
          print("FINISHED")

      test_module.py

      def print_val( x ):
          print(f"The value of x is {x}")

          return

      Configure the main.py node to include test_module.py as per the image

      Actual results:

      Pipeline crashes

      Expected results:

      Pipeline completes

      Reproducibility: Always

      Build Details:

      Workaround: None

      Additional info:

      If I remote shell to the running pipeline container I can see both files (main.py and test_module.py) are in the container, and I can run them successfully with "python3 main.py"

      Log file output:
      main.py
      test_module.py
      tar: .: Cannot utime: Operation not permitted
      tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted
      tar: Exiting with failure status due to previous errors
      [I 01:50:26.784] 'new-failing-pipeline-20230922-5':'main' - dependencies processed (1.060 secs)
      [I 01:50:26.784] 'new-failing-pipeline-20230922-5':'main' - executing python script using 'python3 main.py' to 'main.log'
      [E 01:55:26.907] Unexpected error: <class 'subprocess.CalledProcessError'>
      [E 01:55:26.907] Error details: Command '['python3', 'main.py']' returned non-zero exit status 1.
      [D 01:55:26.908] Resetting dropped connection: brb-rhodsdata.s3.ap-southeast-2.amazonaws.com
      [D 01:55:27.763]
      https://brb-rhodsdata.s3.ap-southeast-2.amazonaws.com:443
      "PUT /new-failing-pipeline-20230922-5-0922014946/main.log HTTP/1.1" 200 0
      [I 01:55:27.764] 'new-failing-pipeline-20230922-5':'main' - uploaded main.log to bucket: brb-rhodsdata object: new-failing-pipeline-20230922-5-0922014946/main.log (0.856 secs)
      Traceback (most recent call last):
      File "/opt/app-root/src/bootstrapper.py", line 747, in <module>
      main()
      File "/opt/app-root/src/bootstrapper.py", line 737, in main
      file_op.execute()
      File "/opt/app-root/src/bootstrapper.py", line 501, in execute
      raise ex
      File "/opt/app-root/src/bootstrapper.py", line 488, in execute
      subprocess.run(run_args, stdout=log_file, stderr=subprocess.STDOUT, check=True)
      File "/usr/lib64/python3.9/subprocess.py", line 528, in run
      raise CalledProcessError(retcode, process.args,
      subprocess.CalledProcessError: Command '['python3', 'main.py']' returned non-zero exit status 1.

              Unassigned Unassigned
              rhn-sa-brbaker Bryon Baker
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: