Run a Python Function with Script Owner Specified

post

/api/py-scripts/v1/do-eval/{scriptName}/{ownerName}

Run the Python function with script owner specified.

Request

Supported Media Types
Path Parameters
Body ()
A JSON str of (name - value) pairs specifying arguments of the request and additional arguments to the script
Root Schema : EmbedScriptCompute
Type: object
Show Source
Example Request (application/json)
{"parameters":"{\"ds_name\":\"ds_pydata\"}", "asyncFlag":false, "service":"LOW"}
Back to Top

Response

Supported Media Types

200 Response

By default, returns the job result.
Body ()
Root Schema : JSONObject
Type: object
Show Source

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.
Body ()
Root Schema : InvalidParameterValueException
Type: object
Show Source

500 Response

Problem connecting to Broker, executing job or other unexpected error.
Body ()
Root Schema : ComputeContainerException
Type: object
Show Source
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 '{"parameters":"{\"num\":10,\"scale\":100}", "service":"LOW"}' \
"<oml-cloud-service-location-url>/oml/api/py-scripts/v1/do-eval/return_df/<owner_name>"

Response Headers

The response headers are the following:

HTTP/1.1 200 OK
Date: Mon, 17 Aug 2020 21:02:46 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=node01ee2kelpapy0xecrp89afco2k644.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":[{"RES":0,"ID":0},{"RES":0.01,"ID":1},{"RES":0.02,"ID":2},
{"RES":0.03,"ID":3},{"RES":0.04,"ID":4},{"RES":0.05,"ID":5},{"RES":0.06,"ID":6},
{"RES":0.07,"ID":7},{"RES":0.08,"ID":8},{"RES":0.09,"ID":9}]}
Back to Top