為指定叢集建立一個作業。
介面說明
請確保在使用該介面前,已充分瞭解 E-HPC 產品的收費方式和價格。
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
調試
授權資訊
|
操作 |
存取層級 |
資源類型 |
條件關鍵字 |
關聯操作 |
|
ehpc:CreateJob |
create |
*全部資源
|
無 | 無 |
請求參數
|
名稱 |
類型 |
必填 |
描述 |
樣本值 |
| ClusterId |
string |
是 |
叢集 ID。 您可以通過調用 ListClusters 擷取叢集 ID。 |
ehpc-hz-FYUr32**** |
| JobName |
string |
否 |
作業名稱。 |
TestJob |
| JobSpec |
object |
否 |
作業配置資訊。 |
|
| CommandLine |
string |
是 |
作業運行命令或指令碼,如果是命令,需指定命令完整路徑,如: /bin/ping; 如果希望通過指令碼運行作業,則對應指令碼需要有可執行許可權。叢集側預設以使用者根目錄作為指令碼預設路徑,即~/目錄。如您的指令碼不在該目錄下,需在該參數中指定完整路徑,如:/home/xxx/job.sh。請注意在這種方式下,如果指令碼中指定了 CPU、記憶體等資源需求,作業將以指令碼中指定的資源為準,請不要在 Resource 參數中指定相關資源需求,否則作業可能運行失敗。 如果希望直接通過命令列命令運行作業,則需要指定命令的絕對路徑,並在前面添加--,如:-- /bin/ping -c 10 localhost |
/home/xxx/test.job |
| RunasUser |
string |
否 |
提交作業所使用的使用者,該使用者屬於叢集側使用者 |
testuser |
| RunasUserPassword |
string |
否 |
RunasUser 參數所指定使用者的密碼 |
xxx |
| Priority |
string |
否 |
作業優先順序 |
1 |
| StdoutPath |
string |
否 |
作業標準輸出檔案,需要指定完整路徑 |
/home/xxx/job.out |
| StderrPath |
string |
否 |
作業標準錯誤輸出檔案,需要指定完整路徑 |
/home/xxx/job.err |
| JobQueue |
string |
否 |
作業所屬隊列。 |
comp |
| ArrayRequest |
string |
否 |
數組作業參數。 格式為 X-Y:Z, 最小值 X 是第一個索引,最大值 Y 是最後一個索引,Z 表示步長,例如 2-7:2,表示作業隊列包含編號為 2、4、6 的 3 個子作業。 |
1-5:2 |
| Variables |
string |
否 |
作業的環境變數。json 數組格式的字串,每個數群組成員為 json 格式對象,包含 Name 和 Value 兩個成員,Name 表示環境變數的名稱,Value 表示環境變數的值。 |
[{"Name":"x", "Value":"y"}] |
| PostCmdLine |
string |
否 |
作業後處理命令。 |
/bin/sleep 10 |
| WallTime |
string |
否 |
作業最大已耗用時間,格式為 |
360:48:50 |
| Resources |
object |
否 |
作業所需資源配置。 |
|
| Nodes |
integer |
否 |
作業需要分配的計算節點數。 |
2 |
| Cores |
integer |
否 |
作業每個計算節點需要分配的 CPU 核心數。 |
2 |
| Memory |
string |
否 |
作業每個計算節點需要分配的記憶體大小,字串格式,包含單位,mb(M 位元組)或 gb(千MB)。 |
4gb |
| Gpus |
integer |
否 |
作業每個計算節點需要分配的 GPU 數。 |
1 |
返回參數
|
名稱 |
類型 |
描述 |
樣本值 |
|
object |
返回參數集合。 |
||
| RequestId |
string |
請求 ID。 |
A0A38A38-1565-555E-B597-E48A2E****** |
| JobId |
string |
作業 ID。 |
Submitted batch job 10\n |
| Success |
string |
調用是否成功。 |
true |
樣本
正常返回樣本
JSON格式
{
"RequestId": "A0A38A38-1565-555E-B597-E48A2E******",
"JobId": "Submitted batch job 10\\n",
"Success": "true"
}
錯誤碼
|
HTTP status code |
錯誤碼 |
錯誤資訊 |
描述 |
|---|---|---|---|
| 400 | InvalidParams | The specified parameter %s is invalid. | 指定的參數 %s 無效。 |
| 403 | InvalidClusterStatus | The operation failed due to invalid cluster status. | 叢集狀態不允許執行本次操作。 |
| 404 | ClusterNotFound | The specified cluster does not exist. | 指定的叢集不存在,請您檢查該參數是否正確。 |
| 503 | ServiceUnavailable | The request has failed due to a temporary failure of the server | 請求失敗,服務暫時不可用 |
| 406 | EcsError | An error occurred while calling the ECS API operation. | ECS API調用出錯. %s |
| 406 | AgentError | The agent service request failed: %s | 操作未成功:%s |
| 406 | AgentError.Job.SubmitFailure | Failed to submit jobs: %s | 提交作業失敗: {%s} |
| 406 | AgentError.Job.DeleteFailure | Failed to delete job: %s | 刪除作業失敗: {} |
| 406 | AgentError.Job.InvalidContainerType | Unsupported container type: %s. | 無效容器類型:%s |
| 406 | AgentError.Job.ListFailure | Failed to list jobs: %s. | 擷取作業列表失敗:{} |
| 406 | AgentError.Job.RerunFailure | Failed to run the job again: %s. | 重運行作業失敗: {} |
| 406 | AgentError.Job.StopFailure | Failed to stop jobs: %s. | 停止作業失敗:{} |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。