fixed my night crew typoes
This commit is contained in:
parent
68eabf6510
commit
05eac44a4c
3 changed files with 22 additions and 22 deletions
|
|
@ -3,7 +3,7 @@ package JobServ;
|
|||
import io.grpc.ManagedChannel;
|
||||
import io.grpc.ManagedChannelBuilder;
|
||||
import io.grpc.StatusRuntimeException;
|
||||
|
||||
import java.util.InputMismatchException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
|
@ -50,7 +50,7 @@ public class JobServClient {
|
|||
public String getProcessOutput(int pid) {
|
||||
logger.info("[+] requesting output");
|
||||
|
||||
RequestMessage request = PIDMessage.newBuilder()
|
||||
PIDMessage request = PIDMessage.newBuilder()
|
||||
.setPid(pid)
|
||||
.build();
|
||||
OutputMessage response;
|
||||
|
|
@ -60,11 +60,10 @@ public class JobServClient {
|
|||
response = blockingStub.getOutput(request);
|
||||
} catch (StatusRuntimeException e) {
|
||||
logger.log(Level.WARNING, "[-] Request for output failed: %s", e.getStatus());
|
||||
// TODO: refactor this out by throwing here and catching in the shell
|
||||
return "";
|
||||
return "<Error connecting to API>";
|
||||
}
|
||||
|
||||
return response.getProcessOutput();
|
||||
return response.getOutput();
|
||||
}
|
||||
|
||||
// sends the server a command for a new job, blocks until response
|
||||
|
|
@ -86,7 +85,7 @@ public class JobServClient {
|
|||
return -1;
|
||||
}
|
||||
|
||||
if(response.getpid() == -1) {
|
||||
if(response.getPid() == -1) {
|
||||
logger.log(Level.WARNING, "New job creation failed server side!");
|
||||
}
|
||||
|
||||
|
|
@ -95,7 +94,7 @@ public class JobServClient {
|
|||
|
||||
// requests running status of job
|
||||
// returns true if job still running else false
|
||||
public bool getProcessStatus(int pid) {
|
||||
public Boolean getProcessStatus(int pid) {
|
||||
logger.info("[+] Requesting status of a job");
|
||||
|
||||
PIDMessage request = PIDMessage.newBuilder()
|
||||
|
|
@ -108,6 +107,7 @@ public class JobServClient {
|
|||
response = blockingStub.getStatus(request);
|
||||
} catch (StatusRuntimeException e) {
|
||||
logger.log(Level.WARNING, "[-] Request for status failed!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return response.getIsRunning();
|
||||
|
|
@ -167,7 +167,7 @@ public class JobServClient {
|
|||
// check args
|
||||
if (args.length < 3) {
|
||||
System.out.println("Usage: $ jobservclient host port command");
|
||||
System.out.println("Or try client --help")
|
||||
System.out.println("Or try client --help");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -191,12 +191,12 @@ public class JobServClient {
|
|||
}
|
||||
|
||||
String command = "";
|
||||
for (int token = 3; i < args.length; i++) {
|
||||
for (int token = 3; token < args.length; token++) {
|
||||
command += " " + args[token];
|
||||
}
|
||||
|
||||
int newProcess = client.sendNewJobMessage(command);
|
||||
System.out.println("Process started, assigned pid is %d", newProcess);
|
||||
System.out.printf("Process started, assigned pid is %d\n", newProcess);
|
||||
break;
|
||||
|
||||
case "output":
|
||||
|
|
@ -231,7 +231,7 @@ public class JobServClient {
|
|||
}
|
||||
|
||||
Boolean processStatus = client.getProcessStatus(candidatePid);
|
||||
System.out.println("Process is currently running? %b", processStatus);
|
||||
System.out.printf("Process is currently running? %b\n", processStatus);
|
||||
break;
|
||||
|
||||
case "kill":
|
||||
|
|
@ -248,7 +248,7 @@ public class JobServClient {
|
|||
break;
|
||||
}
|
||||
|
||||
client.getProcessOutput(candidatePid);
|
||||
client.killProcess(candidatePid);
|
||||
System.out.println("End process request recieved!");
|
||||
break;
|
||||
|
||||
|
|
@ -266,7 +266,7 @@ public class JobServClient {
|
|||
break;
|
||||
}
|
||||
|
||||
int returnCode = client.getProcessOutput(candidatePid);
|
||||
int returnCode = client.getProcessReturn(candidatePid);
|
||||
|
||||
if (returnCode == 277) {
|
||||
System.out.println("Process is still running");
|
||||
|
|
@ -277,7 +277,7 @@ public class JobServClient {
|
|||
break;
|
||||
|
||||
} else {
|
||||
System.out.println("Process Exit Code: %d", returnCode);
|
||||
System.out.printf("Process Exit Code: %d\n", returnCode);
|
||||
}
|
||||
|
||||
default:
|
||||
|
|
@ -288,7 +288,7 @@ public class JobServClient {
|
|||
|
||||
public static void outputHelp() {
|
||||
System.out.println("... new (command)");
|
||||
System.out.println("Starts a new process on the server")
|
||||
System.out.println("Starts a new process on the server");
|
||||
System.out.println("... output (pid)");
|
||||
System.out.println("Garners output from process on server");
|
||||
System.out.println("... status (pid)");
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public class JobServServer {
|
|||
StreamObserver<StatusMessage> responder) {
|
||||
// TODO: Implement job controller, check request type, do the thing
|
||||
StatusMessage reply = StatusMessage.newBuilder()
|
||||
.setStatusCode(-1)
|
||||
.setIsRunning(true)
|
||||
.build();
|
||||
responder.onNext(reply);
|
||||
responder.onCompleted();
|
||||
|
|
@ -93,7 +93,7 @@ public class JobServServer {
|
|||
StreamObserver<ReturnMessage> responder) {
|
||||
// TODO: Implement job controller, get return code
|
||||
ReturnMessage reply = ReturnMessage.newBuilder()
|
||||
.setprocessReturnCode(277)
|
||||
.setProcessReturnCode(277)
|
||||
.build();
|
||||
responder.onNext(reply);
|
||||
responder.onCompleted();
|
||||
|
|
@ -101,11 +101,11 @@ public class JobServServer {
|
|||
|
||||
@Override
|
||||
public void killJob(PIDMessage request,
|
||||
StreamObserver<ReturnMessage> responder) {
|
||||
StreamObserver<StatusMessage> responder) {
|
||||
// TODO: implement job controller, do the thing
|
||||
// TODO: kill job here
|
||||
ReturnMessage reply = ReturnMessage.newBuilder()
|
||||
.setprocessReturnCode(-1)
|
||||
StatusMessage reply = StatusMessage.newBuilder()
|
||||
.setIsRunning(false)
|
||||
.build();
|
||||
responder.onNext(reply);
|
||||
responder.onCompleted();
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ service ShellServer {
|
|||
}
|
||||
|
||||
message StatusMessage {
|
||||
bool IsRunning = 1
|
||||
bool IsRunning = 1;
|
||||
}
|
||||
|
||||
message ReturnMessage {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue