Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add specific reasons for failed task submission #218

Merged
merged 7 commits into from
Feb 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions internal/cacctmgr/cacctmgr.go
Original file line number Diff line number Diff line change
@@ -352,7 +352,7 @@ func AddAccount(account *protos.AccountInfo) util.CraneCmdError {
fmt.Println("Account added successfully.")
return util.ErrorSuccess
} else {
fmt.Printf("Failed to add account: %s.\n", util.ErrMsg(reply.GetReason()))
fmt.Printf("Failed to add account: %s.\n", util.ErrMsg(reply.GetCode()))
return util.ErrorBackend
}
}
@@ -410,7 +410,7 @@ func AddUser(user *protos.UserInfo, partition []string, level string, coordinato
fmt.Println("User added successfully.")
return util.ErrorSuccess
} else {
fmt.Printf("Failed to add user: %s.\n", util.ErrMsg(reply.GetReason()))
fmt.Printf("Failed to add user: %s.\n", util.ErrMsg(reply.GetCode()))
return util.ErrorBackend
}
}
@@ -443,7 +443,7 @@ func AddQos(qos *protos.QosInfo) util.CraneCmdError {
fmt.Println("QoS added successfully.")
return util.ErrorSuccess
} else {
fmt.Printf("Failed to add QoS: %s.\n", util.ErrMsg(reply.GetReason()))
fmt.Printf("Failed to add QoS: %s.\n", util.ErrMsg(reply.GetCode()))
return util.ErrorBackend
}
}
@@ -466,10 +466,10 @@ func DeleteAccount(name string) util.CraneCmdError {
}
}
if reply.GetOk() {
fmt.Printf("Delete account %s succeeded.\n", name)
fmt.Printf("Successfully deleted account '%s'.\n", name)
return util.ErrorSuccess
} else {
fmt.Printf("Delete account %s failed: %s.\n", name, util.ErrMsg(reply.GetReason()))
fmt.Printf("Failed to delete account %s: %s.\n", name, util.ErrMsg(reply.GetCode()))
return util.ErrorBackend
}
}
@@ -492,10 +492,10 @@ func DeleteUser(name string, account string) util.CraneCmdError {
}
}
if reply.GetOk() {
fmt.Printf("Remove user %s succeeded.\n", name)
fmt.Printf("Successfully removed user '%s'.\n", name)
return util.ErrorSuccess
} else {
fmt.Printf("Remove user %s failed: %s.\n", name, util.ErrMsg(reply.GetReason()))
fmt.Printf("Failed to remove user '%s': %s.\n", name, util.ErrMsg(reply.GetCode()))
return util.ErrorBackend
}
}
@@ -518,10 +518,10 @@ func DeleteQos(name string) util.CraneCmdError {
}
}
if reply.GetOk() {
fmt.Printf("Delete QoS %s succeeded.\n", name)
fmt.Printf("Successfully deleted QoS '%s'.\n", name)
return util.ErrorSuccess
} else {
fmt.Printf("Delete QoS %s failed: %s.\n", name, util.ErrMsg(reply.GetReason()))
fmt.Printf("Failed to delete QoS '%s': %s.\n", name, util.ErrMsg(reply.GetCode()))
return util.ErrorBackend
}
}
@@ -551,10 +551,10 @@ func ModifyAccount(modify_field protos.ModifyField, new_value string, name strin
}
}
if reply.GetOk() {
fmt.Println("Modify information succeeded.")
fmt.Println("Information was successfully modified.")
return util.ErrorSuccess
} else {
fmt.Printf("Modify information failed: %s.\n", util.ErrMsg(reply.GetReason()))
fmt.Printf("Failed to modify information: %s.\n", util.ErrMsg(reply.GetCode()))
return util.ErrorBackend
}
}
@@ -596,7 +596,7 @@ func ModifyUser(modify_field protos.ModifyField, new_value string, name string,
fmt.Println("Modify information succeeded.")
return util.ErrorSuccess
} else {
fmt.Printf("Modify information failed: %s.\n", util.ErrMsg(reply.GetReason()))
fmt.Printf("Modify information failed: %s.\n", util.ErrMsg(reply.GetCode()))
return util.ErrorBackend
}
}
@@ -627,7 +627,7 @@ func ModifyQos(modify_field protos.ModifyField, new_value string, name string) u
fmt.Println("Modify information succeeded.")
return util.ErrorSuccess
} else {
fmt.Printf("Modify information failed: %s.\n", util.ErrMsg(reply.GetReason()))
fmt.Printf("Modify information failed: %s.\n", util.ErrMsg(reply.GetCode()))
return util.ErrorBackend
}
}
@@ -652,7 +652,7 @@ func ShowAccounts() util.CraneCmdError {
PrintAllAccount(reply.AccountList)
return util.ErrorSuccess
} else {
fmt.Println(util.ErrMsg(reply.Reason))
fmt.Println(util.ErrMsg(reply.GetCode()))
return util.ErrorBackend
}
}
@@ -677,7 +677,7 @@ func ShowUser(name string, account string) util.CraneCmdError {
PrintAllUsers(reply.UserList)
return util.ErrorSuccess
} else {
fmt.Println(util.ErrMsg(reply.Reason))
fmt.Println(util.ErrMsg(reply.GetCode()))
return util.ErrorBackend
}
}
@@ -703,7 +703,7 @@ func ShowQos(name string) util.CraneCmdError {
return util.ErrorSuccess
} else {
if name == "" {
fmt.Printf("Can't find any QoS. %s.\n", util.ErrMsg(reply.GetReason()))
fmt.Printf("Can't find any QoS. %s.\n", util.ErrMsg(reply.GetCode()))
} else {
fmt.Printf("Can't find QoS %s.\n", name)
}
@@ -731,7 +731,7 @@ func FindAccount(name string) util.CraneCmdError {
PrintAccountTable(reply.AccountList)
return util.ErrorSuccess
} else {
fmt.Println(util.ErrMsg(reply.Reason))
fmt.Println(util.ErrMsg(reply.GetCode()))
return util.ErrorBackend
}
}
@@ -756,7 +756,7 @@ func BlockAccountOrUser(name string, entityType protos.EntityType, account strin
fmt.Printf("Block %s succeeded.\n", name)
return util.ErrorSuccess
} else {
fmt.Println(util.ErrMsg(reply.Reason))
fmt.Println(util.ErrMsg(reply.GetCode()))
return util.ErrorBackend
}
}
@@ -781,7 +781,7 @@ func UnblockAccountOrUser(name string, entityType protos.EntityType, account str
fmt.Printf("Unblock %s succeeded.\n", name)
return util.ErrorSuccess
} else {
fmt.Println(util.ErrMsg(reply.Reason))
fmt.Println(util.ErrMsg(reply.GetCode()))
return util.ErrorBackend
}
}
11 changes: 7 additions & 4 deletions internal/cbatch/cbatch.go
Original file line number Diff line number Diff line change
@@ -312,7 +312,7 @@ func SendRequest(task *protos.TaskToCtld) util.CraneCmdError {
fmt.Printf("Job id allocated: %d.\n", reply.GetTaskId())
return util.ErrorSuccess
} else {
log.Errorf("Job allocation failed: %s.\n", reply.GetReason())
log.Errorf("Job allocation failed: %s.\n", util.ErrMsg(reply.GetCode()))
return util.ErrorBackend
}
}
@@ -330,7 +330,7 @@ func SendMultipleRequests(task *protos.TaskToCtld, count uint32) util.CraneCmdEr

