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

Dev/licenses #312

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ dependencies/.extracted
.idea

.idea/misc.xml

build/
.cache/
# Deployment stuff. Containing some personal info.
.idea/deployment.xml
.idea/other.xml
Expand Down
3 changes: 3 additions & 0 deletions etc/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ PendingQueueMaxSize: 900000
# Default value is 100000.
ScheduledBatchSize: 100000

# The set licenses and their quantities (Only need to configure in the ctld config file.)
# Licenses: fluent:30,ansys:100

# Scheduler will reject all jobs beyond processing capacity set by PendingQueueMaxSize
# if this option is set to true.
# Default value is false.
Expand Down
137 changes: 83 additions & 54 deletions protos/Crane.proto
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ message SubmitBatchTaskRequest {

message SubmitBatchTaskReply {
bool ok = 1;
oneof payload{
oneof payload {
uint32 task_id = 2;
string reason = 3;
}
Expand Down Expand Up @@ -90,14 +90,14 @@ message CreateCgroupForTasksRequest {
repeated string execution_node = 4;
}

message CreateCgroupForTasksReply{}
message CreateCgroupForTasksReply {}

message ReleaseCgroupForTasksRequest{
message ReleaseCgroupForTasksRequest {
repeated uint32 task_id_list = 1;
repeated uint32 uid_list = 2;
}

message ReleaseCgroupForTasksReply{}
message ReleaseCgroupForTasksReply {}

message TerminateTasksRequest {
repeated uint32 task_id_list = 1;
Expand Down Expand Up @@ -154,30 +154,28 @@ message CancelTaskReply {
repeated string not_cancelled_reasons = 4;
}


message QueryTaskIdFromPortRequest{
message QueryTaskIdFromPortRequest {
uint32 port = 1;
}

message QueryTaskIdFromPortReply{
message QueryTaskIdFromPortReply {
bool ok = 1;
uint32 task_id = 2;
}

message QueryTaskIdFromPortForwardRequest{
message QueryTaskIdFromPortForwardRequest {
uint32 ssh_remote_port = 1;
string ssh_remote_address = 2;
uint32 uid = 3;
}

message QueryTaskIdFromPortForwardReply{
message QueryTaskIdFromPortForwardReply {
bool ok = 1;
bool from_user = 2;
uint32 task_id = 3;
string cgroup_path = 4;
}


message QueryCranedInfoRequest {
string craned_name = 1;
}
Expand All @@ -194,6 +192,15 @@ message QueryPartitionInfoReply {
repeated PartitionInfo partition_info = 1;
}

message QueryLicensesInfoRequest {
repeated string license_name_list = 1;
}

message QueryLicensesInfoReply {
bool ok = 1;
repeated LicenseInfo license_info_list = 2;
}

message ModifyTaskRequest {
enum TargetAttributes {
TimeLimit = 0;
Expand Down Expand Up @@ -223,13 +230,13 @@ message ModifyTaskReply {
repeated string not_modified_reasons = 4;
}

message ModifyCranedStateRequest{
message ModifyCranedStateRequest {
repeated string craned_ids = 1;
CranedControlState new_state = 2;
string reason = 3;
}

message ModifyCranedStateReply{
message ModifyCranedStateReply {
repeated string modified_nodes = 2;
repeated string not_modified_nodes = 3;
repeated string not_modified_reasons = 4;
Expand Down Expand Up @@ -286,8 +293,8 @@ message ModifyEntityRequest {
Delete = 2;
}

string item = 2; //modify item field
string value = 3; //new value
string item = 2; // modify item field
string value = 3; // new value
string name = 4;
string partition = 5;
OperatorType type = 6;
Expand Down Expand Up @@ -338,22 +345,22 @@ message MigrateSshProcToCgroupReply {
bool ok = 1;
}

message QueryTaskEnvVariablesRequest{
message QueryTaskEnvVariablesRequest {
uint32 task_id = 1;
}

message QueryTaskEnvVariablesReply{
message QueryTaskEnvVariablesReply {
bool ok = 1;
repeated string name = 2;
repeated string value = 3;
}

message QueryTaskEnvVariablesForwardRequest{
message QueryTaskEnvVariablesForwardRequest {
uint32 task_id = 1;
string execution_node = 2;
}

message QueryTaskEnvVariablesForwardReply{
message QueryTaskEnvVariablesForwardReply {
bool ok = 1;
repeated string name = 2;
repeated string value = 3;
Expand All @@ -371,7 +378,7 @@ message QueryClusterInfoReply {
repeated TrimmedPartitionInfo partitions = 2;
}

message QueryTasksInfoRequest{
message QueryTasksInfoRequest {
repeated uint32 filter_task_ids = 1;
repeated string filter_partitions = 2;
uint32 num_limit = 3;
Expand All @@ -381,14 +388,15 @@ message QueryTasksInfoRequest{
repeated TaskStatus filter_task_states = 6;
repeated string filter_users = 7;
repeated string filter_accounts = 8;
TimeInterval filter_submit_time_interval = 9;
TimeInterval filter_start_time_interval = 10;
TimeInterval filter_end_time_interval = 11;
repeated string filter_licenses = 9;
TimeInterval filter_submit_time_interval = 10;
TimeInterval filter_start_time_interval = 11;
TimeInterval filter_end_time_interval = 12;

bool option_include_completed_tasks = 15;
}

message QueryTasksInfoReply{
message QueryTasksInfoReply {
bool ok = 1;
repeated TaskInfo task_info_list = 2;
}
Expand Down Expand Up @@ -444,7 +452,7 @@ message StreamCforedReply {
bool ok = 1;
}

CforedReplyType type = 1 ;
CforedReplyType type = 1;

oneof payload {
TaskIdReply payload_task_id_reply = 2;
Expand Down Expand Up @@ -617,11 +625,11 @@ message StreamCforedCrunReply {
bool ok = 1;
}

message TaskIOForwardReply{
message TaskIOForwardReply {
string msg = 1;
}

CforedCrunReplyType type = 1 ;
CforedCrunReplyType type = 1;

oneof payload {
TaskIdReply payload_task_id_reply = 2;
Expand All @@ -634,7 +642,7 @@ message StreamCforedCrunReply {
}

message StreamCforedTaskIORequest {
enum CranedRequestType{
enum CranedRequestType {
CRANED_REGISTER = 0;
CRANED_TASK_OUTPUT = 1;
CRANED_UNREGISTER = 2;
Expand Down Expand Up @@ -699,7 +707,7 @@ service CraneCtld {
rpc CranedRegister(CranedRegisterRequest) returns (CranedRegisterReply);

/* RPCs called from Cfored */
rpc CforedStream(stream StreamCforedRequest) returns(stream StreamCtldReply);
rpc CforedStream(stream StreamCforedRequest) returns (stream StreamCtldReply);

/* RPCs called from ccancel */
rpc CancelTask(CancelTaskRequest) returns (CancelTaskReply);
Expand All @@ -710,7 +718,10 @@ service CraneCtld {

/* PRCs called from ccontrol */
rpc QueryCranedInfo(QueryCranedInfoRequest) returns (QueryCranedInfoReply);
rpc QueryPartitionInfo(QueryPartitionInfoRequest) returns (QueryPartitionInfoReply);
rpc QueryPartitionInfo(QueryPartitionInfoRequest)
returns (QueryPartitionInfoReply);
rpc QueryLicensesInfo(QueryLicensesInfoRequest)
returns (QueryLicensesInfoReply);
rpc ModifyTask(ModifyTaskRequest) returns (ModifyTaskReply);
rpc ModifyNode(ModifyCranedStateRequest) returns (ModifyCranedStateReply);

Expand All @@ -723,7 +734,8 @@ service CraneCtld {

rpc QueryEntityInfo(QueryEntityInfoRequest) returns (QueryEntityInfoReply);
rpc ModifyEntity(ModifyEntityRequest) returns (ModifyEntityReply);
rpc BlockAccountOrUser(BlockAccountOrUserRequest) returns (BlockAccountOrUserReply);
rpc BlockAccountOrUser(BlockAccountOrUserRequest)
returns (BlockAccountOrUserReply);

/* RPCs called from cinfo */
rpc QueryClusterInfo(QueryClusterInfoRequest) returns (QueryClusterInfoReply);
Expand All @@ -733,39 +745,56 @@ service CraneCtld {
}

service Craned {
/* ----------------------------------- Called from CraneCtld ---------------------------------------------------- */
rpc ExecuteTask(ExecuteTasksRequest) returns(ExecuteTasksReply);
/* ----------------------------------- Called from CraneCtld
* ---------------------------------------------------- */
rpc ExecuteTask(ExecuteTasksRequest) returns (ExecuteTasksReply);

rpc CheckTaskStatus(CheckTaskStatusRequest) returns(CheckTaskStatusReply);
rpc CheckTaskStatus(CheckTaskStatusRequest) returns (CheckTaskStatusReply);

rpc CreateCgroupForTasks(CreateCgroupForTasksRequest) returns(CreateCgroupForTasksReply);
rpc ReleaseCgroupForTasks(ReleaseCgroupForTasksRequest) returns(ReleaseCgroupForTasksReply);
rpc CreateCgroupForTasks(CreateCgroupForTasksRequest)
returns (CreateCgroupForTasksReply);
rpc ReleaseCgroupForTasks(ReleaseCgroupForTasksRequest)
returns (ReleaseCgroupForTasksReply);

rpc QueryCranedRemoteMeta(QueryCranedRemoteMetaRequest) returns(QueryCranedRemoteMetaReply);
rpc QueryCranedRemoteMeta(QueryCranedRemoteMetaRequest)
returns (QueryCranedRemoteMetaReply);

/*
If the task is an interactive task, the resource uuid is also revoked.
If there's no process in this interactive task, just deallocate all the resources.
If there are processes in this interactive task, kill all the processes and deallocate resources.
If the task is a batch task, just kill it.
If there's no process in this interactive task, just deallocate all the
resources. If there are processes in this interactive task, kill all the
processes and deallocate resources. If the task is a batch task, just kill it.
*/
rpc TerminateTasks(TerminateTasksRequest) returns (TerminateTasksReply);
rpc TerminateOrphanedTask(TerminateOrphanedTaskRequest) returns (TerminateOrphanedTaskReply);
rpc ChangeTaskTimeLimit(ChangeTaskTimeLimitRequest) returns (ChangeTaskTimeLimitReply);

/* ----------------------------------- Called from Craned ------------------------------------------------------ */
rpc QueryTaskIdFromPort(QueryTaskIdFromPortRequest) returns (QueryTaskIdFromPortReply);

/* ----------------------------------- Called from Pam Module --------------------------------------------------- */
rpc QueryTaskIdFromPortForward(QueryTaskIdFromPortForwardRequest) returns (QueryTaskIdFromPortForwardReply);
rpc MigrateSshProcToCgroup(MigrateSshProcToCgroupRequest) returns (MigrateSshProcToCgroupReply);
rpc QueryTaskEnvVariables(QueryTaskEnvVariablesRequest) returns (QueryTaskEnvVariablesReply);
rpc QueryTaskEnvVariablesForward(QueryTaskEnvVariablesForwardRequest) returns (QueryTaskEnvVariablesForwardReply);
rpc TerminateOrphanedTask(TerminateOrphanedTaskRequest)
returns (TerminateOrphanedTaskReply);
rpc ChangeTaskTimeLimit(ChangeTaskTimeLimitRequest)
returns (ChangeTaskTimeLimitReply);

/* ----------------------------------- Called from Craned
* ------------------------------------------------------ */
rpc QueryTaskIdFromPort(QueryTaskIdFromPortRequest)
returns (QueryTaskIdFromPortReply);

/* ----------------------------------- Called from Pam Module
* --------------------------------------------------- */
rpc QueryTaskIdFromPortForward(QueryTaskIdFromPortForwardRequest)
returns (QueryTaskIdFromPortForwardReply);
rpc MigrateSshProcToCgroup(MigrateSshProcToCgroupRequest)
returns (MigrateSshProcToCgroupReply);
rpc QueryTaskEnvVariables(QueryTaskEnvVariablesRequest)
returns (QueryTaskEnvVariablesReply);
rpc QueryTaskEnvVariablesForward(QueryTaskEnvVariablesForwardRequest)
returns (QueryTaskEnvVariablesForwardReply);
}

service CraneForeD {
rpc CallocStream(stream StreamCallocRequest) returns(stream StreamCforedReply);
rpc CrunStream(stream StreamCrunRequest) returns(stream StreamCforedCrunReply);
rpc TaskIOStream(stream StreamCforedTaskIORequest) returns(stream StreamCforedTaskIOReply);
rpc QueryTaskIdFromPort(QueryTaskIdFromPortRequest) returns (QueryTaskIdFromPortReply);
rpc CallocStream(stream StreamCallocRequest)
returns (stream StreamCforedReply);
rpc CrunStream(stream StreamCrunRequest)
returns (stream StreamCforedCrunReply);
rpc TaskIOStream(stream StreamCforedTaskIORequest)
returns (stream StreamCforedTaskIOReply);
rpc QueryTaskIdFromPort(QueryTaskIdFromPortRequest)
returns (QueryTaskIdFromPortReply);
}
Loading