Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
        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();
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
 private void SendInit()
 {
     if (_state == State.INIT)
     {
         JobStatusProto proto = new JobStatusProto();
         proto.identifier = _jobId;
         proto.state      = State.INIT;
         Send(proto);
         _state = State.RUNNING;
     }
 }
Beispiel #5
0
 private void Send(JobStatusProto status)
 {
     LOGGER.Log(Level.Info, "Sending job status " + status);
     _jobStatusHandler.OnNext(status);
 }