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

feat: add missing methods for partitions management #198

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
80 changes: 80 additions & 0 deletions Protos/V1/partitions_common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ syntax = "proto3";

package armonik.api.grpc.v1.partitions;

import "objects.proto";
import "sort_direction.proto";

option csharp_namespace = "Armonik.Api.Grpc.V1.Partitions";
Expand Down Expand Up @@ -114,3 +115,82 @@ message GetPartitionRequest {
message GetPartitionResponse {
PartitionRaw partition = 1; /** The raw partition. */
}

/**
* Request to update multiple partitions.
*
* Cannot update more than 30 partitions
*/
message UpdatePartitionsRequest {
/**
* Represents the data of the partitions that will be updated.
*
* ID is mandatory.
* -1 means that value will not be updated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just say negative instead of specifically -1.
The problem is that in protobuf, if a value is missing, it is set to 0...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.
But 0 is a valid number for our use case...

* value >= 0 means that it will be the new value
*/
message PartitionUpdate {
string id = 1; /** The ID of the partition that will be updated. */
int64 pod_reserved = 2; /** Whether the partition is reserved for pods. */
int64 pod_max = 3; /** The maximum number of pods that can be used by sessions using the partition. */
int64 preemption_percentage = 4; /** The percentage of the partition that can be preempted. */
int64 priority = 5; /** The priority of the partition. */
}

repeated PartitionUpdate partitions = 1; /** The list of partitions to update. */
}

/**
* Response to update a partition.
*
* Return a list of raw partitions with the new values.
*/
message UpdatePartitionsResponse {
repeated PartitionRaw partitions = 1; /** The list of raw partitions. */
}

/**
* Request to delete partitions.
*
* If the ID is not found, it is ignored
*/
message DeletePartitionsRequest {
repeated string id = 1; /** The IDs of the partitions to delete. */
}

/**
* Response to delete partitions.
*/
message DeletePartitionsResponse {
Empty ok = 1;
}

/**
* Request to create multiple partitions.
*
* Cannot create more than 30 partitions
*/
message CreatePartitionsRequest {
/**
* Represents the data of the partitions that will be created.
*/
message PartitionCreate {
repeated string parent_partition_ids = 2; /** The parent partition IDs. */
int64 pod_reserved = 3; /** Whether the partition is reserved for pods. */
int64 pod_max = 4; /** The maximum number of pods that can be used by sessions using the partition. */
map<string, string> pod_configuration = 7; /** The pod configuration. */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I remember, map is not well supported. I think we used a list of pairs in other places.

int64 preemption_percentage = 5; /** The percentage of the partition that can be preempted. */
int64 priority = 6; /** The priority of the partition. */
}

repeated PartitionCreate partitions = 1; /** The list of partitions to create. */
}

/**
* Response to create a partitions.
*
* Return a list of raw partitions with the given values.
*/
message CreatePartitionsResponse {
repeated PartitionRaw partitions = 1; /** The list of raw partitions. */
}
16 changes: 16 additions & 0 deletions Protos/V1/partitions_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,20 @@ service Partitions {
* Get a partition by its ID.
*/
rpc GetPartition(GetPartitionRequest) returns (GetPartitionResponse) {}

/**
* Update a partition by its ID.
* Null or empty (or -1 for integers) data means that tehy will not be updated
*/
rpc UpdatePartitions(UpdatePartitionsRequest) returns (UpdatePartitionsResponse) {}

/**
* Delete a list of partition by ID.
*/
rpc DeletePartitions(DeletePartitionsRequest) returns (DeletePartitionsResponse) {}

/**
* Create partitions and return their IDs.
*/
rpc CreatePartitions(CreatePartitionsRequest) returns (CreatePartitionsResponse) {}
}