スクリプトのリスト

get

/api/py-scripts/v1/scripts

現在のユーザーがアクセスできるスクリプトをリストします。

リクエスト

この操作にはリクエスト・パラメータはありません。

先頭に戻る

レスポンス

サポートされているメディア・タイプ

200レスポンス

アクセス可能なpythonスクリプトのリスト。
本文()
ルート・スキーマ: schema
型: array
ソースの表示
ネストされたスキーマ: EmbedScript
型: object
ソースの表示

500レスポンス

ブローカへの接続中、ジョブの実行中に問題が発生したか、または他の予期しないエラーが発生しました。
本文()
ルート・スキーマ: ComputeContainerException
型: object
ソースの表示
先頭に戻る

次の例では、Oracle Machine Learning for Python (OML4Py)スクリプト・リポジトリで使用可能なスクリプトをリストします。この例では、リポジトリに5つのスクリプトがあります。すべてがユーザーOML_USERによって所有されます。

curl -i -X GET --header "Authorization: Bearer ${token}" \
--header 'Accept: application/json' \
"<oml-cloud-service-location-url>/oml/api/py-scripts/v1/scripts"

レスポンス・ヘッダー

レスポンス・ヘッダーは次のとおりです。

HTTP/1.1 200 OK
Date: Thu, 27 Aug 2020 16:14:24 GMT
Content-Type: application/json
Content-Length: 5023
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=node01uxykm5vsa7qy18dif7nd7sabl717.node0; Path=/oml; Secure; HttpOnly
Expires: Thu, 01 Jan 1970 00:00:00 GMT

レスポンス本文

JSON形式のレスポンス本文は次のとおりです。

{"result":[
{"owner":"OML_USER","date":"2020-08-27T15:53:56.000Z","name":"return_df","description":null,"script":"def return_df(num, scale):\n    import pandas as pd\n    id = list(range(0, int(num)))\n    res = [i/scale for i in id]\n    return pd.DataFrame({\"ID\":id, \"RES\":res})"},
{"owner":"OML_USER","date":"2020-08-27T16:09:17.000Z","name":"RandomRedDots","description":null,"script":"def RandomRedDots (num_dots_1=100, num_dots_2=10):\n  import numpy as np\n  import pandas as pd\n  import matplotlib.pyplot as plt  \n  d = {'id': range(1,10), 'val': [x/100 for x in range(1,10)]}\n  df = pd.DataFrame(data=d)\n  fig = plt.figure(1)\n  ax = fig.add_subplot(111)\n  ax.scatter(range(0,int(num_dots_1)), np.random.rand(int(num_dots_1)),c='r')\n  fig.suptitle(\"Random Red Dots\")\n  fig2 = plt.figure(2)\n  ax2 = fig2.add_subplot(111)\n  ax2.scatter(range(0,int(num_dots_2)), np.random.rand(int(num_dots_2)),c='r')\n  fig2.suptitle(\"Random Red Dots\")\n  return df"},
{"owner":"OML_USER","date":"2020-08-26T20:38:57.000Z","name":"compute_random_mean","description":null,"script":"def compute_random_mean(index):\n    import numpy as np\n    import scipy\n    from statistics import mean \n    np.random.seed(index)\n    res = np.random.random((100,1))*10\n    return mean(res[1])"},
{"owner":"OML_USER","date":"2020-08-18T21:35:06.000Z","name":"group_count","description":null,"script":"def group_count(dat):\n  import oml\n  import pandas as pd\n  return pd.DataFrame([(dat[\"SPECIES\"][0], dat[\"SEPAL_LENGTH\"][0], dat.shape[0])],   columns = [\"SPECIES\",\"SEPAL_LENGTH\", \"COUNT\"])"},
{"owner":"OML_USER","date":"2020-08-21T18:22:38.000Z","name":"my_predict","description":null,"script":"def my_predict(dat):\n    import pandas as pd\n    import oml\n    obj_dict = oml.ds.load(name=\"ds_regr\", to_globals=False)  \n    regr = obj_dict[\"regr\"]                                 # get the regr model. Ask Qin..can we change this?  Is it technically feasible?\n    pred = regr.predict(dat[['Sepal_Length', \n                             'Sepal_Width',\n                             'Petal_Length']])\n    return pd.concat([dat[['Species', 'Petal_Width']], \n                     pd.DataFrame(pred, \n                                  columns=['Pred_Petal_Width'])], \n                                  axis=1)"},
]}
先頭に戻る