Skip to content

Commit

Permalink
feat: create request and response
Browse files Browse the repository at this point in the history
  • Loading branch information
esoubiran-aneo committed Dec 14, 2022
1 parent de4a395 commit 5a48e4b
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Api/common/protofiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export README_PATH=$REPOSITORY_PATH/README.md

armonik_worker_files=("agent_service.proto" "worker_service.proto")
armonik_client_files=("submitter_service.proto" "tasks_service.proto" "sessions_service.proto" \
"results_service.proto" "applications_service.proto")
"results_service.proto" "applications_service.proto" "partitions_service.proto")
armonik_common_files=("objects.proto" "task_status.proto" "session_status.proto" \
"result_status.proto" "agent_common.proto" "sessions_common.proto" \
"submitter_common.proto" "tasks_common.proto" "worker_common.proto" \
"results_common.proto" "applications_common.proto")
"results_common.proto" "applications_common.proto" "partitions_common.proto")
3 changes: 3 additions & 0 deletions Api/csharp/ArmoniK.Api.Client/ArmoniK.Api.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
</Protobuf>
<Protobuf Include="..\..\..\Protos\V1\results_service.proto" GrpcServices="Client">
<Link>gRPC\Protos\results_service.proto</Link>
</Protobuf>
<Protobuf Include="..\..\..\Protos\V1\partitions_service.proto" GrpcServices="Client">
<Link>gRPC\Protos\partitions_service.proto</Link>
</Protobuf>
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions Api/csharp/ArmoniK.Api.Common/ArmoniK.Api.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@
<GrpcServices>Message</GrpcServices>
<ProtoCompile>True</ProtoCompile>
</Protobuf>
<Protobuf Include="..\..\..\Protos\V1\partitions_common.proto" Link="partitions_common.proto">
<GrpcServices>Message</GrpcServices>
<ProtoCompile>True</ProtoCompile>
</Protobuf>
</ItemGroup>

</Project>
3 changes: 3 additions & 0 deletions Api/csharp/ArmoniK.Api.Core/ArmoniK.Api.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
<Protobuf Include="..\..\..\Protos\V1\results_service.proto" GrpcServices="Both">
<Link>gRPC\Protos\results_service.proto</Link>
</Protobuf>
<Protobuf Include="..\..\..\Protos\V1\partitions_service.proto" GrpcServices="Both">
<Link>gRPC\Protos\partitions_service.proto</Link>
</Protobuf>
</ItemGroup>

</Project>
90 changes: 86 additions & 4 deletions Protos/V1/partitions_common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,92 @@ option csharp_namespace = "Armonik.Api.Grpc.V1.Partitions";
message PartitionRaw {
string id = 1; /** The partition ID. */
repeated string parent_partition_ids = 2; /** The parent partition IDs. */
bool pod_reserved = 3; /** Whether the partition is reserved for pods. */
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. */
PodConfigucation pod_configuration = 7; /** The pod configuration. */
map<string, string> pod_configuration = 7; /** The pod configuration. */
int64 preemption_percentage = 5; /** The percentage of the partition that can be preempted. */
int64 priority = 6; /** The priority of the partition. */
}

/**
* Request to list partitions.
*/
message ListPartitionsRequest {
int32 page = 1; /** The page number. Start at 0. */
int32 page_size = 2; /** The number of items per page. */

/**
* Represents a filter with all available fields.
*
* Any fields can be used at the same time.
*/
message Filter {
string id = 1; /** The partition ID. */
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. */

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

/**
* The filter.
*
* Must be set for every request but allowed to be empty.
*/
Filter filter = 3;

/**
* Represents every available field to use in order to sort partitions.
*/
enum OrderByField {
ORDER_BY_FIELD_UNSPECIFIED = 0; /** Unspecified. */
ORDER_BY_FIELD_ID = 1; /** The partition ID. */
ORDER_BY_FIELD_PARENT_PARTITION_IDS = 2; /** The parent partition IDs. */
ORDER_BY_FIELD_POD_RESERVED = 3; /** Whether the partition is reserved for pods. */
ORDER_BY_FIELD_POD_MAX = 4; /** The maximum number of pods that can be used by sessions using the partition. */
ORDER_BY_FIELD_POD_CONFIGURATION = 7; /** The pod configuration. */
ORDER_BY_FIELD_PREEMPTION_PERCENTAGE = 5; /** The percentage of the partition that can be preempted. */
ORDER_BY_FIELD_PRIORITY = 6; /** The priority of the partition. */
}

/**
* Represents the order of the sorting.
*/
enum OrderDirection {
ORDER_DIRECTION_UNSPECIFIED = 0; /** Unspecified. */
ORDER_DIRECTION_ASC = 1; /** Ascending. */
ORDER_DIRECTION_DESC = 2; /** Descending. */
}

/**
* Represents a field to use in order to sort partitions.
*/
message Sort {
OrderByField field = 1; /** The field. */
OrderDirection direction = 2; /** The order direction. */
}

/**
* The sort.
*
* Must be set for every request.
*/
repeated Sort sort = 4;
}

/**
* Response to list partitions.
*
* Use pagination, filtering and sorting from the request.
* Retunr a list of raw partitions.
*/
message ListpartitionsResponse {
repeated PartitionRaw partitions = 1; /** The list of raw partitions. */

int32 preemption_percentage = 5; /** The percentage of the partition that can be preempted. */
int32 priority = 6; /** The priority of the partition. */
int32 page = 2; /** The page number. Start at 0. */
int32 page_size = 3; /** The page size. */
int32 total = 4; /** The total number of partitions. */
}
5 changes: 0 additions & 5 deletions Protos/V1/partitions_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,4 @@ service Partitions {
* Get a partitions list using pagination, filters and sorting.
*/
rpc ListPartitions(ListPartitionsRequest) returns (ListPartitionsResponse) {}

/**
* Get a partition.
*/
rpc GetPartition(GetPartitionRequest) returns (GetPartitionResponse) {}
}

0 comments on commit 5a48e4b

Please sign in to comment.