DBからのジョブIDの削除

delete

/py-scripts/v1/jobs/{jobId}

job_idによる表からのジョブの削除

リクエスト

パス・パラメータ
先頭に戻る

レスポンス

202レスポンス

ジョブはまだ保留中です。

302レスポンス

ジョブの結果をフェッチできるContent-Locationヘッダーを返します。
ヘッダー

401レスポンス

ユーザーにアクションを実行する権限がない場合。

500レスポンス

ブローカへの接続中、ジョブIDの検出中に問題が発生したか、または他の予期しないエラーが発生しました。
先頭に戻る

実行に時間がかかりすぎているPython関数を中断または削除する必要がある場合は、cURLを使用してDELETEリクエストを送信し、実行中の関数コールを停止できます。実行中のジョブを削除するには、次のステップに従います:

  1. 関数の定義: 関数delayed_task()は、完了までにかなりの時間を要します。
    import oml 
    
    delayed_task = """def delayed_task():
        import time
        time.sleep(60*50)"""
     
    oml.script.create("delayed_task", delayed_task, is_global=True, overwrite=True)
  2. スクリプトの実行: 次のcURLコマンドは、delayed_taskという名前のスクリプトを非同期値で実行します。
    curl -i -k -X POST --header "Authorization: Bearer ${token}" 
    --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"service":"LOW","asyncFlag":true, "timeout": 4800}'  
    "https://<server>/oml/api/py-scripts/v1/do-eval/delayed_task"
    HTTP/1.1 201 Created
    Date: Mon, 10 Feb 2025 22:02:07 GMT
    Content-Length: 0
    Connection: keep-alive
    Strict-Transport-Security: max-age=31536000; includeSubDomains
    X-Content-Type-Options: nosniff
    Cache-Control: no-cache, no-store, must-revalidate
    Pragma: no-cache
    X-Frame-Options: SAMEORIGIN
    X-XSS-Protection: 1;mode=block
    Content-Security-Policy: default-src 'none'; connect-src 'self'; font-src 'self' static.oracle.com; img-src 'self' data: static.oracle.com; media-src 'none'; object-src 'none'; script-src 'self' static.oracle.com 'unsafe-inline' 'unsafe-eval'; style-src 'self' static.oracle.com 'unsafe-inline'; frame-ancestors 'none'
    Set-Cookie: JSESSIONID=node0ek02l8eh8vwd18g92em0oj8bg1.node0; Path=/oml; Secure; HttpOnly
    Expires: Thu, 01 Jan 1970 00:00:00 GMT
    Location: https://<server>/oml/api/py-scripts/v1/jobs/0836ae69-f0ef-42d5-8773-f66b4b7fd4bb
  3. ジョブ・ステータスの確認: IDのジョブをチェックして、ジョブが実行中かどうかを確認します。
    curl -i -k -X GET --header "Authorization: Bearer ${token}" 
    --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"service":"LOW"}'  
    "https://<server>/oml/api/py-scripts/v1/jobs/0836ae69-f0ef-42d5-8773-f66b4b7fd4bb"
    HTTP/1.1 202 Accepted
    Date: Mon, 10 Feb 2025 22:02:51 GMT
    Content-Type: application/json
    Content-Length: 93
    Connection: keep-alive
    Strict-Transport-Security: max-age=31536000; includeSubDomains
    X-Content-Type-Options: nosniff
    Cache-Control: no-cache, no-store, must-revalidate
    Pragma: no-cache
    X-Frame-Options: SAMEORIGIN
    X-XSS-Protection: 1;mode=block
    Content-Security-Policy: default-src 'none'; connect-src 'self'; font-src 'self' static.oracle.com; img-src 'self' data: static.oracle.com; media-src 'none'; object-src 'none'; script-src 'self' static.oracle.com 'unsafe-inline' 'unsafe-eval'; style-src 'self' static.oracle.com 'unsafe-inline'; frame-ancestors 'none'
     
    {"createdDate":" Feb 10,2025 22:02","status":"job is still running","elapsedTime":"00:00:44"}
    
  4. ジョブの削除: ジョブIDが0836ae69-f0ef-42d5-8773-f66b4b7fd4bbのジョブを削除します。
    curl -i -k -X DELETE  --header "Authorization: Bearer ${token}" --header 'Content-Type: application/json' 
    --header 'Accept: application/json' -d '{"service":"LOW"}'  
    "https://<server>/oml/api/py-scripts/v1/jobs/0836ae69-f0ef-42d5-8773-f66b4b7fd4bb"
    HTTP/1.1 200 OK
    Date: Mon, 10 Feb 2025 22:03:43 GMT
    Content-Type: application/json
    Content-Length: 112
    Connection: keep-alive
    Strict-Transport-Security: max-age=31536000; includeSubDomains
    X-Content-Type-Options: nosniff
    Cache-Control: no-cache, no-store, must-revalidate
    Pragma: no-cache
    X-Frame-Options: SAMEORIGIN
    X-XSS-Protection: 1;mode=block
    Content-Security-Policy: default-src 'none'; connect-src 'self'; font-src 'self' static.oracle.com; img-src 'self' data: static.oracle.com; media-src 'none'; object-src 'none'; script-src 'self' static.oracle.com 'unsafe-inline' 'unsafe-eval'; style-src 'self' static.oracle.com 'unsafe-inline'; frame-ancestors 'none'
     
    {"Message":"Job 0836ae69-f0ef-42d5-8773-f66b4b7fd4bb sucessfully deleted container ending :  LOW-1739224926687"}
  5. 2回目のジョブ削除: 2回目のジョブIDの削除は失敗します。そのジョブにはもうアクセスできないためです。
    curl -i -k -X DELETE  --header "Authorization: Bearer ${token}" 
    --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"service":"LOW"}'  
    "https://<server>/oml/api/py-scripts/v1/jobs/0836ae69-f0ef-42d5-8773-f66b4b7fd4bb"
    HTTP/1.1 200 OK
    Date: Mon, 10 Feb 2025 22:03:49 GMT
    Content-Type: application/json
    Content-Length: 102
    Connection: keep-alive
    Strict-Transport-Security: max-age=31536000; includeSubDomains
    X-Content-Type-Options: nosniff
    Cache-Control: no-cache, no-store, must-revalidate
    Pragma: no-cache
    X-Frame-Options: SAMEORIGIN
    X-XSS-Protection: 1;mode=block
    Content-Security-Policy: default-src 'none'; connect-src 'self'; font-src 'self' static.oracle.com; img-src 'self' data: static.oracle.com; media-src 'none'; object-src 'none'; script-src 'self' static.oracle.com 'unsafe-inline' 'unsafe-eval'; style-src 'self' static.oracle.com 'unsafe-inline'; frame-ancestors 'none'
     
    {"Message":"Job 0836ae69-f0ef-42d5-8773-f66b4b7fd4bb status is FAILURE and not applicable to delete" }
先頭に戻る