Skip to content

Commit

Permalink
Added getDefaultRuntime to SchedulerService
Browse files Browse the repository at this point in the history
Fixes #44
  • Loading branch information
sverhoeven committed Jun 14, 2019
1 parent 5f92022 commit 4432e4a
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Added

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -491,4 +491,19 @@ public void getFileSystem(XenonProto.Scheduler request, StreamObserver<XenonProt
responseObserver.onError(mapException(e));
}
}

@Override
public void getDefaultRuntime(XenonProto.Scheduler request, StreamObserver<XenonProto.GetDefaultRuntimeResponse> responseObserver) {
try {
Scheduler scheduler = getScheduler(request);
int defaultRuntime = scheduler.getDefaultRuntime();
XenonProto.GetDefaultRuntimeResponse value = XenonProto.GetDefaultRuntimeResponse.newBuilder()
.setValue(defaultRuntime)
.build();
responseObserver.onNext(value);
responseObserver.onCompleted();
} catch (Exception e) {
responseObserver.onError(mapException(e));
}
}
}
6 changes: 6 additions & 0 deletions src/main/proto/xenon.proto
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,10 @@ message Is {
bool value = 1;
}

message GetDefaultRuntimeResponse {
uint32 value = 1;
}

// XenonFiles represents the Xenon nl.esciencecenter.xenon.filesystems.FileSystem class.
// This interface contains various methods for creating and closing FileSystems, creating Paths and operations on these Paths.
service FileSystemService {
Expand Down Expand Up @@ -593,6 +597,8 @@ service SchedulerService {
rpc isOpen(Scheduler) returns (Is) {}
// Cancel a job
rpc cancelJob(JobRequest) returns (JobStatus) {}
// Get the default runtime of a job in minutes.
rpc getDefaultRuntime(Scheduler) returns (GetDefaultRuntimeResponse) {}
// Retrieve the FileSystem used internally by this Scheduler.
rpc getFileSystem(Scheduler) returns (FileSystem) {}
// Close this Scheduler.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -647,4 +647,10 @@ public void getFileSystem_usesFileSystemFalse() throws XenonException {
client.getFileSystem(createScheduler());
}

@Test
public void getDefaultRuntime() {
XenonProto.GetDefaultRuntimeResponse response = client.getDefaultRuntime(createScheduler());
int expected = 0;
assertEquals(expected, response.getValue());
}
}

0 comments on commit 4432e4a

Please sign in to comment.