Skip to content

Commit 0a4758e

Browse files
vkb1Copilotpooja-intel
authored
timeseries, multimodal: Update sample apps from zip to tar for UDF package uploads (open-edge-platform#2441)
Updates the Time Series and Multimodal sample apps to match the Time Series Analytics microservice change where /ts-api/udfs/package now expects TAR uploads instead of ZIP, keeping local/dev workflows and docs consistent with the new packaging format. Changes: - Switched UDF package creation/upload from .zip to .tar in both sample-app Makefiles. - Updated user-guide docs (Time Series + Multimodal) to instruct TAR creation and TAR upload commands. - Updated the Time Series test utility (helm_utils.py) to build/copy/upload a TAR artifact and set the TAR MIME type. Signed-off-by: Pooja Kumbharkar <pooja.kumbharkar@intel.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: vkb1 <19564820+vkb1@users.noreply.github.com> Co-authored-by: Pooja Kumbharkar <pooja.kumbharkar@intel.com>
1 parent 72a2d0b commit 0a4758e

File tree

6 files changed

+49
-49
lines changed

6 files changed

+49
-49
lines changed

manufacturing-ai-suite/industrial-edge-insights-multimodal/Makefile

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -142,22 +142,22 @@ wait_for_tsam:
142142
done; \
143143
echo "Time-Series Analytics microservice is accessible."
144144

145-
upload_zip_file:
146-
@echo "Creating UDF deployment zip for weld anomaly detection..."
145+
upload_tar_file:
146+
@echo "Creating UDF deployment tar for weld anomaly detection..."
147147
@config_dir=$(CURDIR)/configs/time-series-analytics-microservice; \
148-
zip_file=$(CURDIR)/configs/time-series-analytics-microservice/weld_anomaly_detector.zip; \
149-
rm -f $$zip_file; \
148+
tar_file=$(CURDIR)/configs/time-series-analytics-microservice/weld_anomaly_detector.tar; \
149+
rm -f $$tar_file; \
150150
cd $$config_dir && \
151151
folders="udfs tick_scripts"; \
152152
if [ -d models ] && [ -n "$$(ls -A models 2>/dev/null)" ]; then folders="$$folders models"; fi; \
153-
zip -r $$zip_file $$folders && \
154-
echo "Created: $$zip_file"
153+
tar cf $$tar_file $$folders && \
154+
echo "Created: $$tar_file"
155155
@$(MAKE) wait_for_tsam
156-
@echo "Uploading UDF deployment zip for weld anomaly detection to Time-Series Analytics microservice..."; \
157-
zip_file=$(CURDIR)/configs/time-series-analytics-microservice/weld_anomaly_detector.zip; \
156+
@echo "Uploading UDF deployment tar for weld anomaly detection to Time-Series Analytics microservice..."; \
157+
tar_file=$(CURDIR)/configs/time-series-analytics-microservice/weld_anomaly_detector.tar; \
158158
response=$$(curl -s -o /tmp/upload_response.json -w "%{http_code}" \
159159
-X POST https://localhost:${GRAFANA_PORT}/ts-api/udfs/package \
160-
-F "file=@$$zip_file" \
160+
-F "file=@$$tar_file" \
161161
-k); \
162162
if [ "$$response" = "200" ]; then \
163163
echo "Upload successful (HTTP $$response)."; \
@@ -200,7 +200,7 @@ up: check_env_variables validate_host_ip down
200200
else \
201201
$(DOCKER_COMPOSE) up -d; \
202202
fi; \
203-
$(MAKE) upload_zip_file
203+
$(MAKE) upload_tar_file
204204

205205
# Status of the deployed containers
206206
.PHONY: status

manufacturing-ai-suite/industrial-edge-insights-multimodal/docs/user-guide/get-started/deploy-with-helm.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,10 @@ this sample application in Kubernetes environment:
137137

138138
```bash
139139
cd edge-ai-suites/manufacturing-ai-suite/industrial-edge-insights-multimodal/configs/time-series-analytics-microservice # path relative to git clone folder
140-
rm -f weld_anomaly_detector.zip
141-
zip -r weld_anomaly_detector udfs/ models/ tick_scripts/
140+
rm -f weld_anomaly_detector.tar
141+
tar cf weld_anomaly_detector.tar udfs/ models/ tick_scripts/
142142
143-
curl -X POST https://localhost:30001/ts-api/udfs/package -F "file=@weld_anomaly_detector.zip" -k
143+
curl -X POST https://localhost:30001/ts-api/udfs/package -F "file=@weld_anomaly_detector.tar" -k
144144
```
145145

146146
> **Note:**

manufacturing-ai-suite/industrial-edge-insights-time-series/Makefile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -133,22 +133,22 @@ wait_for_tsam:
133133
done; \
134134
echo "Time-Series Analytics microservice is accessible."
135135

136-
upload_zip_file:
137-
@echo "Creating UDF deployment zip for $(SAMPLE_APP)..."
136+
upload_tar_file:
137+
@echo "Creating UDF deployment tar for $(SAMPLE_APP)..."
138138
@config_dir=$(CURDIR)/apps/$(SAMPLE_APP)/time-series-analytics-config; \
139-
zip_file=$(CURDIR)/apps/$(SAMPLE_APP)/time-series-analytics-config/$(SAMPLE_APP).zip; \
140-
rm -f $$zip_file; \
139+
tar_file=$(CURDIR)/apps/$(SAMPLE_APP)/time-series-analytics-config/$(SAMPLE_APP).tar; \
140+
rm -f $$tar_file; \
141141
cd $$config_dir && \
142142
folders="udfs tick_scripts"; \
143143
if [ -d models ] && [ -n "$$(ls -A models 2>/dev/null)" ]; then folders="$$folders models"; fi; \
144-
zip -r $$zip_file $$folders && \
145-
echo "Created: $$zip_file"
144+
tar cf $$tar_file $$folders && \
145+
echo "Created: $$tar_file"
146146
@$(MAKE) wait_for_tsam
147-
@echo "Uploading UDF deployment zip for $(SAMPLE_APP) to Time-Series Analytics microservice..."; \
148-
zip_file=$(CURDIR)/apps/$(SAMPLE_APP)/time-series-analytics-config/$(SAMPLE_APP).zip; \
147+
@echo "Uploading UDF deployment tar for $(SAMPLE_APP) to Time-Series Analytics microservice..."; \
148+
tar_file=$(CURDIR)/apps/$(SAMPLE_APP)/time-series-analytics-config/$(SAMPLE_APP).tar; \
149149
response=$$(curl -s -o /tmp/upload_response.json -w "%{http_code}" \
150150
-X POST https://localhost:${GRAFANA_PORT}/ts-api/udfs/package \
151-
-F "file=@$$zip_file" \
151+
-F "file=@$$tar_file" \
152152
-k); \
153153
if [ "$$response" = "200" ]; then \
154154
echo "Upload successful (HTTP $$response)."; \
@@ -202,7 +202,7 @@ up_mqtt_ingestion: check_env_variables down
202202
done; \
203203
$(DOCKER_COMPOSE) up --scale ia-opcua-server=0 -d $(shell $(DOCKER_COMPOSE) config --services | grep -v ia-mqtt-publisher); \
204204
fi; \
205-
$(MAKE) upload_zip_file app=$(SAMPLE_APP);
205+
$(MAKE) upload_tar_file app=$(SAMPLE_APP);
206206

207207
# Run Docker containers
208208
.PHONY: up_opcua_ingestion
@@ -223,7 +223,7 @@ up_opcua_ingestion: check_env_variables down
223223
else \
224224
$(DOCKER_COMPOSE) up --scale ia-opcua-server=$(num_of_streams) --scale ia-mqtt-publisher=0 -d; \
225225
fi; \
226-
$(MAKE) upload_zip_file app=$(SAMPLE_APP);
226+
$(MAKE) upload_tar_file app=$(SAMPLE_APP);
227227

228228

229229
# Status of the deployed containers

manufacturing-ai-suite/industrial-edge-insights-time-series/docs/user-guide/get-started/deploy-with-helm.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,10 @@ To copy your own or existing model into Time Series Analytics Microservice in or
189189
```sh
190190
export SAMPLE_APP="wind-turbine-anomaly-detection"
191191
cd edge-ai-suites/manufacturing-ai-suite/industrial-edge-insights-time-series/apps/wind-turbine-anomaly-detection/time-series-analytics-config # path relative to git clone folder
192-
rm -f ${SAMPLE_APP}.zip
193-
zip -r ${SAMPLE_APP}.zip models/ tick_scripts/ udfs/
192+
rm -f ${SAMPLE_APP}.tar
193+
tar cf ${SAMPLE_APP}.tar models/ tick_scripts/ udfs/
194194
195-
curl -X POST https://localhost:30001/ts-api/udfs/package -F "file=@${SAMPLE_APP}.zip" -k
195+
curl -X POST https://localhost:30001/ts-api/udfs/package -F "file=@${SAMPLE_APP}.tar" -k
196196
```
197197

198198
<!--hide_directive:::
@@ -219,10 +219,10 @@ To copy your own or existing model into Time Series Analytics Microservice in or
219219
```sh
220220
export SAMPLE_APP="weld-anomaly-detection"
221221
cd edge-ai-suites/manufacturing-ai-suite/industrial-edge-insights-time-series/apps/weld-anomaly-detection/time-series-analytics-config # path relative to git clone folder
222-
rm -f ${SAMPLE_APP}.zip
223-
zip -r ${SAMPLE_APP}.zip models/ tick_scripts/ udfs/
222+
rm -f ${SAMPLE_APP}.tar
223+
tar cf ${SAMPLE_APP}.tar models/ tick_scripts/ udfs/
224224
225-
curl -X POST https://localhost:30001/ts-api/udfs/package -F "file=@${SAMPLE_APP}.zip" -k
225+
curl -X POST https://localhost:30001/ts-api/udfs/package -F "file=@${SAMPLE_APP}.tar" -k
226226
```
227227

228228
<!--hide_directive:::

manufacturing-ai-suite/industrial-edge-insights-time-series/docs/user-guide/how-to-guides/configure-alerts.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,9 @@ cd edge-ai-suites/manufacturing-ai-suite/industrial-edge-insights-time-series/ap
185185
cd time-series-analytics-config
186186
export SAMPLE_APP="wind-turbine-anomaly-detection"
187187

188-
rm -f ${SAMPLE_APP}.zip
189-
zip -r ${SAMPLE_APP}.zip models/ tick_scripts/ udfs/
190-
curl -X POST https://localhost:3000/ts-api/udfs/package -F "file=@${SAMPLE_APP}.zip" -k
188+
rm -f ${SAMPLE_APP}.tar
189+
tar cf ${SAMPLE_APP}.tar models/ tick_scripts/ udfs/
190+
curl -X POST https://localhost:3000/ts-api/udfs/package -F "file=@${SAMPLE_APP}.tar" -k
191191
```
192192

193193
#### 2. Configuring OPC-UA Alert in config.json
@@ -326,10 +326,10 @@ To enable OPC-UA alerts in `Time Series Analytics Microservice`, please follow b
326326
cd edge-ai-suites/manufacturing-ai-suite/industrial-edge-insights-time-series/apps/wind-turbine-anomaly-detection # path relative to git clone folder
327327
cd time-series-analytics-config
328328
export SAMPLE_APP="wind-turbine-anomaly-detection"
329-
rm -f ${SAMPLE_APP}.zip
330-
zip -r ${SAMPLE_APP}.zip models/ tick_scripts/ udfs/
329+
rm -f ${SAMPLE_APP}.tar
330+
tar cf ${SAMPLE_APP}.tar models/ tick_scripts/ udfs/
331331

332-
curl -X POST https://localhost:30001/ts-api/udfs/package -F "file=@${SAMPLE_APP}.zip" -k
332+
curl -X POST https://localhost:30001/ts-api/udfs/package -F "file=@${SAMPLE_APP}.tar" -k
333333
```
334334

335335
3. Configuring OPC-UA Alert in `config.json`

manufacturing-ai-suite/industrial-edge-insights-time-series/tests/utils/helm_utils.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,16 +1620,16 @@ def with_model_registry(chart_path, input):
16201620
logger.info("Files copied successfully to 'wind-turbine-anomaly-detection' directory.")
16211621
elif result.stderr:
16221622
logger.error(f"Error copying files: {result.stderr.decode('utf-8')}")
1623-
zip_command = f"zip -r windturbine_anomaly_detector.zip udfs models tick_scripts"
1624-
result = subprocess.run(zip_command, shell=True, capture_output=True, text=True, check=True)
1623+
tar_command = f"tar cf windturbine_anomaly_detector.tar udfs models tick_scripts"
1624+
result = subprocess.run(tar_command, shell=True, capture_output=True, text=True, check=True)
1625+
logger.info("TAR archive created successfully.")
16251626
if result.stdout:
1626-
logger.info(f"ZIP command output: {result.stdout}")
1627-
logger.info("ZIP archive created successfully.")
1628-
elif result.stderr:
1629-
logger.error(f"ZIP command errors: {result.stderr}")
1627+
logger.info(f"TAR command output: {result.stdout}")
1628+
if result.stderr:
1629+
logger.error(f"TAR command stderr: {result.stderr}")
16301630

16311631

1632-
# Step 2: Upload the ZIP file using kubectl exec to avoid port-forwarding
1632+
# Step 2: Upload the tar file using kubectl exec to avoid port-forwarding
16331633
# Find the model registry pod
16341634
model_registry_pod_command = (
16351635
f"kubectl get pods -n {namespace} "
@@ -1644,16 +1644,16 @@ def with_model_registry(chart_path, input):
16441644
logger.error("Model registry pod not found.")
16451645
return False
16461646

1647-
# Copy the ZIP file to the model registry pod first
1647+
# Copy the TAR file to the model registry pod first
16481648
kubectl_cp_command = [
1649-
'kubectl', 'cp', 'windturbine_anomaly_detector.zip',
1650-
f'{model_registry_pod}:/tmp/windturbine_anomaly_detector.zip',
1649+
'kubectl', 'cp', 'windturbine_anomaly_detector.tar',
1650+
f'{model_registry_pod}:/tmp/windturbine_anomaly_detector.tar',
16511651
'-n', namespace
16521652
]
1653-
logger.info(f"Copying ZIP file to model registry pod: {' '.join(kubectl_cp_command)}")
1653+
logger.info(f"Copying TAR file to model registry pod: {' '.join(kubectl_cp_command)}")
16541654
result = subprocess.run(kubectl_cp_command, capture_output=True, text=True)
16551655
if result.returncode != 0:
1656-
logger.error(f"Error copying ZIP file to pod: {result.stderr}")
1656+
logger.error(f"Error copying TAR file to pod: {result.stderr}")
16571657
return False
16581658

16591659
# Upload using curl from within the pod (in-cluster call)
@@ -1663,7 +1663,7 @@ def with_model_registry(chart_path, input):
16631663
'-H', 'Content-Type: multipart/form-data',
16641664
'-F', 'name="windturbine_anomaly_detector"',
16651665
'-F', 'version="1.0"',
1666-
'-F', 'file=@/tmp/windturbine_anomaly_detector.zip;type=application/zip'
1666+
'-F', 'file=@/tmp/windturbine_anomaly_detector.tar;type=application/x-tar'
16671667
]
16681668
logger.info(f"Uploading model via kubectl exec: {' '.join(upload_command)}")
16691669
result = subprocess.run(upload_command, capture_output=True, text=True)

0 commit comments

Comments
 (0)