diff --git a/examples/customizing_dependencies/customizing_dependencies/calculate-ellipse-area-new.py b/examples/customizing_dependencies/customizing_dependencies/calculate-ellipse-area-new.py new file mode 100644 index 000000000..7c589da7c --- /dev/null +++ b/examples/customizing_dependencies/customizing_dependencies/calculate-ellipse-area-new.py @@ -0,0 +1,29 @@ +import math +import sys + + +def write_output(output_dir, output_file, v): + with open(f"{output_dir}/{output_file}", "w") as f: + f.write(str(v)) + + +def calculate_area(a, b): + return math.pi * a * b + + +def main(a, b, output_dir): + a = float(a) + b = float(b) + + area = calculate_area(a, b) + + write_output(output_dir, "area", area) + write_output(output_dir, "metadata", "[from python rawcontainer]") + + +if __name__ == "__main__": + a = sys.argv[1] + b = sys.argv[2] + output_dir = sys.argv[3] + + main(a, b, output_dir) diff --git a/examples/customizing_dependencies/customizing_dependencies/raw_container.py b/examples/customizing_dependencies/customizing_dependencies/raw_container.py index ad6615fc8..6d29e0761 100644 --- a/examples/customizing_dependencies/customizing_dependencies/raw_container.py +++ b/examples/customizing_dependencies/customizing_dependencies/raw_container.py @@ -40,11 +40,11 @@ base_image="ghcr.io/flyteorg/rawcontainers-python:v2", registry="localhost:30000", builder="default", - copy=["calculate-ellipse-area.py"], + copy=["calculate-ellipse-area-new.py"], ), command=[ "python", - "calculate-ellipse-area.py", + "calculate-ellipse-area-new.py", "{{.inputs.a}}", "{{.inputs.b}}", "/var/outputs",