-
Notifications
You must be signed in to change notification settings - Fork 18
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
Dev/partition allow accounts #404
base: master
Are you sure you want to change the base?
Conversation
huerni
commented
Dec 19, 2024
- config文件partition添加AllowAccounts设置,AllowAccounts=,ctld启动时读取配置。
- 命令行修改partition的AllowAccounts,无需持久化,持久化只能在config文件进行定义。
- ccontrol show partition 添加AllowAccounts条目展示。
- 提交任务时判断account是否在partition的AllowAccounts中
src/CraneCtld/CraneCtld.cpp
Outdated
std::string allow_accounts_str = | ||
partition["AllowAccounts"].as<std::string>(); | ||
std::vector<std::string> allow_accounts = | ||
absl::StrSplit(allow_accounts_str, ","); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trim
@@ -283,9 +283,11 @@ void CranedMetaContainer::InitFromConfig(const Config& config) { | |||
part_meta.partition_global_meta.res_total_inc_dead = part_res; | |||
part_meta.partition_global_meta.node_cnt = part_meta.craned_ids.size(); | |||
part_meta.partition_global_meta.nodelist_str = partition.nodelist_str; | |||
part_meta.partition_global_meta.allow_accounts = partition.allow_accounts; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
allowed_accounts
@@ -976,8 +976,7 @@ std::expected<void, std::string> AccountManager::CheckAndApplyQosLimitOnTask( | |||
return {}; | |||
} | |||
|
|||
std::expected<void, std::string> AccountManager::CheckUidIsAdmin( | |||
uint32_t uid) { | |||
std::expected<void, std::string> AccountManager::CheckUidIsAdmin(uint32_t uid) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这地方也改成返回错误码
const std::unordered_set<std::string>& allow_accounts) { | ||
CraneErrCodeExpected<void> result{}; | ||
|
||
if (!partition_metas_map_.Contains(partition_name)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这地方有点问题
|
||
bool CranedMetaContainer::CheckIfAccountIsAllowedInPartition( | ||
const std::string& partition_name, const std::string& account_name) { | ||
if (!partition_metas_map_.Contains(partition_name)) return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
锁不连续
src/CraneCtld/CtldGrpcServer.cpp
Outdated
allow_accounts.insert(account_name); | ||
} | ||
|
||
result = g_account_manager->CheckModifyPartitionAllowAccounts( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
错误处理
src/CraneCtld/CtldGrpcServer.cpp
Outdated
@@ -980,6 +1013,13 @@ CtldServer::SubmitTaskToScheduler(std::unique_ptr<TaskInCtld> task) { | |||
return std::unexpected(enable_res.error()); | |||
} | |||
|
|||
if (!g_meta_container->CheckIfAccountIsAllowedInPartition(task->partition_id, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这地方有问题吧
59671e1
to
e7314d1
Compare
…tition's AllowAccounts.
e7314d1
to
60d444f
Compare