Skip to content

Commit

Permalink
added airgapped comment
Browse files Browse the repository at this point in the history
Signed-off-by: shalberd <21118431+shalberd@users.noreply.github.com>
  • Loading branch information
shalberd committed Aug 16, 2024
1 parent 0931c55 commit c3eba17
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 35 deletions.
9 changes: 4 additions & 5 deletions elyra/airflow/bootstrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,9 @@ def execute(self) -> None:
logger.error(f"Unexpected error: {sys.exc_info()[0]}")

NotebookFileOp.convert_notebook_to_html(notebook_output, notebook_html)
# self.put_file_to_object_storage(notebook_output, notebook)
# self.put_file_to_object_storage(notebook_html)
if enable_generic_node_script_output_to_s3:
self.put_file_to_object_storage(notebook_output, notebook)
self.put_file_to_object_storage(notebook_html)
raise ex

@staticmethod
Expand Down Expand Up @@ -336,7 +337,6 @@ def execute(self) -> None:
run_args = ["python3", python_script]

print("Processing file:", python_script)
log_file = None
try:
result = subprocess.run(run_args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=True)
output = result.stdout.decode("utf-8")
Expand Down Expand Up @@ -382,7 +382,6 @@ def execute(self) -> None:
run_args = ["Rscript", r_script]

print("Processing file:", r_script)
log_file = None
try:
result = subprocess.run(run_args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=True)
output = result.stdout.decode("utf-8")
Expand Down Expand Up @@ -575,7 +574,7 @@ def main():
input_params = OpUtil.parse_arguments(sys.argv[1:])
OpUtil.log_operation_info("starting operation")
t0 = time.time()
OpUtil.package_install() # can be commented out in airgapped images if packages installed via central pip env during container build
OpUtil.package_install() # must be commented out in airgapped images if packages from https://github.com/elyra-ai/elyra/blob/main/etc/generic/requirements-elyra.txt already installed via central pip env during container build

# Create the appropriate instance, process dependencies and execute the operation
file_op = FileOpBase.get_instance(**input_params)
Expand Down
69 changes: 39 additions & 30 deletions elyra/kfp/bootstrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,9 @@ def execute(self) -> None:
logger.error(f"Unexpected error: {sys.exc_info()[0]}")

NotebookFileOp.convert_notebook_to_html(notebook_output, notebook_html)
self.put_file_to_object_storage(notebook_output, notebook)
self.put_file_to_object_storage(notebook_html)
if enable_generic_node_script_output_to_s3:
self.put_file_to_object_storage(notebook_output, notebook)
self.put_file_to_object_storage(notebook_html)
raise ex

@staticmethod
Expand Down Expand Up @@ -487,29 +488,33 @@ def execute(self) -> None:
if self.parameter_pass_method == "env":
self.set_parameters_in_env()

with open(python_script_output, "w") as log_file:
print("Processing file:", python_script)
try:
result = subprocess.run(run_args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=True)
output = result.stdout.decode('utf-8')
logger.info(f"Output: {output}")
logger.info(f"Return code: {result.returncode}")
except subprocess.CalledProcessError as e:
logger.error("Output: %s", e.output.decode("utf-8"))
logger.error("Return code: %s", e.returncode)
raise subprocess.CalledProcessError(e.returncode, run_args)
print("Processing file:", python_script)
try:
result = subprocess.run(run_args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=True)
output = result.stdout.decode("utf-8")
if enable_generic_node_script_output_to_s3:
with open(python_script_output, "w") as log_file:
log_file.write(output)
logger.info(f"Output: {output}")
logger.info(f"Return code: {result.returncode}")
except subprocess.CalledProcessError as e:
logger.error("Output: %s", e.output.decode("utf-8"))
logger.error("Return code: %s", e.returncode)
raise subprocess.CalledProcessError(e.returncode, run_args)

duration = time.time() - t0
OpUtil.log_operation_info("python script execution completed", duration)

self.put_file_to_object_storage(python_script_output, python_script_output)
if enable_generic_node_script_output_to_s3:
self.put_file_to_object_storage(python_script_output, python_script_output)
self.process_outputs()
except Exception as ex:
# log in case of errors
logger.error(f"Unexpected error: {sys.exc_info()[0]}")
logger.error(f"Error details: {ex}")

self.put_file_to_object_storage(python_script_output, python_script_output)
if enable_generic_node_script_output_to_s3:
self.put_file_to_object_storage(python_script_output, python_script_output)
raise ex


Expand All @@ -530,29 +535,33 @@ def execute(self) -> None:
if self.parameter_pass_method == "env":
self.set_parameters_in_env()

with open(r_script_output, "w") as log_file:
print("Processing file:", r_script)
try:
result = subprocess.run(run_args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=True)
output = result.stdout.decode('utf-8')
logger.info(f"Output: {output}")
logger.info(f"Return code: {result.returncode}")
except subprocess.CalledProcessError as e:
logger.error("Output: %s", e.output.decode("utf-8"))
logger.error("Return code: %s", e.returncode)
raise subprocess.CalledProcessError(e.returncode, run_args)
print("Processing file:", r_script)
try:
result = subprocess.run(run_args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=True)
output = result.stdout.decode("utf-8")
if enable_generic_node_script_output_to_s3:
with open(r_script_output, "w") as log_file:
log_file.write(output)
logger.info(f"Output: {output}")
logger.info(f"Return code: {result.returncode}")
except subprocess.CalledProcessError as e:
logger.error("Output: %s", e.output.decode("utf-8"))
logger.error("Return code: %s", e.returncode)
raise subprocess.CalledProcessError(e.returncode, run_args)

duration = time.time() - t0
OpUtil.log_operation_info("R script execution completed", duration)

self.put_file_to_object_storage(r_script_output, r_script_output)
if enable_generic_node_script_output_to_s3:
self.put_file_to_object_storage(r_script_output, r_script_output)
self.process_outputs()
except Exception as ex:
# log in case of errors
logger.error(f"Unexpected error: {sys.exc_info()[0]}")
logger.error(f"Error details: {ex}")

self.put_file_to_object_storage(r_script_output, r_script_output)
if enable_generic_node_script_output_to_s3:
self.put_file_to_object_storage(r_script_output, r_script_output)
raise ex


Expand Down Expand Up @@ -748,7 +757,7 @@ def main():
input_params = OpUtil.parse_arguments(sys.argv[1:])
OpUtil.log_operation_info("starting operation")
t0 = time.time()
OpUtil.package_install(user_volume_path=input_params.get("user-volume-path")) # can be commented out in airgapped images if packages installed via central pip env during container build
OpUtil.package_install(user_volume_path=input_params.get("user-volume-path")) # must be commented out in airgapped images if packages from https://github.com/elyra-ai/elyra/blob/main/etc/generic/requirements-elyra.txt already installed via central pip env during container build

# Create the appropriate instance, process dependencies and execute the operation
file_op = FileOpBase.get_instance(**input_params)
Expand All @@ -765,4 +774,4 @@ def main():


if __name__ == "__main__":
main()
main()

0 comments on commit c3eba17

Please sign in to comment.