public void Dispose(Optional <Exception> e) { try { if (e.IsPresent()) { OnError(e.Value); } else { JobStatusProto proto = new JobStatusProto(); proto.identifier = _jobId; proto.state = State.DONE; Send(proto); } } catch (Exception ex) { Org.Apache.Reef.Utilities.Diagnostics.Exceptions.CaughtAndThrow(ex, Level.Warning, "Error closing ClientJobStatusHandler", LOGGER); } try { _jobControlChannel.Dispose(); } catch (Exception ex) { Org.Apache.Reef.Utilities.Diagnostics.Exceptions.CaughtAndThrow(ex, Level.Warning, "Error closing jobControlChannel", LOGGER); } }
public void OnError(Exception error) { LOGGER.Log(Level.Error, "job excemption", error); JobStatusProto proto = new JobStatusProto(); proto.identifier = _jobId; proto.state = State.FAILED; proto.exception = ByteUtilities.StringToByteArrays(error.Message); _clock.Dispose(); }
public void OnNext(byte[] value) { LOGGER.Log(Level.Info, "Job message from {0}" + _jobId); SendInit(); JobStatusProto proto = new JobStatusProto(); proto.identifier = _jobId; proto.state = State.RUNNING; proto.message = value; Send(proto); }
private void SendInit() { if (_state == State.INIT) { JobStatusProto proto = new JobStatusProto(); proto.identifier = _jobId; proto.state = State.INIT; Send(proto); _state = State.RUNNING; } }
private void Send(JobStatusProto status) { LOGGER.Log(Level.Info, "Sending job status " + status); _jobStatusHandler.OnNext(status); }