void DryadSubGraphVertex::MakeInputParser(UInt32 whichInput, RChannelItemParserRef* pParser) { if (m_virtualInput == s_invalidVertex) { ReportError(DryadError_VertexInitialization, "MakeInputParser called before initialization"); return; } if (whichInput >= m_numberOfInputEdges) { ReportError(DryadError_VertexInitialization, "MakeInputParser called with illegal port"); return; } EdgeInfo* edge = m_inputEdge[whichInput]; LogAssert(edge->GetSourceVertex() == m_virtualInput); LogAssert(edge->GetSourcePort() == whichInput); UInt32 inputVertex = edge->GetDestinationVertex(); LogAssert(inputVertex < m_numberOfVertices); VertexInfo* input = &(m_vertex[inputVertex]); UInt32 inputPort = edge->GetDestinationPort(); LogAssert(inputPort < input->GetInputPortCount()); DryadVertexProgramBase* subProgram = input->GetVertexProgram(); subProgram->MakeInputParser(inputPort, pParser); ReportError(subProgram->GetErrorCode(), subProgram->GetErrorMetaData()); }
bool DryadSubGraphVertex::SetUpChannels(WorkQueue* sharedWorkQueue, RChannelReader** inputChannel, RChannelWriter** outputChannel) { UInt32 i; for (i=0; i<m_numberOfEdges; ++i) { EdgeInfo* edge = &(m_edge[i]); UInt32 srcVertex = edge->GetSourceVertex(); UInt32 dstVertex = edge->GetDestinationVertex(); UInt32 srcPort = edge->GetSourcePort(); UInt32 dstPort = edge->GetDestinationPort(); m_vertex[dstVertex].SetInputEdge(dstPort, edge); m_vertex[srcVertex].SetOutputEdge(srcPort, edge); if (srcVertex == m_virtualInput) { LogAssert(dstVertex != m_virtualOutput); m_vertex[dstVertex].SetInputChannel(dstPort, true, inputChannel[srcPort]); } else if (dstVertex == m_virtualOutput) { m_vertex[srcVertex].SetOutputChannel(srcPort, true, outputChannel[dstPort]); } else { WorkQueue* workQueue = m_vertex[dstVertex].GetWorkQueue(); if (workQueue == NULL) { workQueue = sharedWorkQueue; } edge->MakeFifo(m_internalFifoLength, workQueue); m_vertex[dstVertex].SetInputChannel(dstPort, false, edge->GetReader()); m_vertex[srcVertex].SetOutputChannel(srcPort, false, edge->GetWriter()); } } for (i=0; i<m_numberOfVertices; ++i) { if (!m_vertex[i].Verify()) { return false; } } return true; }