if FlagJson {
fmt.Println(util.FmtJson.FormatReply(reply))
if len(reply.ReasonList) > 0 {
if len(reply.GetCodeList()) > 0 {
return util.ErrorBackend
} else {
return util.ErrorSuccess
@@ -345,8 +345,11 @@ func SendMultipleRequests(task *protos.TaskToCtld, count uint32) util.CraneCmdEr
fmt.Printf("Job id allocated: %s.\n", strings.Join(taskIdListString, ", "))
}

if len(reply.ReasonList) > 0 {
log.Errorf("Job allocation failed: %s.\n", strings.Join(reply.ReasonList, ", "))
if len(reply.GetCodeList()) > 0 {
for _, reason := range reply.GetCodeList() {
log.Errorf("Job allocation failed: %s.\n", util.ErrMsg(reason))
}

return util.ErrorBackend
}
return util.ErrorSuccess
153 changes: 68 additions & 85 deletions internal/util/err.go
Original file line number Diff line number Diff line change
@@ -37,95 +37,78 @@ const (
ErrorInvalidFormat CraneCmdError = 5
)

func ErrMsg(err_code protos.ErrCode) string {
switch err_code {
case protos.ErrCode_ERR_INVALID_UID:
return "The user UID being operated on does not exist in the system"
case protos.ErrCode_ERR_INVALID_OP_USER:
return "you are not a user of Crane"
case protos.ErrCode_ERR_INVALID_USER:
return "The entered user is not a user of Crane"
case protos.ErrCode_ERR_PERMISSION_USER:
return "Your permission is insufficient"
case protos.ErrCode_ERR_USER_DUPLICATE_ACCOUNT:
return "The user already exists in this account"
case protos.ErrCode_ERR_USER_ALLOWED_ACCOUNT:
return "The user is not allowed to access account"
case protos.ErrCode_ERR_INVALID_ADMIN_LEVEL:
return "Unknown admin level"
case protos.ErrCode_ERR_USER_ACCOUNT_MISMATCH:
return "The user does not belong to this account"
case protos.ErrCode_ERR_NO_ACCOUNT_SPECIFIED:
return "No account is specified for the user"
default:
break
}
var errMsgMap = map[protos.ErrCode]string{

switch err_code {
case protos.ErrCode_ERR_INVALID_ACCOUNT:
return "The entered account does not exist"
case protos.ErrCode_ERR_INVALID_PARENTACCOUNT:
return "The parent account of the entered account does not exist"
case protos.ErrCode_ERR_DUPLICATE_ACCOUNT:
return "The account already exists in the crane"
case protos.ErrCode_ERR_DELETE_ACCOUNT:
return "The account has child account or users, unable to delete."
}
// User-related errors
protos.ErrCode_ERR_INVALID_UID: "The user UID being operated on does not exist in the system",
protos.ErrCode_ERR_INVALID_OP_USER: "You are not a user of Crane",
protos.ErrCode_ERR_INVALID_USER: "The entered user is not a user of Crane",
protos.ErrCode_ERR_PERMISSION_USER: "Your permission is insufficient",
protos.ErrCode_ERR_BLOCKED_USER: "The user has been blocked",
protos.ErrCode_ERR_USER_ALREADY_EXISTS: "The user already exists in this account",
protos.ErrCode_ERR_USER_ACCESS_TO_ACCOUNT_DENIED: "The user is not allowed to access account",
protos.ErrCode_ERR_INVALID_ADMIN_LEVEL: "Unknown admin level",
protos.ErrCode_ERR_USER_ACCOUNT_MISMATCH: "The user does not belong to this account",
protos.ErrCode_ERR_NO_ACCOUNT_SPECIFIED: "No account is specified for the user",

switch err_code {
case protos.ErrCode_ERR_INVALID_PARTITION:
return "The entered partition does not exist"
case protos.ErrCode_ERR_ALLOWED_PARTITION:
return "The entered account or user does not include this partition"
case protos.ErrCode_ERR_PARENT_ALLOWED_PARTITION:
return "Parent account does not include the partition"
case protos.ErrCode_ERR_DUPLICATE_PARTITION:
return "The partition already exists in the account or user"
case protos.ErrCode_ERR_USER_EMPTY_PARTITION:
return "The user does not contain any partitions, operation cannot be performed."
case protos.ErrCode_ERR_CHILD_HAS_PARTITION:
return "The partition is currently being used by the child accounts or users of the account, operation cannot be performed. You can use a forced operation to ignore this constraint"
}
// Account-related errors
protos.ErrCode_ERR_INVALID_ACCOUNT: "The entered account does not exist",
protos.ErrCode_ERR_INVALID_PARENT_ACCOUNT: "The parent account of the entered account does not exist",
protos.ErrCode_ERR_ACCOUNT_ALREADY_EXISTS: "The account already exists in the crane",
protos.ErrCode_ERR_ACCOUNT_HAS_CHILDREN: "The account has child account or users, unable to delete.",
protos.ErrCode_ERR_BLOCKED_ACCOUNT: "The account has been blocked",

switch err_code {
case protos.ErrCode_ERR_INVALID_QOS:
return "The entered qos does not exist"
case protos.ErrCode_ERR_DB_DUPLICATE_QOS:
return "Qos already exists in the crane"
case protos.ErrCode_ERR_DELETE_QOS:
return "QoS is still being used by accounts or users, unable to delete"
case protos.ErrCode_ERR_CONVERT_TO_INTERGER:
return "Failed to convert value to integer"
case protos.ErrCode_ERR_TIME_LIMIT:
return "Invalid time limit value"
case protos.ErrCode_ERR_ALLOWED_QOS:
return "The entered account or user does not include this qos"
case protos.ErrCode_ERR_DUPLICATE_QOS:
return "The Qos already exists in the account or user"
case protos.ErrCode_ERR_PARENT_ALLOWED_QOS:
return "Parent account does not include the qos"
case protos.ErrCode_ERR_SET_ALLOWED_QOS:
return "The entered QoS list does not include the default QoS for this user. Ignoring this constraint with forced operation, the default QoS is randomly replaced with one of the items in the new QoS list"
case protos.ErrCode_ERR_ALLOWED_DEFAULT_QOS:
return "The entered default_qos is not allowed"
case protos.ErrCode_ERR_DUPLICATE_DEFAULT_QOS:
return "The QoS is already the default QoS for the account or specified partition of the user"
case protos.ErrCode_ERR_SET_ACCOUNT_QOS:
return "The entered QoS list does not include the default QoS for this account or some descendant node. You can use a forced operation to ignore this constraint"
case protos.ErrCode_ERR_CHILD_HAS_DEFAULT_QOS:
return "some child accounts or users is using the QoS as the default QoS. By ignoring this constraint with forced deletion, the deleted default QoS is randomly replaced with one of the remaining items in the QoS list"
case protos.ErrCode_ERR_SET_DEFAULT_QOS:
return "The Qos not allowed or is already the default qos"
case protos.ErrCode_ERR_IS_DEFAULT_QOS:
return "The QoS is the default QoS for the current user/Account and cannot be modified. Ignoring this constraint with forced operation, the default QoS is randomly replaced with one of the items in the new QoS list"
}
// Partition-related errors
protos.ErrCode_ERR_INVALID_PARTITION: "The entered partition does not exist",
protos.ErrCode_ERR_PARTITION_MISSING: "The entered account or user does not include this partition",
protos.ErrCode_ERR_PARENT_ACCOUNT_PARTITION_MISSING: "Parent account does not include the partition",
protos.ErrCode_ERR_PARTITION_ALREADY_EXISTS: "The partition already exists in the account or user",
protos.ErrCode_ERR_USER_EMPTY_PARTITION: "The user does not contain any partitions, operation cannot be performed.",
protos.ErrCode_ERR_CHILD_HAS_PARTITION: "The partition is currently being used by the child accounts or users of the account, operation cannot be performed. You can use a forced operation to ignore this constraint",
protos.ErrCode_ERR_HAS_NO_QOS_IN_PARTITION: "The user has no QoS available for this partition to be used",
protos.ErrCode_ERR_HAS_ALLOWED_QOS_IN_PARTITION: "The qos you set is not in partition's allowed qos list",

switch err_code {
case protos.ErrCode_ERR_UPDATE_DATABASE:
return "Fail to update data in database"
default:
break
}
// QoS-related errors
protos.ErrCode_ERR_INVALID_QOS: "The entered qos does not exist",
protos.ErrCode_ERR_DB_QOS_ALREADY_EXISTS: "Qos already exists in the crane",
protos.ErrCode_ERR_QOS_REFERENCES_EXIST: "QoS is still being used by accounts or users, unable to delete",
protos.ErrCode_ERR_CONVERT_TO_INTEGER: "Failed to convert value to integer",
protos.ErrCode_ERR_TIME_LIMIT: "Invalid time limit value",
protos.ErrCode_ERR_QOS_MISSING: "The entered account or user does not include this qos",
protos.ErrCode_ERR_QOS_ALREADY_EXISTS: "The Qos already exists in the account or user",
protos.ErrCode_ERR_PARENT_ACCOUNT_QOS_MISSING: "Parent account does not include the qos",
protos.ErrCode_ERR_SET_ALLOWED_QOS: "The entered QoS list does not include the default QoS for this user. Ignoring this constraint with forced operation, the default QoS is randomly replaced with one of the items in the new QoS list",
protos.ErrCode_ERR_DEFAULT_QOS_NOT_INHERITED: "The entered default_qos is not allowed",
protos.ErrCode_ERR_DUPLICATE_DEFAULT_QOS: "The QoS is already the default QoS for the account or specified partition of the user",
protos.ErrCode_ERR_SET_ACCOUNT_QOS: "The entered QoS list does not include the default QoS for this account or some descendant node. You can use a forced operation to ignore this constraint",
protos.ErrCode_ERR_CHILD_HAS_DEFAULT_QOS: "some child accounts or users is using the QoS as the default QoS. By ignoring this constraint with forced deletion, the deleted default QoS is randomly replaced with one of the remaining items in the QoS list",
protos.ErrCode_ERR_SET_DEFAULT_QOS: "The Qos not allowed or is already the default qos",
protos.ErrCode_ERR_DEFAULT_QOS_MODIFICATION_DENIED: "The QoS is the default QoS for the current user/Account and cannot be modified. Ignoring this constraint with forced operation, the default QoS is randomly replaced with one of the items in the new QoS list",

// System-related errors
protos.ErrCode_ERR_UPDATE_DATABASE: "Fail to update data in database",
protos.ErrCode_ERR_NO_RESOURCE: "Resource not enough for task",
protos.ErrCode_ERR_INVALID_NODE_NUM: "Nodes partition not enough for task",
protos.ErrCode_ERR_INVAILD_NODE_LIST: "Invalid node list",
protos.ErrCode_ERR_INVAILD_EX_NODE_LIST: "Invalid exclude node list",
protos.ErrCode_ERR_TIME_TIMIT_BEYOND: "Time-limit reached the user's limit",
protos.ErrCode_ERR_CPUS_PER_TASK_BEYOND: "cpus-per-task reached the user's limit",
protos.ErrCode_ERR_NO_ENOUGH_NODE: "Nodes num not enough for task",
protos.ErrCode_ERR_BEYOND_TASK_ID: "System error occurred or the number of pending tasks exceeded maximum value",
protos.ErrCode_ERR_CGROUP: "Error when manipulating cgroup",
protos.ErrCode_ERR_SYSTEM_ERR: "Linux Error",
protos.ErrCode_ERR_RPC_FAILURE: "RPC call failed",
protos.ErrCode_ERR_GENERIC_FAILURE: "Generic failure",
protos.ErrCode_ERR_NON_EXISTENT: "The object doesn't exist",
protos.ErrCode_ERR_INVALID_PARAM: "Invalid Parameter",
protos.ErrCode_ERR_PROTOBUF: "Error when using protobuf",
protos.ErrCode_ERR_MAX_JOB_COUNT_PER_USER: "job max count is empty or exceeds the limit",
protos.ErrCode_ERR_USER_NO_PRIVILEGE: "User has insufficient privilege",
}

func ErrMsg(err_code protos.ErrCode) string {
if msg, exists := errMsgMap[err_code]; exists {
return msg
}
return fmt.Sprintf("Unknown Error Occurred: %s", err_code)
}
30 changes: 15 additions & 15 deletions protos/Crane.proto
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@ message SubmitBatchTaskReply {
bool ok = 1;
oneof payload{
uint32 task_id = 2;
string reason = 3;
ErrCode code = 3;
}
}

@@ -72,7 +72,7 @@ message SubmitBatchTasksRequest {

message SubmitBatchTasksReply {
repeated uint32 task_id_list = 1;
repeated string reason_list = 2;
repeated ErrCode code_list = 2;
}

message ExecuteTasksRequest {
@@ -243,7 +243,7 @@ message AddAccountRequest {

message AddAccountReply {
bool ok = 1;
ErrCode reason = 2;
ErrCode code = 2;
}

message AddUserRequest {
@@ -253,7 +253,7 @@ message AddUserRequest {

message AddUserReply {
bool ok = 1;
ErrCode reason = 2;
ErrCode code = 2;
}

message AddQosRequest {
@@ -263,7 +263,7 @@ message AddQosRequest {

message AddQosReply {
bool ok = 1;
ErrCode reason = 2;
ErrCode code = 2;
}

message DeleteAccountRequest {
@@ -273,7 +273,7 @@ message DeleteAccountRequest {

message DeleteAccountReply {
bool ok = 1;
ErrCode reason = 2;
ErrCode code = 2;
}

message DeleteUserRequest {
@@ -284,7 +284,7 @@ message DeleteUserRequest {

message DeleteUserReply {
bool ok = 1;
ErrCode reason = 2;
ErrCode code = 2;
}

message DeleteQosRequest {
@@ -294,7 +294,7 @@ message DeleteQosRequest {

message DeleteQosReply {
bool ok = 1;
ErrCode reason = 2;
ErrCode code = 2;
}

message ModifyAccountRequest {
@@ -308,7 +308,7 @@ message ModifyAccountRequest {

message ModifyAccountReply {
bool ok = 1;
ErrCode reason = 2;
ErrCode code = 2;
}

message ModifyUserRequest {
@@ -324,7 +324,7 @@ message ModifyUserRequest {

message ModifyUserReply {
bool ok = 1;
ErrCode reason = 2;
ErrCode code = 2;
}

message ModifyQosRequest {
@@ -336,7 +336,7 @@ message ModifyQosRequest {

message ModifyQosReply {
bool ok = 1;
ErrCode reason = 2;
ErrCode code = 2;
}

message QueryAccountInfoRequest {
@@ -346,7 +346,7 @@ message QueryAccountInfoRequest {

message QueryAccountInfoReply {
bool ok = 1;
ErrCode reason = 2;
ErrCode code = 2;
repeated AccountInfo account_list = 3;
}

@@ -358,7 +358,7 @@ message QueryUserInfoRequest {

message QueryUserInfoReply {
bool ok = 1;
ErrCode reason = 2;
ErrCode code = 2;
repeated UserInfo user_list = 3;
}

@@ -369,7 +369,7 @@ message QueryQosInfoRequest {

message QueryQosInfoReply {
bool ok = 1;
ErrCode reason = 2;
ErrCode code = 2;
repeated QosInfo qos_list = 5;
}

@@ -383,7 +383,7 @@ message BlockAccountOrUserRequest {

message BlockAccountOrUserReply {
bool ok = 1;
ErrCode reason = 2;
ErrCode code = 2;
}

message MigrateSshProcToCgroupRequest {
141 changes: 81 additions & 60 deletions protos/PublicDefs.proto
Original file line number Diff line number Diff line change
@@ -332,66 +332,87 @@ message TrimmedPartitionInfo {

enum ErrCode {
SUCCESS = 0; // Success

ERR_INVALID_UID = 10001; // Invalid UID passed
ERR_INVALID_OP_USER = 10002; // Invalid operation user
ERR_INVALID_USER = 10003; // Invalid user
ERR_PERMISSION_USER = 10004; // User permissions too low, no permission to operate
ERR_USER_DUPLICATE_ACCOUNT = 10005; // User duplicate account insertion
ERR_USER_ALLOWED_ACCOUNT = 10006; // User does not have permission for the account
ERR_INVALID_ADMIN_LEVEL = 10007; // Invalid permission level
ERR_USER_ACCOUNT_MISMATCH = 10008; // User does not belong to the account
ERR_NO_ACCOUNT_SPECIFIED = 10009;

ERR_INVALID_ACCOUNT = 10010; // Invalid account
ERR_DUPLICATE_ACCOUNT = 10011; // Duplicate account insertion
ERR_INVALID_PARENTACCOUNT = 10012; // Invalid parent account
ERR_DELETE_ACCOUNT = 10013; // Account has child nodes

ERR_INVALID_PARTITION = 10014; // Invalid partition, partition does not exist
ERR_ALLOWED_PARTITION = 10015; // Account/user does not include this partition
ERR_DUPLICATE_PARTITION = 10016; // Account/user duplicate insertion
ERR_PARENT_ALLOWED_PARTITION = 10017; // Parent account does not include this partition
ERR_USER_EMPTY_PARTITION = 10018; // Cannot add QoS when user has no partition
ERR_CHILD_HAS_PARTITION = 10019; // Partition '{}' is used by some descendant node of the account '{}'. Ignoring this constraint with forced operation.

ERR_INVALID_QOS = 10020; // Invalid QoS, QoS does not exist
ERR_DB_DUPLICATE_QOS = 10021; // Duplicate QoS insertion in the database.
ERR_DELETE_QOS = 10022; // QoS reference count is not zero.
ERR_CONVERT_TO_INTERGER = 10023; // String to integer conversion failed
ERR_TIME_LIMIT = 10024; // Invalid time value
ERR_ALLOWED_QOS = 10025; // Account/user does not include this QoS.
ERR_DUPLICATE_QOS = 10026; // Account/user duplicate insertion.
ERR_PARENT_ALLOWED_QOS = 10027; // Parent account does not include this QoS.
ERR_SET_ALLOWED_QOS = 10028; // QoS '{}' is the default QoS of partition '{}', but not found in the new QoS list.
ERR_ALLOWED_DEFAULT_QOS = 10029; // Default QoS is not in the allowed QoS list
ERR_DUPLICATE_DEFAULT_QOS = 10030; // Duplicate default QoS setting
ERR_CHILD_HAS_DEFAULT_QOS = 10031; // Someone is using QoS '{}' as default QoS. Ignoring this constraint with forced deletion, the deleted default QoS is randomly replaced with one of the remaining items in the QoS list.
ERR_SET_ACCOUNT_QOS = 10032; // QoS '{}' is used by some descendant node or itself of the account '{}'. Ignoring this constraint with forced operation.
ERR_SET_DEFAULT_QOS = 10033; // Qos '{}' not in allowed qos list or is already the default qos
ERR_IS_DEFAULT_QOS = 10034;

ERR_UPDATE_DATABASE = 10035; // Database update failed

ERR_GENERIC_FAILURE = 10100;
ERR_NO_RESOURCE = 10101;
ERR_NON_EXISTENT = 10102;
ERR_INVALID_NODE_NUM = 10103;
ERR_SYSTEM_ERR = 10104;
ERR_EXISTING_TASK = 10105;
ERR_INVALID_PARAM = 10106;
ERR_STOP = 10107;
ERR_PERMISSION_DENIED = 10108;
ERR_CONNECTION_TIMEOUT = 10109;
ERR_CONNECTION_ABORTED = 10110;
ERR_RPC_FAILURE = 10111;
ERR_TOKEN_REQUEST_FAILURE = 10112;
ERR_STREAM_BROKEN = 10113;
ERR_INVALID_STUB = 10114;
ERR_CGROUP = 10115;
ERR_PROTOBUF = 10116;
ERR_LIB_EVENT = 10117;
ERR_NO_AVAIL_NODE = 10118;

ERR_INVALID_UID = 1; // Invalid UID passed
ERR_INVALID_OP_USER = 2; // Invalid operation user
ERR_INVALID_USER = 3; // Invalid user
ERR_PERMISSION_USER = 4; // User permissions too low, no permission to operate

ERR_BLOCKED_USER = 5;
ERR_USER_ALREADY_EXISTS = 6; // User duplicate account insertion
ERR_USER_ACCESS_TO_ACCOUNT_DENIED = 7; // User does not have permission for the account
ERR_INVALID_ADMIN_LEVEL = 8; // Invalid permission level
ERR_USER_ACCOUNT_MISMATCH = 9; // User does not belong to the account

ERR_NO_ACCOUNT_SPECIFIED = 10;
ERR_INVALID_ACCOUNT = 11; // Invalid account
ERR_ACCOUNT_ALREADY_EXISTS = 12; // Duplicate account insertion
ERR_INVALID_PARENT_ACCOUNT = 13; // Invalid parent account
ERR_ACCOUNT_HAS_CHILDREN = 14; // Account has child nodes,cannot be deleted.

ERR_BLOCKED_ACCOUNT = 15;
ERR_INVALID_PARTITION = 16; // Invalid partition, partition does not exist
ERR_PARTITION_MISSING = 17; // Account/user does not include this partition
ERR_PARTITION_ALREADY_EXISTS = 18; // Account/user duplicate insertion
ERR_PARENT_ACCOUNT_PARTITION_MISSING = 19; // Parent account does not include this partition

ERR_USER_EMPTY_PARTITION = 20; // Cannot add QoS when user has no partition
ERR_CHILD_HAS_PARTITION = 21; // Failed to delete the account partition as child nodes contain this partition.
ERR_HAS_NO_QOS_IN_PARTITION = 22;
ERR_HAS_ALLOWED_QOS_IN_PARTITION = 23;
ERR_INVALID_QOS = 24; // Invalid QoS, QoS does not exist

ERR_DB_QOS_ALREADY_EXISTS = 25; // Duplicate QoS insertion in the database.
ERR_QOS_REFERENCES_EXIST = 26; // QoS reference count is not zero.
ERR_CONVERT_TO_INTEGER = 27; // String to integer conversion failed
ERR_TIME_LIMIT = 28; // Invalid time value
ERR_QOS_MISSING = 29; // Account/user does not include this QoS.

ERR_QOS_ALREADY_EXISTS = 30; // Account/user duplicate insertion.
ERR_PARENT_ACCOUNT_QOS_MISSING = 31; // Parent account does not include this QoS.
ERR_SET_ALLOWED_QOS = 32; // QoS is the default QoS, but not found in the new QoS list.
ERR_DEFAULT_QOS_NOT_INHERITED = 33; // Default QoS is not in the allowed QoS list
ERR_DUPLICATE_DEFAULT_QOS = 34; // Duplicate default QoS setting

ERR_CHILD_HAS_DEFAULT_QOS = 35; // Failed to delete the account QoS as child nodes have set it as the default QoS.
ERR_SET_ACCOUNT_QOS = 36; // QoS is used by some descendant node or itself of the account.
ERR_SET_DEFAULT_QOS = 37; // Qos not in allowed qos list or is already the default qos
ERR_DEFAULT_QOS_MODIFICATION_DENIED = 38; // // QoS cannot be directly deleted when it is set as the default QoS.
ERR_UPDATE_DATABASE = 39; // Database update failed

ERR_GENERIC_FAILURE = 40;
ERR_NO_RESOURCE = 41;
ERR_NON_EXISTENT = 42;
ERR_INVALID_NODE_NUM = 43;
ERR_INVAILD_NODE_LIST = 44;

ERR_INVAILD_EX_NODE_LIST = 45;
ERR_TIME_TIMIT_BEYOND = 46;
ERR_CPUS_PER_TASK_BEYOND = 47;
ERR_NO_ENOUGH_NODE = 48;
ERR_SYSTEM_ERR = 49;

ERR_EXISTING_TASK = 50;
ERR_BEYOND_TASK_ID = 51;
ERR_INVALID_PARAM = 52;
ERR_STOP = 53;
ERR_PERMISSION_DENIED = 54;

ERR_CONNECTION_TIMEOUT = 55;
ERR_CONNECTION_ABORTED = 56;
ERR_RPC_FAILURE = 57;
ERR_TOKEN_REQUEST_FAILURE = 58;
ERR_STREAM_BROKEN = 59;

ERR_INVALID_STUB = 60;
ERR_CGROUP = 61;
ERR_PROTOBUF = 62;
ERR_LIB_EVENT = 63;
ERR_NO_AVAIL_NODE = 64;

ERR_MAX_JOB_COUNT_PER_USER = 65;
ERR_USER_NO_PRIVILEGE = 66;
__ERR_CODE_COUNT = 67;
}

enum EntityType {