Function calls and signals



  • I created an app as in the image. I'm using npm package visionappster to call a function and then receive a signal when the result is ready. My client script calls the MyInput function to send an image with some string data (handle). Then it will receive result from MyOutput signal.
    If I constantly call MyInput function again soon as it returns (succeeds), I get only some of these calls back from MyOutput signal. I don't get any errors on function call or from signal even when it's missing some results.
    Is there something wrong with my example app or what might be causing this?

    Capture.JPG



  • It's hard to say exactly what happens. But I wonder if this is what you actually wanted to do. When you call the MyInput function, JavaScriptMyInput gets executed. The results will be passed back to your client code using a callback function. This is how tool function APIs work, please see here for details.

    The outputs of the tool that is exposed as an API function are available to the processing graph. In your case, they will trigger the rest of the graph, producing a signal at the end. If clients connect to this signal, they will be delivered whatever comes out of the pipe independent of who triggered the graph. Thus, there is no 1:1 correspondence between what you sent to what you receive.

    Another thing that may cause a discrepancy is your script code at the end. If it does not set the output parameter, it will not be sent. In this case, the parameter must be flagged asynchronous.

    What you probably want to do is to bundle your graph into a single compound tool and make that a function API.



  • My purpose is to send images from one component and receive results elsewhere. To identify the results on the receiving end, I need the handle to be send with the results.

    My test client works fine, if I add a delay between each send.

    Here's output from my test client (without send delay):

    [20190829 11:48:54:499] Calling MyInput. 114945544.png
    [20190829 11:48:54:515] MyInput Success received. 114945544.png
    [20190829 11:48:54:517] Received from MyOutput. handle: 114945544.png mean: 124.68081841432227 sum: 563040
    [20190829 11:48:54:582] Calling MyInput. 114945696.png
    [20190829 11:48:54:598] MyInput Success received. 114945696.png
    [20190829 11:48:54:662] Calling MyInput. 114946000.png
    [20190829 11:48:54:672] MyInput Success received. 114946000.png
    [20190829 11:48:54:737] Calling MyInput. 114946152.png
    [20190829 11:48:54:747] MyInput Success received. 114946152.png
    [20190829 11:48:54:812] Calling MyInput. 114946456.png
    [20190829 11:48:54:829] MyInput Success received. 114946456.png
    [20190829 11:48:54:886] Calling MyInput. 114946608.png
    [20190829 11:48:54:897] MyInput Success received. 114946608.png
    [20190829 11:48:54:962] Calling MyInput. 114947216.png
    [20190829 11:48:54:972] MyInput Success received. 114947216.png
    [20190829 11:48:55:016] Received from MyOutput. handle: 114947216.png mean: 123.54674623472579 sum: 563040
    

    Here's output with 500ms delay between each send:

    [20190829 12:14:12:925] Calling MyInput. 114945544.png
    [20190829 12:14:12:943] MyInput Success received. 114945544.png
    [20190829 12:14:12:945] Received from MyOutput. handle: 114945544.png mean: 124.68081841432227 sum: 563040
    [20190829 12:14:13:535] Calling MyInput. 114945696.png
    [20190829 12:14:13:552] MyInput Success received. 114945696.png
    [20190829 12:14:13:553] Received from MyOutput. handle: 114945696.png mean: 124.16420502983804 sum: 563040
    [20190829 12:14:14:068] Calling MyInput. 114946000.png
    [20190829 12:14:14:079] MyInput Success received. 114946000.png
    [20190829 12:14:14:080] Received from MyOutput. handle: 114946000.png mean: 123.91249111963626 sum: 563040
    [20190829 12:14:14:595] Calling MyInput. 114946152.png
    [20190829 12:14:14:606] MyInput Success received. 114946152.png
    [20190829 12:14:14:607] Received from MyOutput. handle: 114946152.png mean: 136.205544899119 sum: 563040
    [20190829 12:14:15:122] Calling MyInput. 114946456.png
    [20190829 12:14:15:139] MyInput Success received. 114946456.png
    [20190829 12:14:15:140] Received from MyOutput. handle: 114946456.png mean: 123.72054916169368 sum: 563040
    [20190829 12:14:15:701] Calling MyInput. 114946608.png
    [20190829 12:14:15:712] MyInput Success received. 114946608.png
    [20190829 12:14:15:713] Received from MyOutput. handle: 114946608.png mean: 136.5730658567775 sum: 563040
    [20190829 12:14:16:227] Calling MyInput. 114947216.png
    [20190829 12:14:16:237] MyInput Success received. 114947216.png
    [20190829 12:14:16:238] Received from MyOutput. handle: 114947216.png mean: 123.54674623472579 sum: 563040
    
    


  • I see. While I'm still unsure which part of the whole pipeline is failing, this is a good description that will help us dig it deeper. Thanks for reporting.



  • I refactored my example and got same result as above. I hope this narrows down the problem. Also used wireshark to look traffic between test client and engine, but didn't find any problem there (so, most probably my test client script and visionappster.js is working fine).

    Capture2.JPG


Log in to reply