Update main_app.py
Browse files- main_app.py +19 -2
main_app.py
CHANGED
@@ -834,8 +834,25 @@ def _(
|
|
834 |
# # Using the absolute file path might help in some environments
|
835 |
# func_details = deployment_client.repository.store_function(abs_file_path, function_meta)
|
836 |
# Upload using the file path approach
|
837 |
-
|
838 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
839 |
|
840 |
set_upload_status(f"Latest Upload - id - {func_details['metadata']['id']}")
|
841 |
return func_details
|
|
|
834 |
# # Using the absolute file path might help in some environments
|
835 |
# func_details = deployment_client.repository.store_function(abs_file_path, function_meta)
|
836 |
# Upload using the file path approach
|
837 |
+
|
838 |
+
# Create a zip file of the Python module
|
839 |
+
import gzip
|
840 |
+
import shutil
|
841 |
+
|
842 |
+
# Path for the gzipped file
|
843 |
+
gz_path = f"{save_dir}/{func_name}.py.gz"
|
844 |
+
|
845 |
+
# Create gzip file
|
846 |
+
with open(file_path, 'rb') as f_in:
|
847 |
+
with gzip.open(gz_path, 'wb') as f_out:
|
848 |
+
shutil.copyfileobj(f_in, f_out)
|
849 |
+
|
850 |
+
# Upload using the gzipped file path
|
851 |
+
mo.md(f"Uploading function from gzip: {gz_path}")
|
852 |
+
func_details = deployment_client.repository.store_function(gz_path, function_meta)
|
853 |
+
|
854 |
+
# mo.md(f"Uploading function from file: {file_path}")
|
855 |
+
# func_details = deployment_client.repository.store_function(file_path, function_meta)
|
856 |
|
857 |
set_upload_status(f"Latest Upload - id - {func_details['metadata']['id']}")
|
858 |
return func_details
|