Example #1
0
        public void Cancel(Exception e)
        {
            Logging.Error("Cancelling execution of graph {0}, due to exception:\n{1}", this.Index, e);

            lock (this)
            {
                if (this.currentState == InternalComputationState.Failed)
                {
                    return;
                }

                this.currentState = InternalComputationState.Failed;
                this.Exception    = e;


                if (this.Controller.NetworkChannel != null)
                {
                    MessageHeader  header  = MessageHeader.GraphFailure(this.index);
                    SendBufferPage page    = SendBufferPage.CreateSpecialPage(header, 0);
                    BufferSegment  segment = page.Consume();

                    Logging.Error("Broadcasting graph failure message");

                    this.Controller.NetworkChannel.BroadcastBufferSegment(header, segment);
                }

                this.ProgressTracker.Cancel();
            }
        }
Example #2
0
 public DataStreamSocketSender(Socket socket)
 {
     this.socket   = socket;
     this.sendPage = new SendBufferPage(GlobalBufferPool <byte> .pool, PAGE_SIZE);
     this.sendPage.WriteHeader(new MessageHeader(-1, 0, (int)RemotingProtocol.DATA_CHANNEL_ID, -1, SerializedMessageType.Data));
     this.serializer = AutoSerialization.GetSerializer <T>();
 }
Example #3
0
        public override void Send(Pair <S, T> record, RemotePostbox from)
        {
            if (this.serializer == null)
            {
                this.serializer = AutoSerialization.GetSerializer <Pair <S, T> >();
            }

            SendBufferPage page = this.messagesFromLocalThreads[from.ThreadIndex];

            if (page == null)
            {
                this.messagesFromLocalThreads[from.ThreadIndex] = new SendBufferPage(GlobalBufferPool <byte> .pool, this.pageSize);
                page = this.messagesFromLocalThreads[from.ThreadIndex];
                page.WriteHeader(new MessageHeader(from.VertexID, /* TODO FIXME: this.sendSequenceNumbers[destProcessID, destVertexID]++ */ 0, this.Id, this.VertexId, SerializedMessageType.Data));
            }

            if (!page.WriteRecord(this.serializer, record))
            {
                this.Flush(from);
                this.messagesFromLocalThreads[from.ThreadIndex] = new SendBufferPage(GlobalBufferPool <byte> .pool, this.pageSize);
                page = this.messagesFromLocalThreads[from.ThreadIndex];
                page.WriteHeader(new MessageHeader(from.VertexID, /* TODO FIXME: this.sendSequenceNumbers[destProcessID, destVertexID]++ */ 0, this.Id, this.VertexId, SerializedMessageType.Data));

                bool success = page.WriteRecord(this.serializer, record);
                if (!success)
                {
                    throw new Exception("Record too long to spill");
                }
            }
        }
Example #4
0
        private void AnnounceStartup(int barrierId)
        {
            int seqno = this.GetSequenceNumber(-1);
            SendBufferPage startupPage = SendBufferPage.CreateSpecialPage(MessageHeader.GenerateBarrierMessageHeader(barrierId), seqno, this.HeaderSerializer);
            BufferSegment startupSegment = startupPage.Consume();

            for (int i = 0; i < this.connections.Count - 2; ++i)
                startupSegment.Copy();

            for (int i = 0; i < this.connections.Count; ++i)
            {
                if (i != this.localProcessID)
                {
                    Logging.Info("Sending startup message to process {0}", i);
                    this.SendBufferSegment(startupPage.CurrentMessageHeader, i, startupSegment);
                }
            }
        }
Example #5
0
        public void AnnounceCheckpoint()
        {
            int seqno = this.GetSequenceNumber(-1);
            SendBufferPage checkpointPage = SendBufferPage.CreateSpecialPage(MessageHeader.Checkpoint, seqno, this.Controller.SerializationFormat.GetSerializer<MessageHeader>());
            BufferSegment checkpointSegment = checkpointPage.Consume();

            for (int i = 0; i < this.connections.Count - 2; ++i)
                checkpointSegment.Copy();

            for (int i = 0; i < this.connections.Count; ++i)
            {
                if (i != this.localProcessID)
                {
                    Logging.Info("Sending checkpoint message to process {0}", i);
                    this.SendBufferSegment(checkpointPage.CurrentMessageHeader, i, checkpointSegment);
                }
            }
        }
Example #6
0
        private void AnnounceShutdown()
        {
            Logging.Progress("Announcing shutdown");
            int seqno = this.GetSequenceNumber(-1);
            SendBufferPage shutdownPage = SendBufferPage.CreateShutdownMessagePage(seqno, this.HeaderSerializer);
            BufferSegment shutdownSegment = shutdownPage.Consume();

            for (int i = 0; i < this.connections.Count - 2; ++i)
                shutdownSegment.Copy();

            for (int i = 0; i < this.connections.Count; ++i)
            {
                if (i != this.localProcessID)
                {
                    Logging.Progress("Sending shutdown message to process {0}", i);
                    this.SendBufferSegment(shutdownPage.CurrentMessageHeader, i, shutdownSegment);
                }
            }
        }