node.py 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #
  2. # Copyright 2018-2022 Elyra Authors
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. #
  16. """
  17. Pipeline PythonNode
  18. This python script will represent a single node of a pipeline. It will be completely
  19. driven via the following environment variables configured on the node properties
  20. dialog of the pipeline:
  21. - `NODE_FILENAME`: (Required) The filename associated with the node. The extension
  22. is used to validate that the node matches the associated file. The basename portion
  23. represents the node name - and is used in producing the output files.
  24. - `INPUT_FILENAMES`: (Optional) A SEMI-COLON-separated list of filenames. Each entry
  25. can include a _relative_ path as a prefix to the filename. Each file is expected
  26. to exist and contain content. The content will be printed and should appear in the
  27. out of a cell.
  28. - `OUTPUT_FILENAMES`: (Optional) A SEMI-COLON-separated list of filenames. Each entry
  29. can include a _relative_ path as a prefix to the filename. Each file is NOT expected
  30. to exist, but will be created as a function of the notebook's execution.
  31. """
  32. import os
  33. import requests # noqa
  34. from elyra.tests.pipeline.resources.node_util.node_util import PythonNode
  35. # These getenv calls are here to help seed the environment variables
  36. # dialog in the node properties of the pipeline editor
  37. os.getenv("NODE_FILENAME")
  38. os.getenv("INPUT_FILENAMES")
  39. os.getenv("OUTPUT_FILENAMES")
  40. os.getenv("ELYRA_RUNTIME_ENV")
  41. # Execute the node
  42. PythonNode().run()