Ejemplo n.º 1
0
 /// <summary>
 ///  THIS ASSUMES THAT IT IS CALLED ON A THREAD HOLDING THE LOCK ON THE HeartBeatManager
 /// </summary>
 /// <param name="e"></param>
 private void HandleTaskException(TaskClientCodeException e)
 {
     LOGGER.Log(Level.Error, "TaskClientCodeException", e);
     byte[] exception = ByteUtilities.StringToByteArrays(e.ToString());
     TaskStatusProto taskStatus = new TaskStatusProto()
     {
         context_id = e.ContextId,
         task_id = e.TaskId,
         result = exception,
         state = State.FAILED
     };
     LOGGER.Log(Level.Error, "Sending Heartbeat for a failed task: {0}", taskStatus);
     _heartBeatManager.OnNext(taskStatus);
 }
Ejemplo n.º 2
0
        /// <summary>
        ///  THIS ASSUMES THAT IT IS CALLED ON A THREAD HOLDING THE LOCK ON THE HeartBeatManager
        /// </summary>
        /// <param name="e"></param>
        private void HandleTaskInitializationException(TaskClientCodeException e)
        {
            byte[] error;
            try
            {
                error = ByteUtilities.SerializeToBinaryFormat(e);
            }
            catch (SerializationException se)
            {
                error = ByteUtilities.SerializeToBinaryFormat(
                    TaskClientCodeException.CreateWithNonSerializableInnerException(e, se));
            }

            var avroFailedTask = new AvroFailedTask
            {
                identifier = e.TaskId,
                cause = error,
                data = ByteUtilities.StringToByteArrays(e.ToString()),
                message = e.Message
            };

            var taskStatus = new TaskStatusProto
            {
                context_id = e.ContextId,
                task_id = e.TaskId,
                result = AvroJsonSerializer<AvroFailedTask>.ToBytes(avroFailedTask),
                state = State.FAILED
            };

            LOGGER.Log(Level.Error, "Sending Heartbeat for a failed task: {0}", taskStatus);
            _heartBeatManager.OnNext(taskStatus);
        }