Skip to content

Commit 4432e4a

Browse files
committed
Added getDefaultRuntime to SchedulerService
Fixes #44
1 parent 5f92022 commit 4432e4a

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1010

1111
### Added
1212

13+
* getDefaultRuntime rpc to SchedulerService ([#44](https://github.com/xenon-middleware/xenon-grpc/issues/44))
1314
* start_time and temp_space fields to JobDescription message ([#43](https://github.com/xenon-middleware/xenon-grpc/issues/43))
1415
* [at](https://linux.die.net/man/1/at) scheduler
1516

src/main/java/nl/esciencecenter/xenon/grpc/schedulers/SchedulerService.java

+15
Original file line numberDiff line numberDiff line change
@@ -491,4 +491,19 @@ public void getFileSystem(XenonProto.Scheduler request, StreamObserver<XenonProt
491491
responseObserver.onError(mapException(e));
492492
}
493493
}
494+
495+
@Override
496+
public void getDefaultRuntime(XenonProto.Scheduler request, StreamObserver<XenonProto.GetDefaultRuntimeResponse> responseObserver) {
497+
try {
498+
Scheduler scheduler = getScheduler(request);
499+
int defaultRuntime = scheduler.getDefaultRuntime();
500+
XenonProto.GetDefaultRuntimeResponse value = XenonProto.GetDefaultRuntimeResponse.newBuilder()
501+
.setValue(defaultRuntime)
502+
.build();
503+
responseObserver.onNext(value);
504+
responseObserver.onCompleted();
505+
} catch (Exception e) {
506+
responseObserver.onError(mapException(e));
507+
}
508+
}
494509
}

src/main/proto/xenon.proto

+6
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,10 @@ message Is {
469469
bool value = 1;
470470
}
471471

472+
message GetDefaultRuntimeResponse {
473+
uint32 value = 1;
474+
}
475+
472476
// XenonFiles represents the Xenon nl.esciencecenter.xenon.filesystems.FileSystem class.
473477
// This interface contains various methods for creating and closing FileSystems, creating Paths and operations on these Paths.
474478
service FileSystemService {
@@ -593,6 +597,8 @@ service SchedulerService {
593597
rpc isOpen(Scheduler) returns (Is) {}
594598
// Cancel a job
595599
rpc cancelJob(JobRequest) returns (JobStatus) {}
600+
// Get the default runtime of a job in minutes.
601+
rpc getDefaultRuntime(Scheduler) returns (GetDefaultRuntimeResponse) {}
596602
// Retrieve the FileSystem used internally by this Scheduler.
597603
rpc getFileSystem(Scheduler) returns (FileSystem) {}
598604
// Close this Scheduler.

src/test/java/nl/esciencecenter/xenon/grpc/schedulers/SchedulerServiceBlockingTest.java

+6
Original file line numberDiff line numberDiff line change
@@ -647,4 +647,10 @@ public void getFileSystem_usesFileSystemFalse() throws XenonException {
647647
client.getFileSystem(createScheduler());
648648
}
649649

650+
@Test
651+
public void getDefaultRuntime() {
652+
XenonProto.GetDefaultRuntimeResponse response = client.getDefaultRuntime(createScheduler());
653+
int expected = 0;
654+
assertEquals(expected, response.getValue());
655+
}
650656
}

0 commit comments

Comments
 (0)