scailable / sclblpy

Python package for Scailable uploads
MIT License
19 stars 1 forks source link

Fix run() #44

Closed MKaptein closed 3 years ago

MKaptein commented 3 years ago

Currently run() adds two square brackets "[[" and "]]" around the REST request to the task. It should do this only if a csv is supplied (for the sklearn cases), and not if it's called using "pb" or "raw". Thus, currently sclblpy.run() does not work on pipelines generated from sclblonnx.

Suggested fix:

CSV:

 payload = "{\"input\":{\"content-type\":\"json\",\"location\":\"embedded\",\"data\":\"{\\\"input\\\": [[" + data + "]]}\"},\"output\":{\"content-type\":\"json\",\"location\":\"echo\"},\"control\":1,\"properties\":{\"language\":\"WASM\"}}"

Explicitly add type="csv"

raw:

 payload = "{\"input\":{\"content-type\":\"json\",\"location\":\"embedded\",\"data\":\"{\\\"input\\\": " + data + ", \\\"type\\\":\\\"raw\\\"}\"},\"output\":{\"content-type\":\"json\",\"location\":\"echo\"},\"control\":1,\"properties\":{\"language\":\"WASM\"}}"

Note the raw type in the data field.

PB:

 payload = "{\"input\":{\"content-type\":\"json\",\"location\":\"embedded\",\"data\":\"{\\\"input\\\": " + data + "}\"},\"output\":{\"content-type\":\"json\",\"location\":\"echo\"},\"control\":1,\"properties\":{\"language\":\"WASM\"}}"

Also add the pb type in the data field.

MKaptein commented 3 years ago

This is fixed with: https://github.com/scailable/sclblpy/commit/ee6d5eac0eff7e962f67a45caeef4d54c530f479