Git Product home page Git Product logo

Comments (8)

justicezyx avatar justicezyx commented on July 22, 2024

Chris, WDYT? Please feel free to assign this issue to me if you are OK with it.

from glow.

chrislusf avatar chrislusf commented on July 22, 2024

Yes, please add any unit tests whenever you see fit.

Invited you to the collaborator list. After that I can assign this issue to you.

Just ask me anything you are not familiar with.

from glow.

justicezyx avatar justicezyx commented on July 22, 2024

I apologize for the build failure. I am fixing them.

There are 2 issues:

  1. Lists are not sorted, causing list comparison sometime fails the channel_util_test.go.
  2. Data race in network_util_test.go.

It should be straightforward to fix. But if you prefer to rollback the change, that's also fine to me.

from glow.

justicezyx avatar justicezyx commented on July 22, 2024

Hi Chris, the following test code does not write the input string to the 'text' file. It seems Slice() does not behave the same way as Source() when writing output, is this expected?

  1 package flow                                                                                                             
  2                                                                                                                          
  3 import "testing"                                                                                                         
  4                                                                                                                          
  5 func TestSource(t *testing.T) {                                                                                          
  6   fc := New()                                                                                                            
  7                                                                                                                          
  8   inputChan := make(chan string, 0)                                                                                      
  9   go func() {                                                                                                            
 10     inputChan <- "test1"                                                                                                 
 11     inputChan <- "test2"                                                                                                 
 12     close(inputChan)                                                                                                     
 13   }()                                                                                                                    
 14   fc.Channel(inputChan).SaveTextToFile("test")                                                                           
 15 }

from glow.

chrislusf avatar chrislusf commented on July 22, 2024

Need a map step. The implementation assumes there is a at least one map reduce step in the flow.

This test adds a simple map step.

package flow

import (
    "testing"
)

func TestSource(t *testing.T) {
    fc := New()

    inputChan := make(chan string, 0)
    go func() {
        inputChan <- "test1"
        inputChan <- "test2"
        close(inputChan)
    }()
    fc.Channel(inputChan).Map(func(t string) string {
        return t
    }).SaveTextToFile("test")

}

from glow.

justicezyx avatar justicezyx commented on July 22, 2024

Thanks Chris for the explanation.

Pardon my ignorance, could you provide some clues on the difference between FlowContext.Channel() and FlowContext.Source()? Reading the source code, I could not figure out why their behaviors differ. I guess the Task/Step setups are different between them, but could not figure out the exact places.

from glow.

chrislusf avatar chrislusf commented on July 22, 2024

For Channel(), the data actually flow into the system in doChannel() via ExternalInputChans. It does not have any goroutine to pump data in.

This is different from Source(), where the data come in via a function f. The Source() has goroutine to pump data in.

from glow.

justicezyx avatar justicezyx commented on July 22, 2024

I see, thanks a lot for the explanation.

from glow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.