Run a Python Function on Chunks of Rows with Script Owner Specified

post

/py-scripts/v1/row-apply/{scriptName}/{ownerName}

Runs a Python function on data chunked in sets of rows with script owner specified.

Request

Path Parameters
Back to Top

Response

200 Response

By default, returns the job result.

201 Response

If asyncFlag=true, returns the location header where the status of the job can be fetched.
Headers

400 Response

Invalid parameters specified, output exceeding size limit or other script execution error.

500 Response

Problem connecting to Broker, executing job or other unexpected error.
Back to Top

Examples

The following example runs the script named return_df and specifies the script owner.

curl -i -X POST --header "Authorization: Bearer ${token}" \
--header 'Content-Type: application/json' --header 'Accept: application/json' \
-d '{"input":"select * from IRIS", "parameters":"{\"oml_input_type\":\"pandas.DataFrame\"}", "rows":4, "parallelFlag":true, "service":"LOW"}' \
"<oml-cloud-service-location-url>/oml/api/py-scripts/v1/row-apply/my_predict/<owner_name>"

Response Headers

The response headers are the following:

HTTP/1.1 200 OK
Date: Thu, 27 Aug 2020 15:56:43 GMT
Content-Type: application/json
Content-Length: 209
Connection: keep-alive
Cache-Control: no-cache, no-store, private
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1;mode=block
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
Set-Cookie: JSESSIONID=node01hcb0uek7gln31efrxvgnnc1xa714.node0; Path=/oml; Secure; HttpOnly
Expires: Thu, 01 Jan 1970 00:00:00 GMT

Response Body

The response body in JSON format is the following:

{"result":[{"Pred_Petal_Width":6.8462408185,"Species":"setosa","Petal_Width":0.2},
{"Pred_Petal_Width":5.2786489228,"Species":"versicolor","Petal_Width":1.1},
{"Pred_Petal_Width":5.0951801182,"Species":"versicolor","Petal_Width":1},...]}
Back to Top