Esempio n. 1
0
        /// <summary>
        /// This handles runtime error occurs on the evaluator
        /// </summary>
        /// <param name="runtimeErrorProto"></param>
        public void Handle(RuntimeErrorProto runtimeErrorProto)
        {
            FailedRuntime error = new FailedRuntime(runtimeErrorProto);

            LOGGER.Log(Level.Warning, "Runtime error:" + error);

            EvaluatorException evaluatorException = error.Cause != null
                ? new EvaluatorException(error.Id, error.Cause.Value)
                : new EvaluatorException(error.Id, "Runtime error");
            EvaluatorManager evaluatorManager = null;

            lock (_evaluators)
            {
                if (_evaluators.ContainsKey(error.Id))
                {
                    evaluatorManager = _evaluators[error.Id];
                }
                else
                {
                    LOGGER.Log(Level.Warning, "Unknown evaluator runtime error: " + error.Cause);
                }
            }
            if (null != evaluatorManager)
            {
                evaluatorManager.Handle(evaluatorException);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Get the exception from error
 /// </summary>
 /// <param name="error"></param>
 /// <returns>excetpiont from error</returns>
 private static Exception GetException(RuntimeErrorProto error)
 {
     byte[] data = error.exception;
     if (data != null)
     {
         return(new InvalidOperationException(ByteUtilities.ByteArrarysToString(error.exception)));
     }
     return(null);
 }
Esempio n. 3
0
        /// <summary>
        /// Handles RuntimeStop
        /// </summary>
        /// <param name="runtimeStop"></param>
        public void OnNext(RuntimeStop runtimeStop)
        {
            LOGGER.Log(Level.Info, "RuntimeStop: " + runtimeStop);
            if (runtimeStop.Exception != null)
            {
                string exceptionMessage = runtimeStop.Exception.Message;
                LOGGER.Log(Level.Warning, "Sending runtime error:" + exceptionMessage);
                RuntimeErrorProto runtimeErrorProto = new RuntimeErrorProto();
                runtimeErrorProto.message   = exceptionMessage;
                runtimeErrorProto.exception = ByteUtilities.StringToByteArrays(exceptionMessage);
                runtimeErrorProto.name      = "REEF";
                _runtimeErrorHandler.OnNext(runtimeErrorProto);

                LOGGER.Log(Level.Warning, "DONE Sending runtime error: " + exceptionMessage);
            }

            lock (_evaluators)
            {
                foreach (EvaluatorManager evaluatorManager in _evaluators.Values)
                {
                    LOGGER.Log(Level.Warning, "Unclean shutdown of evaluator: " + evaluatorManager.Id);
                    evaluatorManager.Dispose();
                }
            }

            try
            {
                _heartbeatConnectionChannel.Dispose();
                _errorChannel.Dispose();
                Optional <Exception> e = runtimeStop.Exception != null ?
                                         Optional <Exception> .Of(runtimeStop.Exception) : Optional <Exception> .Empty();

                _clientJobStatusHandler.Dispose(e);

                LOGGER.Log(Level.Info, "driver manager closed");
            }
            catch (Exception e)
            {
                Exceptions.Caught(e, Level.Error, "Error disposing Driver manager", LOGGER);
                Exceptions.Throw(new InvalidOperationException("Cannot dispose driver manager"), LOGGER);
            }
        }
Esempio n. 4
0
 public FailedRuntime(RuntimeErrorProto error)
     : base(error.identifier, error.message, null, GetException(error), error.exception)
 {
 }
Esempio n. 5
0
 /// <summary>
 /// Something went wrong at the runtime layer (either driver or evaluator). This
 /// method simply forwards the RuntimeErrorProto to the client via the RuntimeErrorHandler.
 /// </summary>
 /// <param name="runtimeErrorProto"></param>
 private void Fail(RuntimeErrorProto runtimeErrorProto)
 {
     _runtimeErrorHandler.OnNext(runtimeErrorProto);
     _clockFuture.Get().Dispose();
 }