Run an R Function on Chunks of Rows with Script Owner Specified
post
/r-scripts/v1/row-apply/{scriptName}/{ownerName}
Runs an R function on data chunked in sets of rows with script owner specified.
Request
Path Parameters
-
ownerName(required): string
The owner of the R script
-
scriptName(required): string
The name of the R script
Supported Media Types
- application/json
Root Schema : schema
Type:
Show Source
object-
asyncFlag: boolean
Whether to execute the job asynchronously.
-
envName: string
Name of the conda environment.
-
graphicsFlag: boolean
Whether to capture images rendered in the script to the result.
-
input(required): string
Query statement specifying input data.
-
parallel: integer
(int32)
Degree of parallelism.
-
parallelFlag: boolean
Whether to execute job in parallel.
-
parameters: string
A JSON str of (name - value) pairs specifying keyword arguments to be passed into the script.
-
rows(required): integer
(int32)
Number of rows to chunk by.
-
service: string
Allowed Values:
[ "LOW, MEDIUM, HIGH" ]LEVEL of the service. Default is LOW. -
timeout: integer
(int32)
Minimum Value:
1800Maximum Value:43200The timeout limit (in seconds, default 1800s) of asynchronous job. Must be used together with `asyncFlag`=true.
Response
Supported Media Types
- application/json
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.
Examples
The following example runs the script named my.predict and specifies the script owner.
curl -i -X POST --header "Authorization: Bearer ${token}" \
--header 'Content-Type: application/json' --header 'Accept: application/json' \
-d '{"input":"IRIS", "rows":50, "parallelFlag":true, "service":"MEDIUM"}' \
"<oml-cloud-service-location-url>/oml/api/r-scripts/v1/row-apply/my.predict/<owner_name>"
Response Headers
The response headers are the following:
HTTP/1.1 200 OK
Date: Thu, 28 Jul 2022 21:04:18 GMT
Content-Type: application/json
Content-Length: 1820
Connection: keep-alive
Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1;mode=block
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
Content-Security-Policy: frame-ancestors 'none'Response Body
The response body in JSON format is the following:
{"result":[{"PRED":4.7227,"Sepal.Length":4.6},{"PRED":4.5396,"Sepal.Length":4.3},{"PRED":4.6902,"Sepal.Length":5},{"PRED":5.0869,"Sepal.Length":5.8},{"PRED":4.6739,"Sepal.Length":4.4},{"PRED":4.7731,"Sepal.Length":4.4},...